Update:

First time ever I met Yakov Rekhter!!!

MTU made me cry :-)
JUNOS Technology‎ > ‎

JUNOS VPN

Family Route-target:

During training I came across the nice BGP family called "route-target". It basically PE router says its RR to send only routes of those VPN that I have VRF/RT configured with. So for example if Router A is configured for only VPN A with RT of 100:100. On other hand RR is receiving routes from Router B with VPN B configured with RT 200:200, Router C with VPN A with RT of 100:100. As RR will have IBGP to all router A/B/C it will have routes of all the VPN. But when I will enable the route-target family on all routers including RR, Router A will tell RR to send me the routes which has a route-target of 100:100. Now RR will only advertise route with RT of 100:100 to Router A not all other routes with other RT values.

lab@LAB-PE# run show bgp summary
Groups: 2 Peers: 4 Down peers: 2
Table          Tot Paths  Act Paths Suppressed    History Damp State    Pending
inet.0                 0          0          0          0          0          0
bgp.l3vpn.0            0          0          0          0          0          0
Peer               AS      InPkt     OutPkt    OutQ   Flaps Last Up/Dwn State|#Active/Received/Damped...
192.168.12.1    65412          7          8       0       1           4 Establ
  inet.0: 0/0/0
  bgp.l3vpn.0: 0/0/0
  bgp.rtarget.0: 1/1/0
192.168.32.1    65412          0          3       0       0        1:32 Active
192.168.40.1    65412          0          3       0       0        1:32 Active
10.0.8.2        65002       2589       2340       0       0    19:25:08 Establ
  vpn-a.inet.0: 5/5/0

[edit protocols bgp group pe]
lab@LAB-PE# run show bgp neighbor 192.168.12.1
Peer: 192.168.12.1+2138 AS 65412 Local: 192.168.8.1+179 AS 65412
  Type: Internal    State: Established    Flags: <Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Options: <Preference LocalAddress HoldTime AddressFamily Rib-group Refresh>
  Address families configured: inet-unicast inet-vpn-unicast route-target
  Local Address: 192.168.8.1 Holdtime: 90 Preference: 170
  Number of flaps: 1
  Error: 'Cease' Sent: 0 Recv: 1
  Peer ID: 192.168.12.1     Local ID: 192.168.8.1      Active Holdtime: 90
  Keepalive Interval: 30         Peer index: 0  
  NLRI advertised by peer: inet-unicast inet-vpn-unicast route-target
  NLRI for this session: inet-unicast inet-vpn-unicast route-target

  Peer supports Refresh capability (2)
  Table inet.0 Bit: 10000
    RIB State: BGP restart is complete
    Send state: in sync
    Active prefixes:              0
    Received prefixes:            0
    Suppressed due to damping:    0
    Advertised prefixes:          0
  Table bgp.l3vpn.0
    RIB State: BGP restart is complete
    RIB State: VPN restart is complete
    Send state: not advertising
    Active prefixes:              0
    Received prefixes:            0
    Suppressed due to damping:    0
  Table bgp.rtarget.0 Bit: 30000
    RIB State: BGP restart is complete
    RIB State: VPN restart is complete
    Send state: in sync
    Active prefixes:              1
    Received prefixes:            1
    Suppressed due to damping:    0
    Advertised prefixes:          2
  Table vpn-a.inet.0 Bit: 40000
    RIB State: BGP restart is complete
    RIB State: VPN restart is complete
    Send state: in sync
    Active prefixes:              0
    Received prefixes:            0
    Suppressed due to damping:    0
    Advertised prefixes:          0
  Last traffic (seconds): Received 21   Sent 21   Checked 21 
  Input messages:  Total 7      Updates 5       Refreshes 0     Octets 540
  Output messages: Total 8      Updates 5       Refreshes 0     Octets 588
  Output Queue[0]: 0
  Output Queue[1]: 0
  Output Queue[2]: 0
  Output Queue[3]: 0
  Trace options: detail update
  Trace file: /var/log/bgp-test size 1048576 files 10


