Tuesday, March 24, 2015

Interprovider MPLS VPN using BGP Labelled Unicast

Lets Play with Olive for interprovider MPLS VPN

===========================================



lab@olive-8.5R1.14> show configuration logical-routers ce1    
interfaces {
    em1 {
        unit 1 {
            vlan-id 1;
            family inet {
                address 18.18.18.1/30;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 1.1.1.1/32;
            }
        }
    }
}
protocols {
    ospf {
        area 0.0.0.2 {
            interface lo0.0 {
                passive;
            }
            interface em1.1;
        }
    }
}

=======================================================================

lab@olive-8.5R1.14> show configuration logical-routers pe1  
interfaces {
    em2 {
        unit 1 {
            vlan-id 1;
            family inet {
                address 18.18.18.2/30;
            }
        }
        unit 2 {
            vlan-id 2;
            family inet {
                address 19.19.19.1/30;
            }
            family mpls;
        }
    }
    lo0 {
        unit 1 {
            family inet {
                address 2.2.2.2/32;
            }
        }
    }
}
protocols {
    rsvp {
        interface em2.2;
        interface lo0.1;
    }
    mpls {
        label-switched-path To-ASBR1 {
            to 4.4.4.4;
        }
        interface em2.2;
        interface lo0.1;
    }
    bgp {
        group To_ASBR1 {
            type internal;
            local-address 2.2.2.2;
            neighbor 4.4.4.4 {
                family inet {
                    labeled-unicast {
                        rib-group inet3-to-inet0;
                        rib {
                            inet.3;
                        }
                    }
                }
            }
        }
        group To_PE2 {
            multihop {
                ttl 20;
            }
            local-address 2.2.2.2;
            family inet-vpn {
                unicast;
            }
            neighbor 7.7.7.7 {
                peer-as 200;
            }
        }
    }
    ospf {
        traffic-engineering;
        area 0.0.0.0 {
            interface em2.2;
            interface lo0.1 {
                passive;
            }
        }
    }
}
policy-options {
    policy-statement bgp-to-ospf {
        term 1 {
            from protocol bgp;
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    policy-statement export-lo {
        term 1 {
            from {
                route-filter 2.2.2.2/32 exact;
            }
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    policy-statement to-inet0 {
        term 1 {
            from {
                route-filter 7.7.7.7/32 exact;
            }
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    policy-statement to-inet3 {
        term 1 {
            from {
                route-filter 2.2.2.2/32 exact;
            }
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    policy-statement vpnexport {
        term 1 {
            from protocol ospf;
            then {
                community add test_comm;
                accept;
            }
        }
        term 2 {
            then reject;
        }
    }
    policy-statement vpnimport {
        term 1 {
            from {
                protocol bgp;
                community test_comm;
            }
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    community test_comm members target:1:100;
}
routing-instances {
    vpn2CE1 {
        instance-type vrf;
        interface em2.1;
        route-distinguisher 1:100;
        vrf-import vpnimport;
        vrf-export vpnexport;
        vrf-table-label;
        protocols {
            ospf {
                export bgp-to-ospf;
                area 0.0.0.2 {
                    interface em2.1;
                }
            }
        }
    }
}
routing-options {
    inactive: interface-routes {
        rib-group inet inet0-to-inet3;
    }
    rib-groups {
        inet0-to-inet3 {
            import-rib [ inet.0 inet.3 ];
            import-policy to-inet3;
        }
        inet3-to-inet0 {
            import-rib [ inet.3 inet.0 ];
            import-policy to-inet0;
        }
    }
    autonomous-system 100;

}

====================================================================

lab@olive-8.5R1.14> show configuration logical-routers p1     
interfaces {
    em1 {
        unit 2 {
            vlan-id 2;
            family inet {
                address 19.19.19.2/30;
            }
            family mpls;
        }
    }
    em2 {
        unit 3 {
            vlan-id 3;
            family inet {
                address 20.20.20.1/30;
            }
            family mpls;
        }
    }
    lo0 {
        unit 3 {
            family inet {
                address 3.3.3.3/32;
            }
        }
    }
}
protocols {
    rsvp {
        interface em2.3;
        interface em1.2;
        interface lo0.3;
    }
    mpls {
        icmp-tunneling;
        interface lo0.3;
        interface em2.3;
        interface em1.2;
    }
    ospf {
        traffic-engineering;
        area 0.0.0.0 {
            interface em1.2;
            interface em2.3;
            interface lo0.3 {
                passive;
            }       
        }
    }
}
========================================================================================



lab@olive-8.5R1.14> show configuration logical-routers asbr1    
interfaces {
    em1 {
        unit 3 {
            vlan-id 3;
            family inet {
                address 20.20.20.2/30;
            }
            family mpls;
        }
        unit 4 {
            vlan-id 4;
            family inet {
                address 21.21.21.1/30;
            }
            family mpls;
        }
    }
    lo0 {
        unit 4 {
            family inet {
                address 4.4.4.4/32;
            }
        }
    }
}
protocols {
    rsvp {
        interface em1.3;
        interface lo0.4;
    }
    mpls {
        icmp-tunneling;
        label-switched-path To_PE1 {
            to 2.2.2.2;
        }
        interface lo0.0;
        interface em1.3;
        interface em1.4;
    }
    bgp {
        group To-PE1 {
            type internal;
            local-address 4.4.4.4;
            neighbor 2.2.2.2 {
                family inet {
                    labeled-unicast {
                        rib {
                            inet.3;
                        }
                    }
                }
                export next-hop-self;
            }
        }
        group To-ASBR2 {
            type external;
            family inet {
                labeled-unicast {
                    rib {
                        inet.3;
                    }
                }
            }
            export To-ASBR2;
            neighbor 21.21.21.2 {
                peer-as 200;
            }
        }
    }
    ospf {
        traffic-engineering;
        area 0.0.0.0 {
            interface em1.3;
        }
        area 0.0.0.9 {
            interface lo0.4 {
                passive;
            }
        }
    }
}
policy-options {
    policy-statement To-ASBR2 {
        term 1 {
            from {
                route-filter 2.2.2.2/32 exact;
                route-filter 3.3.3.3/32 exact;
                route-filter 4.4.4.4/32 exact;
            }
            then accept;
        }
        term 2 {
            from {  
                rib inet.3;
                route-filter 2.2.2.2/32 exact;
                route-filter 3.3.3.3/32 exact;
                route-filter 4.4.4.4/32 exact;
            }
            then accept;
        }
    }
    policy-statement next-hop-self {
        then {
            next-hop self;
        }
    }
}
routing-options {
    autonomous-system 100;
}

===========================================================================================

lab@olive-8.5R1.14> show configuration logical-routers asbr2    
interfaces {
    em2 {
        unit 4 {
            vlan-id 4;
            family inet {
                address 21.21.21.2/30;
            }
            family mpls;
        }
        unit 5 {
            vlan-id 5;
            family inet {
                address 22.22.22.1/30;
            }
            family mpls;
        }
    }
    lo0 {
        unit 5 {
            family inet {
                address 5.5.5.5/32;
            }
        }
    }
}
protocols {
    rsvp {
        interface em2.5;
        interface lo0.5;
    }
    mpls {
        icmp-tunneling;
        label-switched-path To_PE2 {
            to 7.7.7.7;
        }
        interface lo0.5;
        interface em2.5;
        interface em2.4;
    }
    bgp {
        group To-PE2 {
            type internal;
            local-address 5.5.5.5;
            export next-hop-self;
            neighbor 7.7.7.7 {
                family inet {
                    labeled-unicast {
                        rib {
                            inet.3;
                        }
                    }
                }
                export next-hop-self;
            }
        }
        group To-ASBR1 {
            type external;
            family inet {
                labeled-unicast {
                    rib {
                        inet.3;
                    }
                }
            }
            export To-ASBR1;
            neighbor 21.21.21.1 {
                peer-as 100;
            }
        }
    }
    ospf {
        traffic-engineering;
        area 0.0.0.0 {
            interface em2.5;
            interface lo0.5 {
                passive;
            }
        }
    }
}
policy-options {
    policy-statement To-ASBR1 {
        term 1 {
            from {
                route-filter 7.7.7.7/32 exact;
                route-filter 6.6.6.6/32 exact;
                route-filter 5.5.5.5/32 exact;
            }
            then accept;
        }
        term 2 {
            from {
                rib inet.3;
                route-filter 7.7.7.7/32 exact;
                route-filter 6.6.6.6/32 exact;
                route-filter 5.5.5.5/32 exact;
            }
            then accept;
        }
    }
    policy-statement next-hop-self {
        then {
            next-hop self;
        }
    }
}
routing-options {
    autonomous-system 200;
}

=============================================================================================


lab@olive-8.5R1.14> show configuration logical-routers p2       
interfaces {
    em1 {
        unit 5 {
            vlan-id 5;
            family inet {
                address 22.22.22.2/30;
            }
            family mpls;
        }
        unit 6 {
            vlan-id 6;
            family inet {
                address 23.23.23.1/30;
            }
            family mpls;
        }
    }
    lo0 {
        unit 6 {
            family inet {
                address 6.6.6.6/32;
            }
        }
    }
}
protocols {
    rsvp {
        interface em1.5;
        interface em1.6;
        interface lo0.6;
    }
    mpls {
        icmp-tunneling;
        interface lo0.6;
        interface em1.5;
        interface em1.6;
    }
    ospf {
        traffic-engineering;
        area 0.0.0.0 {
            interface em1.5;
            interface em1.6;
            interface lo0.6 {
                passive;
            }
        }
    }               
}

======================================================================================

lab@olive-8.5R1.14> show configuration logical-routers pe2   
interfaces {
    em2 {
        unit 6 {
            vlan-id 6;
            family inet {
                address 23.23.23.2/30;
            }
            family mpls;
        }
        unit 7 {
            vlan-id 7;
            family inet {
                address 24.24.24.1/30;
            }
        }
    }
    lo0 {
        unit 7 {
            family inet {
                address 7.7.7.7/32;
            }
        }
    }
}
protocols {
    rsvp {
        interface em2.6;
        interface lo0.7;
    }
    mpls {
        icmp-tunneling;
        label-switched-path To-ASBR2 {
            to 5.5.5.5;
        }
        interface em2.6;
        interface lo0.7;
    }
    bgp {
        group To_ASBR2 {
            type internal;
            local-address 7.7.7.7;
            neighbor 5.5.5.5 {
                family inet {
                    labeled-unicast {
                        rib-group inet3-to-inet0;
                        rib {
                            inet.3;
                        }
                    }
                }
            }
        }
        group To_PE1 {
            type external;
            multihop {
                ttl 20;
            }
            local-address 7.7.7.7;
            family inet-vpn {
                unicast;
            }
            neighbor 2.2.2.2 {
                peer-as 100;
            }
        }
    }
    ospf {
        traffic-engineering;
        area 0.0.0.0 {
            interface em2.6;
            interface lo0.7 {
                passive;
            }
        }
    }
}
policy-options {
    policy-statement to-inet0 {
        term 1 {
            from {
                route-filter 2.2.2.2/32 exact;
            }
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    policy-statement to-inet3 {
        term 1 {
            from {
                route-filter 7.7.7.7/32 exact;
            }       
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    policy-statement vpnexport {
        term 1 {
            from protocol bgp;
            then {
                community add test_comm;
                accept;
            }
        }
        term 2 {
            then reject;
        }
    }
    policy-statement vpnimport {
        term 1 {
            from {
                protocol bgp;
                community test_comm;
            }
            then accept;
        }
        term 2 {
            then reject;
        }
    }
    community test_comm members target:1:100;
}
routing-instances {
    vpn2CE2 {
        instance-type vrf;
        interface em2.7;
        route-distinguisher 1:100;
        vrf-import vpnimport;
        vrf-export vpnexport;
        vrf-table-label;
        protocols {
            bgp {
                group To_CE2 {
                    peer-as 20;
                    neighbor 24.24.24.2;
                }   
            }
        }
    }
}
routing-options {
    inactive: interface-routes {
        rib-group inet inet0-to-inet3;
    }
    rib-groups {
        inet0-to-inet3 {
            import-rib [ inet.0 inet.3 ];
            import-policy to-inet3;
        }
        inet3-to-inet0 {
            import-rib [ inet.3 inet.0 ];
            import-policy to-inet0;
        }
    }
    autonomous-system 200;
}

===========================================================================================


lab@olive-8.5R1.14> show configuration logical-routers ce2    
interfaces {
    em1 {
        unit 7 {
            vlan-id 7;
            family inet {
                address 24.24.24.2/30;
            }
        }
    }
    lo0 {
        unit 8 {
            family inet {
                address 8.8.8.8/32;
            }
        }
    }
}
protocols {
    bgp {
        group To_PE2 {
            neighbor 24.24.24.1 {
                export myroutes;
                peer-as 200;
            }
        }
    }
}
policy-options {
    policy-statement myroutes {
        from protocol direct;
        then accept;
    }
}
routing-options {
    autonomous-system 20;
}

=========================================================================================

lab@olive-8.5R1.14:ce1> show route 

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

1.1.1.1/32         *[Direct/0] 00:15:40
                    > via lo0.0
8.8.8.8/32         *[OSPF/150] 00:14:24, metric 0, tag 3489661028
                    > to 18.18.18.2 via em1.1
18.18.18.0/30      *[Direct/0] 00:15:40
                    > via em1.1
18.18.18.1/32      *[Local/0] 00:15:40
                      Local via em1.1
224.0.0.5/32       *[OSPF/10] 00:15:46, metric 1
                      MultiRecv



lab@olive-8.5R1.14:ce2> show route 

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

1.1.1.1/32         *[BGP/170] 00:14:37, localpref 100
                      AS path: 200 100 I
                    > to 24.24.24.1 via em1.7
8.8.8.8/32         *[Direct/0] 00:15:51
                    > via lo0.8
24.24.24.0/30      *[Direct/0] 00:15:51
                    > via em1.7
24.24.24.2/32      *[Local/0] 00:15:51
                      Local via em1.7


lab@olive-8.5R1.14:ce2> traceroute 1.1.1.1 source 8.8.8.8 
traceroute to 1.1.1.1 (1.1.1.1) from 8.8.8.8, 30 hops max, 40 byte packets
 1  24.24.24.1 (24.24.24.1)  1.395 ms  1.232 ms  0.939 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  1.1.1.1 (1.1.1.1)  3.235 ms  4.352 ms  4.275 ms


lab@olive-8.5R1.14:pe1> show route 

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

2.2.2.2/32         *[Direct/0] 00:18:01
                    > via lo0.1
3.3.3.3/32         *[OSPF/10] 00:17:11, metric 1
                    > to 19.19.19.2 via em2.2
4.4.4.4/32         *[OSPF/10] 00:17:11, metric 2
                    > to 19.19.19.2 via em2.2
7.7.7.7/32         *[BGP/170] 00:16:52, MED 2, localpref 100, from 4.4.4.4
                      AS path: 200 I
                    > to 19.19.19.2 via em2.2, label-switched-path To-ASBR1
19.19.19.0/30      *[Direct/0] 00:18:01
                    > via em2.2
19.19.19.1/32      *[Local/0] 00:18:01
                      Local via em2.2
20.20.20.0/30      *[OSPF/10] 00:17:11, metric 2
                    > to 19.19.19.2 via em2.2
224.0.0.5/32       *[OSPF/10] 00:18:06, metric 1
                      MultiRecv

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

4.4.4.4/32         *[RSVP/7] 00:17:02, metric 2
                    > to 19.19.19.2 via em2.2, label-switched-path To-ASBR1
7.7.7.7/32         *[BGP/170] 00:16:52, MED 2, localpref 100, from 4.4.4.4
                      AS path: 200 I
                    > to 19.19.19.2 via em2.2, label-switched-path To-ASBR1

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

1.1.1.1/32         *[OSPF/10] 00:17:15, metric 1
                    > to 18.18.18.1 via em2.1
8.8.8.8/32         *[BGP/170] 00:16:48, localpref 100, from 7.7.7.7
                      AS path: 200 20 I
                    > to 19.19.19.2 via em2.2, label-switched-path To-ASBR1
18.18.18.0/30      *[Direct/0] 00:18:01
                    > via em2.1
18.18.18.2/32      *[Local/0] 00:18:01
                      Local via em2.1
224.0.0.5/32       *[OSPF/10] 00:18:05, metric 1
                      MultiRecv
                    
mpls.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

0                  *[MPLS/0] 00:18:01, metric 1
                      Receive
1                  *[MPLS/0] 00:18:01, metric 1
                      Receive
2                  *[MPLS/0] 00:18:01, metric 1
                      Receive
16                 *[VPN/0] 00:18:01
                      to table vpn2CE1.inet.0, Pop      

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

1:100:1.1.1.1/32                
                   *[OSPF/10] 00:17:15, metric 1
                    > to 18.18.18.1 via em2.1
1:100:8.8.8.8/32                
                   *[BGP/170] 00:16:48, localpref 100, from 7.7.7.7
                      AS path: 200 20 I
                    > to 19.19.19.2 via em2.2, label-switched-path To-ASBR1


lab@olive-8.5R1.14:pe1> set cli logical-router pe2 
Logical router: pe2

lab@olive-8.5R1.14:pe2> show route 

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

2.2.2.2/32         *[BGP/170] 00:17:09, MED 2, localpref 100, from 5.5.5.5
                      AS path: 100 I
                    > to 23.23.23.1 via em2.6, label-switched-path To-ASBR2
5.5.5.5/32         *[OSPF/10] 00:17:27, metric 2
                    > to 23.23.23.1 via em2.6
6.6.6.6/32         *[OSPF/10] 00:17:32, metric 1
                    > to 23.23.23.1 via em2.6
7.7.7.7/32         *[Direct/0] 00:18:18
                    > via lo0.7
22.22.22.0/30      *[OSPF/10] 00:17:32, metric 2
                    > to 23.23.23.1 via em2.6
23.23.23.0/30      *[Direct/0] 00:18:18
                    > via em2.6
23.23.23.2/32      *[Local/0] 00:18:18
                      Local via em2.6
224.0.0.5/32       *[OSPF/10] 00:18:23, metric 1
                      MultiRecv

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

2.2.2.2/32         *[BGP/170] 00:17:09, MED 2, localpref 100, from 5.5.5.5
                      AS path: 100 I
                    > to 23.23.23.1 via em2.6, label-switched-path To-ASBR2
5.5.5.5/32         *[RSVP/7] 00:17:18, metric 2
                    > to 23.23.23.1 via em2.6, label-switched-path To-ASBR2

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

1.1.1.1/32         *[BGP/170] 00:17:05, MED 1, localpref 100, from 2.2.2.2
                      AS path: 100 I
                    > to 23.23.23.1 via em2.6, label-switched-path To-ASBR2
8.8.8.8/32         *[BGP/170] 00:18:05, localpref 100
                      AS path: 20 I
                    > to 24.24.24.2 via em2.7
24.24.24.0/30      *[Direct/0] 00:18:18
                    > via em2.7
                    [BGP/170] 00:18:05, localpref 100
                      AS path: 20 I
                    > to 24.24.24.2 via em2.7
24.24.24.1/32      *[Local/0] 00:18:18
                      Local via em2.7

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

0                  *[MPLS/0] 00:18:21, metric 1
                      Receive
1                  *[MPLS/0] 00:18:21, metric 1
                      Receive
2                  *[MPLS/0] 00:18:21, metric 1
                      Receive
16                 *[VPN/0] 00:18:18
                      to table vpn2CE2.inet.0, Pop      

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

1:100:1.1.1.1/32                
                   *[BGP/170] 00:17:05, MED 1, localpref 100, from 2.2.2.2
                      AS path: 100 I
                    > to 23.23.23.1 via em2.6, label-switched-path To-ASBR2
1:100:8.8.8.8/32                
                   *[BGP/170] 00:18:05, localpref 100
                      AS path: 20 I
                    > to 24.24.24.2 via em2.7



lab@olive-8.5R1.14:asbr1> show route 

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

2.2.2.2/32         *[OSPF/10] 00:17:42, metric 2
                    > to 20.20.20.1 via em1.3
3.3.3.3/32         *[OSPF/10] 00:17:42, metric 1
                    > to 20.20.20.1 via em1.3
4.4.4.4/32         *[Direct/0] 00:18:33
                    > via lo0.4
19.19.19.0/30      *[OSPF/10] 00:17:42, metric 2
                    > to 20.20.20.1 via em1.3
20.20.20.0/30      *[Direct/0] 00:18:33
                    > via em1.3
20.20.20.2/32      *[Local/0] 00:18:33
                      Local via em1.3
21.21.21.0/30      *[Direct/0] 00:18:33
                    > via em1.4
21.21.21.1/32      *[Local/0] 00:18:33
                      Local via em1.4
224.0.0.5/32       *[OSPF/10] 00:18:37, metric 1
                      MultiRecv

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

2.2.2.2/32         *[RSVP/7] 00:17:34, metric 2
                    > to 20.20.20.1 via em1.3, label-switched-path To_PE1
7.7.7.7/32         *[BGP/170] 00:17:32, MED 2, localpref 100
                      AS path: 200 I
                    > to 21.21.21.2 via em1.4, Push 100016

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

0                  *[MPLS/0] 00:18:36, metric 1
                      Receive
1                  *[MPLS/0] 00:18:36, metric 1
                      Receive
2                  *[MPLS/0] 00:18:36, metric 1
                      Receive
100000             *[VPN/170] 00:17:34
                    > to 20.20.20.1 via em1.3, Swap 100000
100016             *[VPN/170] 00:17:24
                    > to 21.21.21.2 via em1.4, Swap 100016



lab@olive-8.5R1.14:asbr1> show route 

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

2.2.2.2/32         *[OSPF/10] 00:17:42, metric 2
                    > to 20.20.20.1 via em1.3
3.3.3.3/32         *[OSPF/10] 00:17:42, metric 1
                    > to 20.20.20.1 via em1.3
4.4.4.4/32         *[Direct/0] 00:18:33
                    > via lo0.4
19.19.19.0/30      *[OSPF/10] 00:17:42, metric 2
                    > to 20.20.20.1 via em1.3
20.20.20.0/30      *[Direct/0] 00:18:33
                    > via em1.3
20.20.20.2/32      *[Local/0] 00:18:33
                      Local via em1.3
21.21.21.0/30      *[Direct/0] 00:18:33
                    > via em1.4
21.21.21.1/32      *[Local/0] 00:18:33
                      Local via em1.4
224.0.0.5/32       *[OSPF/10] 00:18:37, metric 1
                      MultiRecv

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

2.2.2.2/32         *[RSVP/7] 00:17:34, metric 2
                    > to 20.20.20.1 via em1.3, label-switched-path To_PE1
7.7.7.7/32         *[BGP/170] 00:17:32, MED 2, localpref 100
                      AS path: 200 I
                    > to 21.21.21.2 via em1.4, Push 100016

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

0                  *[MPLS/0] 00:18:36, metric 1
                      Receive
1                  *[MPLS/0] 00:18:36, metric 1
                      Receive
2                  *[MPLS/0] 00:18:36, metric 1
                      Receive
100000             *[VPN/170] 00:17:34
                    > to 20.20.20.1 via em1.3, Swap 100000
100016             *[VPN/170] 00:17:24
                    > to 21.21.21.2 via em1.4, Swap 100016

lab@olive-8.5R1.14:asbr1> set cli logical-router asbr2 
Logical router: asbr2

lab@olive-8.5R1.14:asbr2> show route 

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

5.5.5.5/32         *[Direct/0] 00:18:46
                    > via lo0.5
6.6.6.6/32         *[OSPF/10] 00:17:55, metric 1
                    > to 22.22.22.2 via em2.5
7.7.7.7/32         *[OSPF/10] 00:17:55, metric 2
                    > to 22.22.22.2 via em2.5
21.21.21.0/30      *[Direct/0] 00:18:46
                    > via em2.4
21.21.21.2/32      *[Local/0] 00:18:46
                      Local via em2.4
22.22.22.0/30      *[Direct/0] 00:18:46
                    > via em2.5
22.22.22.1/32      *[Local/0] 00:18:46
                      Local via em2.5
23.23.23.0/30      *[OSPF/10] 00:17:55, metric 2
                    > to 22.22.22.2 via em2.5
224.0.0.5/32       *[OSPF/10] 00:18:50, metric 1
                      MultiRecv

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

2.2.2.2/32         *[BGP/170] 00:17:47, MED 2, localpref 100
                      AS path: 100 I
                    > to 21.21.21.1 via em2.4, Push 100000
7.7.7.7/32         *[RSVP/7] 00:17:46, metric 2
                    > to 22.22.22.2 via em2.5, label-switched-path To_PE2

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

0                  *[MPLS/0] 00:18:49, metric 1
                      Receive
1                  *[MPLS/0] 00:18:49, metric 1
                      Receive
2                  *[MPLS/0] 00:18:49, metric 1
                      Receive
100016             *[VPN/170] 00:17:46
                    > to 22.22.22.2 via em2.5, Swap 100000
100032             *[VPN/170] 00:17:37
                    > to 21.21.21.1 via em2.4, Swap 100000

=====================================================================================

OSPF Walkthrough


Lets play OSPF Walkthrough



lab@vMX-1> show configuration logical-systems 
r1 {
    interfaces {
        ge-0/0/1 {
            unit 0 {
                family inet {
                    address 10.1.1.1/30;
                }
            }
        }
        lo0 {
            unit 1 {
                family inet {
                    address 1.1.1.1/32;
                    address 1.1.1.9/32 {
                        primary;
                    }
                }
            }
        }
    }
    protocols {
        ospf {
            area 0.0.0.0 {
                interface ge-0/0/1.0;
            }
        }
    }
}
r2 {
    interfaces {
        ge-0/0/2 {
            unit 0 {
                family inet {
                    address 10.1.1.2/30;
                }
            }
        }
        lo0 {
            unit 2 {
                family inet {
                    address 1.1.1.2/32;
                }
            }
        }
    }
    protocols {
        ospf {                          
            area 0.0.0.0 {
                interface ge-0/0/2.0;
            }
        }
    }
}



lab@vMX-1:r1> show ospf neighbor 
Address          Interface              State     ID               Pri  Dead
10.1.1.2         ge-0/0/1.0             Full      1.1.1.2          128    35


lab@vMX-1:r2> show ospf neighbor 
Address          Interface              State     ID               Pri  Dead
10.1.1.1         ge-0/0/2.0             Full      1.1.1.9          128    31


you can influence the ID of ospf neighbor using loopback :))

but remember router id configuration under routing options stanza will take the highest precedence.



lab@vMX-1:r1> show configuration interfaces lo0 
unit 1 {
    family inet {
        address 1.1.1.1/32;
        address 1.1.1.9/32 {
            primary;
        }
    }
}

lab@vMX-1:r1> show configuration routing-options 
router-id 1.1.1.1;



lab@vMX-1:r2> show ospf neighbor 
Address          Interface              State     ID               Pri  Dead
10.1.1.1         ge-0/0/2.0             Full      1.1.1.1          128    39





Junos System Configuration Walkthrough


Let us walktrhough the Initial Junos System Configuration


First try the factory default...

1# load factory-default 
warning: activating factory configuration

check the config... can you do the commit ???


# commit check 
[edit]
  'system'
    Missing mandatory statement: 'root-authentication'
error: configuration check-out failed: (missing statements)


You must set the root password :))


set system root-authentication plain-text-password    
New password:


Enter your new root password and commit


now you should see the results

# commit 
commit complete

now try login as root

% cli
root@> 

root@> show system users 
 6:51AM  up 3:43, 1 user, load averages: 0.15, 0.17, 0.16
USER     TTY      FROM                              LOGIN@  IDLE WHAT
root     p0       10.210.14.216                    6:51AM      - cli           

Now you can login as root :))


root@labs# set system host-name labs 

[edit]
root@labs# set system time-zone Asia/Jakarta 

root@labs#set interfaces ge-0/0/0 unit 0 family inet address 192.168.1.1/24

root@labs# set routing-options static route 0/0 next-hop 192.168.1.100




system {
    host-name labs;
    time-zone Asia/Jakarta;
}
interfaces {
    ge-0/0/0 {
        unit 0 {                        
            family inet {
                address 192.168.1.1/24;
            }
        }
    }
}
routing-options {
    static {
        route 0.0.0.0/0 next-hop 192.168.1.100;
    }
}


Now check the process in the box

root@labs> show system processes extensive 
last pid: 12495;  load averages:  0.51,  0.28,  0.20  up 0+03:54:25    07:02:53
128 processes: 17 running, 97 sleeping, 2 zombie, 12 waiting

Mem: 149M Active, 96M Inact, 1030M Wired, 174M Cache, 112M Buf, 523M Free
Swap:


  PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
 1460 root        7  76    0   997M 64872K select 0 726:58 288.57% flowd_octeon_hm
   22 root        1 171   52     0K    16K RUN    0 183:19 75.15% idle: cpu0
   19 root        1 171   52     0K    16K RUN    3   3:02  0.00% idle: cpu3
   20 root        1 171   52     0K    16K RUN    2   3:02  0.00% idle: cpu2
 1444 root        1  76    0   115M 18284K select 0   2:49  0.00% chassisd
   21 root        1 171   52     0K    16K RUN    1   2:22  0.00% idle: cpu1
 1482 root        1  76    0 17664K  8896K select 0   1:46  0.00% utmd
   24 root        1 -20 -139     0K    16K WAIT   0   1:29  0.00% swi7: clock
 1486 root        1  76    0 12532K  6284K select 0   0:58  0.00% license-check
 1449 root        1  76    0 28068K 10592K select 0   0:23  0.00% mib2d
    5 root        1 -16    0     0K    16K rtfifo 0   0:23  0.00% rtfifo_kern_recv
 1451 root        1  76    0 20300K  8752K select 0   0:20  0.00% l2ald
 1471 root        1  76    0 15984K  3544K select 0   0:17  0.00% shm-rtsdbd
   80 root        1  -8    0     0K    16K mdwait 0   0:17  0.00% md1
 1445 root        1  76    0 12760K  5856K select 0   0:14  0.00% alarmd
 1448 root        1  76    0 20304K 12404K select 0   0:13  0.00% snmpd
   23 root        1 -40 -159     0K    16K WAIT   0   0:12  0.00% swi2: netisr 0
 1453 root        2  76    0 25500K  9116K select 0   0:10  0.00% pfed
 1450 root        1   4    0 52280K 22864K kqread 0   0:07  0.00% rpd
   48 root        1 -16    0     0K    16K psleep 0   0:06  0.00% vmkmemdaemon
 1441 root        1  76    0  3304K  1384K select 0   0:06  0.00% bslockd
 1455 root        1  76    0 26896K 10460K select 0   0:05  0.00% kmd
 1456 root        1  76    0 10028K  4304K select 0   0:05  0.00% ppmd
    3 root        1  -8    0     0K    16K -      0   0:04  0.00% g_up
 1484 root        3  76    0 13816K  5452K select 0   0:04  0.00% wland
11386 root        1  76    0 48692K 23792K select 0   0:03  0.00% mgd
   26 root        1 -16    0     0K    16K -      0   0:03  0.00% yarrow
    4 root        1  -8    0     0K    16K -      0   0:03  0.00% g_down
 1485 root        1   4    0  9632K  4128K kqread 0   0:03  0.00% mcsnoopd
 1481 root        1  76    0 13644K  6088K select 0   0:03  0.00% rtlogd
    9 root        1 171   52     0K    16K pgzero 0   0:03  0.00% pagezero
 1443 root        1  76    0 35144K  8000K select 0   0:03  0.00% dcd
 1478 root        1  76    0 30644K  9212K select 0   0:03  0.00% idpd
 1469 root        1  76    0 19008K  6888K select 0   0:03  0.00% smid
 1447 root        1  76    0 39232K 22832K select 0   0:03  0.00% mgd
 1109 root        1  76    0 12804K  4580K select 0   0:02  0.00% eventd
 1458 root        1  76    0  7960K  2996K RUN    0   0:02  0.00% irsd
 1473 root        1  76    0 25736K 12220K select 0   0:02  0.00% nsd
 1474 root        1  76    0 14436K  5976K select 0   0:02  0.00% pkid
    2 root        1  -8    0     0K    16K -      0   0:02  0.00% g_event
   43 root        1  20    0     0K    16K vnlrum 0   0:02  0.00% vnlru_mem
   41 root        1  20    0     0K    16K syncer 0   0:01  0.00% syncer
 1454 root        1  76    0 19276K  8260K select 0   0:01  0.00% cosd
11825 nobody      1 120    0  8900K  3652K select 0   0:01  0.00% httpd
    1 root        1   8    0  1696K   904K wait   0   0:01  0.00% init
11385 root        1  76    0 50220K 16868K select 0   0:01  0.00% cli
 1472 root        1  76    0 13844K  6392K select 0   0:01  0.00% jsrpd
 1459 root        1  76    0 13160K  5916K select 0   0:01  0.00% bfdd
 1440 root        1  76    0  2276K   884K select 0   0:01  0.00% watchdog
 1475 root        1  76    0 13360K  5588K select 0   0:01  0.00% httpd-gk
11346 root        1  76    0  9320K  3132K select 0   0:01  0.00% sshd
 1476 root        1  76    0 18592K  5712K select 0   0:01  0.00% appidd
 1446 root        1  76    0 13328K  5012K select 0   0:01  0.00% craftd
 1457 root        1  76    0 22980K  8116K select 0   0:01  0.00% dfwd
   32 root        1   8    0     0K    16K dwcint 0   0:01  0.00% dwc0
 1477 root        1  76    0 19692K  5952K select 0   0:01  0.00% appsecured
 1468 root        1  94    0 14856K  5360K select 0   0:01  0.00% wwand
   27 root        1 -28 -147     0K    16K WAIT   0   0:00  0.00% swi5: cambio
 1480 root        1 139    0 10548K  3424K select 0   0:00  0.00% nstraced
 1464 root        1 139    0 19104K  4916K select 0   0:00  0.00% bdbrepd
 1466 root        1  93    0 10604K  2996K select 0   0:00  0.00% sendd
 1487 root        1 139    0  9816K  2980K select 0   0:00  0.00% sdxd
 1711 root        1  76    0     0K    16K select 0   0:00  0.00% peerproxy00000001
 1461 root        1  76    0  8804K  3100K select 0   0:00  0.00% pppd
 1483 root        1  76    0  8120K  2532K select 0   0:00  0.00% smtpd
   44 root        1 -16    0     0K    16K sdflus 0   0:00  0.00% softdepflush
   42 root        1  -4    0     0K    16K vlruwt 0   0:00  0.00% vnlru
   40 root        1 -16    0     0K    16K psleep 0   0:00  0.00% bufdaemon
 1463 root        1  91    0 10528K  2784K select 0   0:00  0.00% mplsoamd
 1470 root        1  95    0  8080K  2620K select 0   0:00  0.00% relayd
  322 root        1  -8    0     0K    16K mdwait 0   0:00  0.00% md2
 1185 root        1   8    0  2672K   876K nanslp 0   0:00  0.00% cron
11369 root        1  20    0  5024K  3032K pause  0   0:00  0.00% csh
   47 root        1 -16    0     0K    16K psleep 0   0:00  0.00% vmuncachedaemon
 1452 root        1  76    0  6084K  1984K select 0   0:00  0.00% inetd
   57 root        1  -8    0     0K    16K mdwait 0   0:00  0.00% md0
12455 root        1 139    0  3184K  2136K select 0   0:00  0.00% ntpd
    6 root        1   8    0     0K    16K -      0   0:00  0.00% kqueue taskq
 1442 root        1  83    0  2712K  1264K select 0   0:00  0.00% tnetd
 1082 root        1  76    0  2392K  1208K select 0   0:00  0.00% usbd
 1488 root        1   5    0  2832K  1308K ttyin  0   0:00  0.00% getty
    8 root        1 -16    0     0K    16K psleep 0   0:00  0.00% pagedaemon
12495 root        1  78    0 24272K  1840K CPU0   0   0:00  0.00% top
   46 root        1   4    0     0K    16K pfeacc 0   0:00  0.00% if_pfe_listen
   49 root        1   4    0     0K    16K pfeacc 0   0:00  0.00% if_pic_listen0
 1279 root        1  -8    0     0K    16K mdwait 0   0:00  0.00% md3
 1294 root        1  -8    0     0K    16K mdwait 0   0:00  0.00% md4
    0 root        1  -8    0     0K     0K WAIT   0   0:00  0.00% swapper
   36 root        1   8    0     0K    16K usbevt 0   0:00  0.00% usb1
   33 root        1   8    0     0K    16K usbevt 0   0:00  0.00% usb0
   31 root        1 -48 -167     0K    16K WAIT   0   0:00  0.00% swi0: uart
    7 root        1   8    0     0K    16K -      0   0:00  0.00% thread taskq
   37 root        1 -36 -155     0K    16K WAIT   0   0:00  0.00% swi3: ip6opt ipopt
   45 root        1  76    0     0K    16K sleep  0   0:00  0.00% netdaemon
   51 root        1   4    0     0K    16K dump_r 0   0:00  0.00% kern_dump_proc
   54 root        1   8    0     0K    16K -      0   0:00  0.00% nfsiod 2
   50 root        1   4    0     0K    16K purge_ 0   0:00  0.00% kern_pir_proc
   52 root        1   8    0     0K    16K -      0   0:00  0.00% nfsiod 0
   53 root        1   8    0     0K    16K -      0   0:00  0.00% nfsiod 1
   55 root        1   8    0     0K    16K -      0   0:00  0.00% nfsiod 3
   35 root        1   8    0     0K    16K dwcint 0   0:00  0.00% dwc1
   34 root        1   8    0     0K    16K usbtsk 0   0:00  0.00% usbtask
   10 root        1 -16    0     0K    16K ktrace 0   0:00  0.00% ktrace
   29 root        1 -12 -131     0K    16K WAIT   0   0:00  0.00% swi9: +
   28 root        1 -12 -131     0K    16K WAIT   0   0:00  0.00% swi9: task queue
   30 root        1 -16 -135     0K    16K WAIT   0   0:00  0.00% swi8: +
   25 root        1 -24 -143     0K    16K WAIT   0   0:00  0.00% swi6: vm
   38 root        1 -32 -151     0K    16K WAIT   0   0:00  0.00% swi4: ip6mismatch+
   39 root        1 -44 -163     0K    16K WAIT   0   0:00  0.00% swi1: ipfwd
   15 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu7
   14 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu8
   18 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu4
   12 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu10
   11 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu11
   13 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu9
   17 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu5
   16 root        1 171   52     0K    16K CPU0   0   0:00  0.00% idle: cpu6



For specific purpose you can try 

root@labs> show system processes extensive | match ntp            
12455 root        1 139    0  3184K  2136K select 0   0:00  0.00% ntpd


root@labs> show system storage 
Filesystem              Size       Used      Avail  Capacity   Mounted on
/dev/da0s1a             610M       157M       404M       28%  /
devfs                   1.0K       1.0K         0B      100%  /dev
/dev/md0                 20M       6.4M        12M       36%  /junos
/cf/packages            610M       157M       404M       28%  /junos/cf/packages
devfs                   1.0K       1.0K         0B      100%  /junos/cf/dev
/dev/md1                415M       415M         0B      100%  /junos
/cf                      20M       6.4M        12M       36%  /junos/cf
devfs                   1.0K       1.0K         0B      100%  /junos/dev/
/cf/packages            610M       157M       404M       28%  /junos/cf/packages1
procfs                  4.0K       4.0K         0B      100%  /proc
/dev/bo0s3e              46M        32K        42M        0%  /config
/dev/bo0s3f             618M       308M       260M       54%  /cf/var
/dev/md2                336M        18M       291M        6%  /mfs
/cf/var/jail            618M       308M       260M       54%  /jail/var
/cf/var/log             618M       308M       260M       54%  /jail/var/log
devfs                   1.0K       1.0K         0B      100%  /jail/dev
/dev/md3                 63M       4.0K        58M        0%  /mfs/var/run/utm
/dev/md4                1.8M       4.0K       1.7M        0%  /jail/mfs

root@labs> show interfaces terse | match ge 
ge-0/0/0                up    up  
ge-0/0/0.0              up    up   inet     192.168.1.1/24
ge-0/0/1                up    up  
ge-0/0/2                up    up  
ge-0/0/3                up    up  
ge-0/0/4                up    up  
ge-0/0/5                up    up  
ge-0/0/6                up    up  
ge-0/0/7                up    up  
ge-0/0/8                up    up  
ge-0/0/9                up    up