[edit protocols bgp group pe]
lab@LAB-PE# run show route table bgp.rtarget.0

bgp.rtarget.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

65412:65412:100/96               
                   *[BGP/170] 00:01:16, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, label-switched-path Sydney-To-SaoPaulo
65412:65412:300/96               
                   *[RTarget/5] 00:02:44
                      Local
65412:65412:400/96               
                   *[RTarget/5] 00:02:44
                      Local
Here x:y:z format shows x= AS the remote end PE belong to. y:z is the RT value configured or advertised.

[edit protocols bgp group pe]
lab@LAB-PE# show
type internal;
local-address 192.168.8.1;
family inet {
    unicast;
}
family inet-vpn {
    unicast;
}
family route-target;
neighbor 192.168.12.1;
neighbor 192.168.32.1;
neighbor 192.168.40.1;

[edit protocols bgp group pe]
lab@Sydney-PE#

In RR deployment of JUNOS:
Other thing to note in case of RR deployment, RR needs to have the MPLS TE or LSP to remote PE in inet.3 otherwise RR will not advertise the routes to the PE to which it doesn't have LSP from RR.

OSPF Sham-link:
For sham-link need to configure one more unit of lo0 and put that into the vrf. In my case I am using lo0.1. SHAM-LINK will the only tool which can advertise the other end PE routes as a LSA1 routes into the local end CE router. Sham-link to work properly you should have LSP up and running, if you are using the LDP-TUNNELING on LSP then make sure that it is up and running perfectly other wise sham link will report down.

[edit routing-instances vpn-a]
lab@lab-PE# show
instance-type vrf;
interface lo0.1;
interface fe-0/0/1.0;
route-distinguisher 192.168.8.1:1;
vrf-target {
    import target:65412:300;
    export target:65412:300;
}
protocols {
    ospf {
        sham-link local 192.168.9.1;
        area 0.0.0.0 {
            sham-link-remote 192.168.13.1 metric 1;
            interface fe-0/0/1.0;
            interface lo0.1;
        }
    }
}

[edit routing-instances vpn-a]
lab@lab-PE# commit
commit complete

[edit routing-instances vpn-a]
lab@lab-PE# run show ospf interface instance vpn-a
Interface              State     Area            DR ID           BDR ID       Nbrs
fe-0/0/1.0             DR       0.0.0.0         192.168.9.1     10.0.8.2        1
lo0.1                  Waiting  0.0.0.0         0.0.0.0         0.0.0.0         0
shamlink.0             PtToPt   0.0.0.0         0.0.0.0         0.0.0.0         1

[edit routing-instances vpn-a]
lab@lab-PE# run show ospf interface instance vpn-a extensive
Interface              State     Area            DR ID           BDR ID       Nbrs
fe-0/0/1.0             DR       0.0.0.0         192.168.9.1     10.0.8.2        1
  Type: LAN, Address: 10.0.8.1, Mask: 255.255.255.0, MTU: 1500, Cost: 1
  DR addr: 10.0.8.1, BDR addr: 10.0.8.2, Adj count: 1, Priority: 128
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
lo0.1                  Waiting  0.0.0.0         0.0.0.0         0.0.0.0         0
  Type: LAN, Address: 192.168.9.1, Mask: 255.255.255.255, MTU: 65535, Cost: 0
  Adj count: 0, Priority: 128
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
shamlink.0             PtToPt   0.0.0.0         0.0.0.0         0.0.0.0         1
  Type: P2P, Address: 0.0.0.0, Mask: 0.0.0.0, MTU: 0, Cost: 1
  Local: 192.168.9.1, Remote: 192.168.13.1
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None

[edit routing-instances vpn-a]
lab@lab-PE# run show ospf neighbor instance vpn-a  
  Address         Interface             State      ID              Pri  Dead
10.0.8.2         fe-0/0/1.0             Full      10.0.8.2         128    33
192.168.13.1     shamlink.0             Full      192.168.13.1       0    37

[edit routing-instances vpn-a]
lab@lab-PE# run show route in
                                ^
'in' is ambiguous.
Possible completions:
  <destination>        IP address and optional prefix length of destination
  inactive-path        Show inactive paths
  inactive-prefix      Show inactive route destinations
  instance             Show routing instances information
lab@lab-PE# run show route table vpn-a.inet.0

vpn-a.inet.0: 17 destinations, 17 routes (17 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.8.0/24        *[Direct/0] 00:59:37
                    > via fe-0/0/1.0
10.0.8.1/32        *[Local/0] 00:59:37
                      Local via fe-0/0/1.0
10.0.16.0/24       *[BGP/170] 00:01:02, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
172.17.0.0/24      *[OSPF/150] 00:56:46, metric 0, tag 0
                    > to 10.0.8.2 via fe-0/0/1.0
172.17.1.0/24      *[OSPF/150] 00:56:46, metric 0, tag 0
                    > to 10.0.8.2 via fe-0/0/1.0
172.17.2.0/24      *[OSPF/150] 00:56:46, metric 0, tag 0
                    > to 10.0.8.2 via fe-0/0/1.0
172.17.3.0/24      *[OSPF/150] 00:56:46, metric 0, tag 0
                    > to 10.0.8.2 via fe-0/0/1.0
172.17.4.0/24      *[BGP/170] 00:01:02, MED 0, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
172.17.5.0/24      *[BGP/170] 00:01:02, MED 0, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
172.17.6.0/24      *[BGP/170] 00:01:02, MED 0, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
172.17.7.0/24      *[BGP/170] 00:01:02, MED 0, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
192.168.9.1/32     *[Direct/0] 00:59:37
                    > via lo0.1
192.168.13.1/32    *[BGP/170] 00:01:02, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100192, Push 100640(top)
192.168.54.0/24    *[OSPF/150] 00:56:46, metric 0, tag 0
                    > to 10.0.8.2 via fe-0/0/1.0
192.168.55.0/24    *[BGP/170] 00:01:02, MED 0, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
192.168.55.1/32    *[BGP/170] 00:01:02, MED 1, localpref 100, from 192.168.12.1
                      AS path: I
                    > to 10.0.32.1 via fe-0/0/0.0, Push 100208, Push 100640(top)
224.0.0.5/32       *[OSPF/10] 00:59:38, metric 1
                      MultiRecv
                   
[edit routing-instances vpn-a]
lab@lab-PE#

lab@CE-C1> show route protocol ospf   

inet.0: 17 destinations, 17 routes (17 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.16.0/24       *[OSPF/10] 00:02:45, metric 3
                    > to 10.0.8.1 via ge-0/0/0.0
172.17.4.0/24      *[OSPF/150] 00:02:45, metric 0, tag 0
                    > to 10.0.8.1 via ge-0/0/0.0
172.17.5.0/24      *[OSPF/150] 00:02:45, metric 0, tag 0
                    > to 10.0.8.1 via ge-0/0/0.0
172.17.6.0/24      *[OSPF/150] 00:02:45, metric 0, tag 0
                    > to 10.0.8.1 via ge-0/0/0.0
172.17.7.0/24      *[OSPF/150] 00:02:45, metric 0, tag 0
                    > to 10.0.8.1 via ge-0/0/0.0
192.168.55.0/24    *[OSPF/150] 00:02:45, metric 0, tag 0
                    > to 10.0.8.1 via ge-0/0/0.0
192.168.55.1/32    *[OSPF/10] 00:02:45, metric 3
                    > to 10.0.8.1 via ge-0/0/0.0

224.0.0.5/32       *[OSPF/10] 00:58:19, metric 1
                      MultiRecv
L2VPN:
To reach remote end local PE will calculate Label:
local-site-id + remote-label-base - remote-label-offest

In L2VPN we will be configuring instance with local site ID and remote site ID. Site-ID must be unique per site otherwise it will be having issue with the outgoing label calculations, someone might have question about what if all site belongs to same customer then what will be the site ID but again with in one customer L2VPN network you will have to manually plan out the unique site identifier for the each site, JUNOS does offer the facility to create site-id locally but this will be not administrator control so its better to design manually and assign the site ID allocation. 
In case of Kompella  L2VPN MP-BGP will advertise the VPN Connection table carrying information like local site ID, label blocks, all those information also called the L2VPN NLRI.

Circuit Status Vector: This bit is used in Kompella draft to report issue with local site circuit status issue or transmit LSP issues to the remote end.

L2VPN also uses the L2 Extended community  to exchange information about the L2 encapsulations, control flags and Layer 2 MTU of PE-CE link.

L2Circuit using Logical routers:
L2 Circuit in JUNOS are the Martini based L2VPN based on LDP. ge-0/0/2 and ge-0/0/3 connected back to back, if you want then you can add two more CE router and run the protocols.

r2 {
    interfaces {
        ge-0/0/2 {
            unit 100 {
                encapsulation vlan-ccc;
                vlan-id 512;
            }
        }
        ge-0/3/0 {
            unit 23 {
                vlan-id 23;
                family inet {
                    address 1.1.23.2/24;
                }
                family mpls;
            }
        }
        ge-0/3/1 {
            unit 12 {
                vlan-id 12;
                family inet {
                    address 1.1.12.2/24;
                }
            }
        }
        lo0 {
            unit 102 {
                family inet {
                    address 192.168.102.2/32;
                }
            }
        }
    }
    protocols {
        rsvp {
            interface all;
        }
        mpls {     
            interface all;
        }
        bgp {
            group ibgp {
                type internal;
                local-address 192.168.102.2;
                family inet-mvpn {
                    signaling;
                }
                neighbor 192.168.104.4 {
                    family inet {
                        unicast;
                    }
                    family inet-vpn {
                        unicast;
                    }
                }
            }
        }
        ospf {
            traffic-engineering;
            area 0.0.0.0 {
                interface ge-0/3/0.23;
                interface lo0.102;
            }
        }
        ldp {
            interface all;
        }
        pim {
            rp {
                static {
                    address 192.168.103.3;
                }
            }
            interface all {
                mode sparse;
            }
        }
        l2circuit {
            neighbor 192.168.104.4 {
                interface ge-0/0/2.100 {
                    virtual-circuit-id 100;
                }
            }
        }
    }              
    routing-options {
        autonomous-system 300;
    }
}
r3 {
    interfaces {
        ge-0/3/0 {
            unit 34 {
                vlan-id 34;
                family inet {
                    address 1.1.34.3/24;
                }
                family mpls;
            }
            unit 36 {
                vlan-id 36;
                family inet {
                    address 1.1.36.3/24;
                }
                family iso;
                family mpls;
            }
        }
        ge-0/3/1 {
            unit 23 {
                vlan-id 23;
                family inet {
                    address 1.1.23.3/24;
                }
                family mpls;
            }
        }
        lo0 {
            unit 103 {
                family inet {
                    address 192.168.103.3/32;
                }
            }
        }
    }
    protocols {
        rsvp {
            interface all;
        }
        mpls {
            interface all;
        }          
        ospf {
            traffic-engineering;
            area 0.0.0.0 {
                interface ge-0/3/0.34;
                interface ge-0/3/1.23;
                interface lo0.103;
                interface ge-0/3/0.36;
            }
        }
        ldp {
            interface all;
        }
        pim {
            rp {
                local {
                    address 192.168.103.3;
                }
            }
            interface all {
                mode sparse;
            }
        }
    }
    routing-options {
        autonomous-system 300;
    }
}
r4 {
    interfaces {
        ge-0/0/3 {
            unit 100 {
                encapsulation vlan-ccc;
                vlan-id 512;
            }
        }
        inactive: ge-0/3/0 {
            unit 12 {
                encapsulation vlan-ccc;
                vlan-id 12;
            }
            unit 45 {
                vlan-id 45;
                family inet {
                    address 1.1.45.4/24;
                }
            }
        }          
        ge-0/3/1 {
            unit 34 {
                vlan-id 34;
                family inet {
                    address 1.1.34.4/24;
                }
                family mpls;
            }
        }
        lo0 {
            unit 104 {
                family inet {
                    address 192.168.104.4/32;
                }
            }
        }
    }
    protocols {
        rsvp {
            interface all;
        }
        mpls {
            interface all;
        }
        bgp {
            group ibgp {
                type internal;
                local-address 192.168.104.4;
                family inet-mvpn {
                    signaling;
                }
                neighbor 192.168.102.2 {
                    family inet {
                        unicast;
                    }
                    family inet-vpn {
                        unicast;
                    }
                }
                inactive: neighbor 3.3.3.1;
            }
        }
        ospf {
            traffic-engineering;
            area 0.0.0.0 {
                interface ge-0/3/1.34;
                interface lo0.104;
                inactive: interface ge-0/3/0.54 {
                    passive;
                }
            }
        }
        ldp {
            interface all;
        }
        pim {
            rp {
                static {
                    address 192.168.103.3;
                }
            }
            interface all {
                mode sparse;
            }
        }
        l2circuit {
            neighbor 192.168.102.2 {
                interface ge-0/0/3.100 {
                    virtual-circuit-id 100;
                }
            }
        }
    }
    routing-options {
        autonomous-system 300;
    }
}

[edit logical-systems]
lab@LAB# run show ldp neighbor logical-system r2
Address            Interface          Label space ID         Hold time
1.1.23.3           ge-0/3/0.23        192.168.103.3:0          14
192.168.104.4      lo0.102            192.168.104.4:0          41

[edit logical-systems]
lab@LAB# run show ldp session logical-system r2 extensive
Address: 192.168.103.3, State: Operational, Connection: Open, Hold time: 24
  Session ID: 192.168.102.2:0--192.168.103.3:0
  Next keepalive in 4 seconds
  Passive, Maximum PDU: 4096, Hold time: 30, Neighbor count: 1
  Neighbor types: discovered
  Keepalive interval: 10, Connect retry interval: 1
  Local address: 192.168.102.2, Remote address: 192.168.103.3
  Up for 00:49:36
  Protection: disabled
  Local - Restart: disabled, Helper mode: enabled
  Remote - Restart: disabled, Helper mode: enabled
  Local maximum neighbor reconnect time: 120000 msec
  Local maximum neighbor recovery time: 240000 msec
  Nonstop routing state: Not in sync
  Next-hop addresses received:
    1.1.23.3
    1.1.34.3
    1.1.36.3
    192.168.103.3
  Queue depth: 0
Message type               Total                     Last 5 seconds
                       Sent      Received          Sent      Received
Initialization            1             1             0             0
Keepalive               298           298             1             1
Notification              0             0             0             0
Address                   1             1             0             0
Address withdraw          0             0             0             0
Label mapping             4             4             0             0
Label request             0             0             0             0
Label withdraw            0             0             0             0
Label release             0             0             0             0
Label abort               0             0             0             0

Address: 192.168.104.4, State: Operational, Connection: Open, Hold time: 22
  Session ID: 192.168.102.2:0--192.168.104.4:0
  Next keepalive in 9 seconds
  Passive, Maximum PDU: 4096, Hold time: 30, Neighbor count: 1
  Neighbor types: configured-layer2
  Keepalive interval: 10, Connect retry interval: 1
  Local address: 192.168.102.2, Remote address: 192.168.104.4
  Up for 00:49:29
  Protection: disabled
  Local - Restart: disabled, Helper mode: enabled
  Remote - Restart: disabled, Helper mode: enabled
  Local maximum neighbor reconnect time: 120000 msec
  Local maximum neighbor recovery time: 240000 msec
  Nonstop routing state: Not in sync
  Next-hop addresses received:
    1.1.34.4
    192.168.104.4
  Queue depth: 0
Message type               Total                     Last 5 seconds
                       Sent      Received          Sent      Received
Initialization            1             1             0             0
Keepalive               297           297             0             1
Notification              0             0             0             0
Address                   1             1             0             0
Address withdraw          0             0             0             0
Label mapping             5             5             0             0
Label request             0             0             0             0
Label withdraw            0             0             0             0
Label release             0             0             0             0
Label abort               0             0             0             0

[edit logical-systems]
lab@LAB# run show l2circuit connections extensive logical-system r2
Layer-2 Circuit Connections:

Legend for connection status (St)  
EI -- encapsulation invalid      NP -- interface h/w not present  
MM -- mtu mismatch               Dn -- down                      
EM -- encapsulation mismatch     VC-Dn -- Virtual circuit Down   
CM -- control-word mismatch      Up -- operational               
VM -- vlan id mismatch           CF -- Call admission control failure
OL -- no outgoing label          IB -- TDM incompatible bitrate
NC -- intf encaps not CCC/TCC    TM -- TDM misconfiguration
BK -- Backup Connection          ST -- Standby Connection
CB -- rcvd cell-bundle size bad  XX -- unknown
SP -- Static Pseudowire

Legend for interface status 
Up -- operational           
Dn -- down                  
Neighbor: 192.168.104.4
    Interface                 Type  St     Time last up          # Up trans
    ge-0/0/2.100(vc 100)      rmt   Up     Jan 27 01:05:13 2011           1
      Remote PE: 192.168.104.4, Negotiated control-word: Yes (Null)
      Incoming label: 299920, Outgoing label: 299920
      Local interface: ge-0/0/2.100, Status: Up, Encapsulation: VLAN
    Connection History:
        Jan 27 01:05:13 2011  status update timer 
        Jan 27 01:05:13 2011  PE route changed    
        Jan 27 01:05:13 2011  In lbl Update                     299920
        Jan 27 01:05:13 2011  Out lbl Update                    299920
        Jan 27 01:05:13 2011  In lbl Update                     299920
        Jan 27 01:05:13 2011  loc intf up                 ge-0/0/2.100

[edit logical-systems]
lab@LAB# run show l2circuit connections logical-system r2
Layer-2 Circuit Connections:

Legend for connection status (St)  
EI -- encapsulation invalid      NP -- interface h/w not present  
MM -- mtu mismatch               Dn -- down                      
EM -- encapsulation mismatch     VC-Dn -- Virtual circuit Down   
CM -- control-word mismatch      Up -- operational               
VM -- vlan id mismatch           CF -- Call admission control failure
OL -- no outgoing label          IB -- TDM incompatible bitrate
NC -- intf encaps not CCC/TCC    TM -- TDM misconfiguration
BK -- Backup Connection          ST -- Standby Connection
CB -- rcvd cell-bundle size bad  XX -- unknown
SP -- Static Pseudowire

Legend for interface status 
Up -- operational           
Dn -- down                  
Neighbor: 192.168.104.4
    Interface                 Type  St     Time last up          # Up trans
    ge-0/0/2.100(vc 100)      rmt   Up     Jan 27 01:05:13 2011           1
      Remote PE: 192.168.104.4, Negotiated control-word: Yes (Null)
      Incoming label: 299920, Outgoing label: 299920
      Local interface: ge-0/0/2.100, Status: Up, Encapsulation: VLAN

[edit logical-systems]
lab@LAB#

Forwarding table entries in kernel:

Logical system: r2
Routing table: default.mpls
MPLS:
Destination        Type RtRef Next hop           Type Index NhRef Netif
default            perm     0                    rjct   819     1
0                  user     0                    recv   820     3
1                  user     0                    recv   820     3
2                  user     0                    recv   820     3
299920             user     0                   Pop     864     2 ge-0/0/2.100
299936             user     0 1.1.23.3          Pop     705     2 ge-0/3/0.23
299936(S=0)        user     0 1.1.23.3          Pop     706     2 ge-0/3/0.23
299952             user     0 1.1.23.3          Swap 299856   707     2 ge-0/3/0.23
299968             user     0 1.1.23.3          Swap 299888   829     2 ge-0/3/0.23
ge-0/0/2.100  (CCC)
                   user     0                    indr 262142     2
                              1.1.23.3          Push 299920, Push 299888(top)   865     2 ge-0/3/0.23

Logical system: r3
Routing table: default.mpls
MPLS:
Destination        Type RtRef Next hop           Type Index NhRef Netif
default            perm     0                    rjct   759     1
0                  user     0                    recv   760     3
1                  user     0                    recv   760     3
2                  user     0                    recv   760     3
299856             user     0 1.1.36.6          Pop    1019     2 ge-0/3/0.36
299856(S=0)        user     0 1.1.36.6          Pop    1020     2 ge-0/3/0.36
299872             user     0 1.1.23.2          Pop     708     2 ge-0/3/1.23
299872(S=0)        user     0 1.1.23.2          Pop     709     2 ge-0/3/1.23
299888             user     0 1.1.34.4          Pop     781     2 ge-0/3/0.34
299888(S=0)        user     0 1.1.34.4          Pop     783     2 ge-0/3/0.34


JUNOS BGP 4-byte AS number:


lab@LAB-M7i# show | no-more
r1 {
    interfaces {
        ge-0/3/0 {
            unit 11 {
                vlan-id 11;
                family inet {
                    address 192.168.11.1/24;
                }
                family mpls;
            }
        }
        lo0 {
            unit 11 {
                family inet {
                    address 11.11.11.11/32;
                }
            }
            unit 111 {
                family inet {
                    address 111.111.111.1/24;
                    address 111.111.112.1/24;
                    address 111.111.113.1/24;
                }
            }
        }
    }
    protocols {
        rsvp {
            interface all;
        }
        mpls {
            interface all;
        }
        bgp {
            group ibgp {
                type internal;
                family inet-vpn {
                    unicast;
                }
                neighbor 22.22.22.22 {
                    local-address 11.11.11.11;
                }
            }
        }
        ospf {
            area 0.0.0.0 {
                interface ge-0/3/0.11;
                interface lo0.11;
            }
        }
        ldp {
            interface all;
        }
    }
    policy-options {
        policy-statement direct {
            term 1 {
                from protocol direct;
                then accept;
            }
        }
    }
    routing-instances {
        policy {
            instance-type vrf;
            interface lo0.111;
            route-distinguisher 100:100;
            vrf-target target:77000L:100;    <--- note how you have to configure the vrf-target if you are using the value >65353.
        }
    }
    routing-options {
        autonomous-system 70000;
   <--- 4 byte AS
    }
}
r2 {
    interfaces {
        ge-0/3/1 {
            unit 11 {
                vlan-id 11;
                family inet {
                    address 192.168.11.2/24;
                }
                family mpls;
            }
        }
        lo0 {
            unit 22 {
                family inet {
                    address 22.22.22.22/32;
                }
            }
            unit 222 {
                family inet {
                    address 222.222.222.1/24;
                    address 222.222.223.1/24;
                    address 222.222.224.1/24;
                }
            }
        }
    }
    protocols {
        mpls {
            interface all;
        }
        bgp {
            group ibgp {
                type internal;
                import local-pref;
                family inet-vpn {
                    unicast;
                }
                neighbor 11.11.11.11 {
                    local-address 22.22.22.22;
                }
            }
        }
        ospf {
            area 0.0.0.0 {
                interface ge-0/3/1.11;
                interface lo0.22;
            }
        }
        ldp {
            interface all;
        }
    }
    policy-options {
        policy-statement local-pref {
            term 1 {
                from community test;
                then {
                    local-preference 200;
                    accept;
                }
            }
        }
        community test members target:77000L:100;    <--- community to match target value.
    }
    routing-instances {
        policy {
            instance-type vrf;
            interface lo0.222;
            route-distinguisher 100:101;
            vrf-target target:77000L:100;
        }
    }
    routing-options {
        autonomous-system 70000;
    }
}

[edit logical-systems]
lab@LAB-M7i# run show bgp neighbor logical-system r2   
Peer: 11.11.11.11+63256 AS 70000 Local: 22.22.22.22+179 AS 70000
  Type: Internal    State: Established    Flags: <Sync>
  Last State: OpenConfirm   Last Event: RecvKeepAlive
  Last Error: None
  Import: [ local-pref ]
  Options: <Preference LocalAddress AddressFamily Rib-group Refresh>
  Address families configured: inet-vpn-unicast
  Local Address: 22.22.22.22 Holdtime: 90 Preference: 170
  Number of flaps: 0
  Peer ID: 11.11.11.11      Local ID: 22.22.22.22      Active Holdtime: 90
  Keepalive Interval: 30         Peer index: 0  
  BFD: disabled, down
  NLRI for restart configured on peer: inet-vpn-unicast
  NLRI advertised by peer: inet-vpn-unicast
  NLRI for this session: inet-vpn-unicast
  Peer supports Refresh capability (2)
  Restart time configured on the peer: 120
  Stale routes from peer are kept for: 300
  Restart time requested by this peer: 120
  NLRI that peer supports restart for: inet-vpn-unicast
  NLRI that restart is negotiated for: inet-vpn-unicast
  NLRI of received end-of-rib markers: inet-vpn-unicast
  NLRI of all end-of-rib markers sent: inet-vpn-unicast
  Peer supports 4 byte AS extension (peer-as 70000)
  Table bgp.l3vpn.0
    RIB State: BGP restart is complete
    RIB State: VPN restart is complete
    Send state: not advertising
    Active prefixes:              6
    Received prefixes:            6
    Accepted prefixes:            6
    Suppressed due to damping:    0
  Table policy.inet.0 Bit: 30000
    RIB State: BGP restart is complete
    RIB State: VPN restart is complete
    Send state: in sync
    Active prefixes:              6
    Received prefixes:            6
    Accepted prefixes:            6
    Suppressed due to damping:    0
    Advertised prefixes:          6
  Last traffic (seconds): Received 5    Sent 1    Checked 28 
  Input messages:  Total 83     Updates 2       Refreshes 0     Octets 1771
  Output messages: Total 84     Updates 1       Refreshes 0     Octets 1809
  Output Queue[1]: 0
  Output Queue[2]: 0

[edit logical-systems]
lab@LAB-M7i# run show route protocol bgp logical-system r2 extensive   

inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)

inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)

policy.inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
111.111.111.0/24 (1 entry, 1 announced)
TSI:
KRT in-kernel 111.111.111.0/24 -> {indirect(262143)}
        *BGP    Preference: 170/-101
                Route Distinguisher: 100:100
                Next hop type: Indirect
                Next-hop reference count: 9
                Source: 11.11.11.11
                Next hop type: Router, Next hop index: 624
                Next hop: 192.168.11.1 via ge-0/3/1.11, selected
                Label operation: Push 299776
                Protocol next hop: 11.11.11.11
                Push 299776
                Indirect next hop: 8d8b0a8 262143
                State: <Secondary Active Int Ext>
                Local AS: 70000 Peer AS: 70000
                Age: 2:11       Metric2: 1
                Task: BGP_70000.11.11.11.11+63256
                Announcement bits (1): 0-KRT
                AS path: I
                Communities: target:77000L:100
                Import Accepted
                VPN Label: 299776
                Localpref: 200
                Router ID: 11.11.11.11
                Primary Routing Table bgp.l3vpn.0
                Indirect next hops: 1
                        Protocol next hop: 11.11.11.11 Metric: 1
                        Push 299776
                        Indirect next hop: 8d8b0a8 262143
                        Indirect path forwarding next hops: 1
                                Next hop type: Router
                                Next hop: 192.168.11.1 via ge-0/3/1.11
                        11.11.11.11/32 Originating RIB: inet.3
                          Metric: 1                       Node path count: 1
                          Forwarding nexthops: 1
                                Nexthop: 192.168.11.1 via ge-0/3/1.11