Sunday, November 11, 2012

Juniper MPLS VPN OSPF Sham-links

MPLS VPN OSPF Sham-links
PE1 configuration 
root@Olive# show PE1 interfaces lo0
unit 1 {
    family inet {
        address 1.1.1.1/32;
    }
}
unit 11 {
    family inet {
        address 11.11.11.11/32;
    }

root@Olive# show PE1 routing-instances
vpn-a {
    instance-type vrf;
    interface em1.16;
    interface em1.17;
    interface lo0.11;
    route-distinguisher 100:1;
    vrf-target target:100:1;
    vrf-table-label;
    protocols {
        ospf {
            export bgp-to-vpn-a;
            sham-link local 11.11.11.11;
            area 0.0.0.10 {
                sham-link-remote 33.33.33.33;
                interface em1.16;
                interface em1.17;
                interface lo0.11;
            }
        }
    }
}



PE2 configuration
root@Olive# show PE2 interfaces lo0   
unit 3 {
    family inet {
        address 3.3.3.3/32;
    }
}
unit 33 {
    family inet {
        address 33.33.33.33/32;
    }
}
root@Olive# show PE2 routing-instances
vpn-a {
    instance-type vrf;
    interface em1.38;
    interface lo0.33;
    route-distinguisher 100:1;
    vrf-target target:100:1;
    vrf-table-label;
    protocols {
        ospf {
            export bgp-to-vpn-a;
            sham-link local 33.33.33.33;
            area 0.0.0.10 {
                sham-link-remote 11.11.11.11;
                interface em1.38;
                interface lo0.33;
            }
        }
    }
}


Verifying OSPF Shamlink
root@Olive# run show ospf interface instance vpn-a logical-system PE1 detail
Interface           State   Area            DR ID           BDR ID          Nbrs
em1.16              DR      0.0.0.10        11.11.11.11     6.6.6.6            1
  Type: LAN, Address: 192.168.16.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1
  DR addr: 192.168.16.1, BDR addr: 192.168.16.6, Priority: 128
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None
  Topology default (ID 0) -> Cost: 1
em1.17              DR      0.0.0.10        11.11.11.11     7.7.7.7            1
  Type: LAN, Address: 192.168.17.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1
  DR addr: 192.168.17.1, BDR addr: 192.168.17.7, Priority: 128
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None
  Topology default (ID 0) -> Cost: 1
lo0.11              DR      0.0.0.10        11.11.11.11     0.0.0.0            0
  Type: LAN, Address: 11.11.11.11, Mask: 255.255.255.255, MTU: 65535, Cost: 0
  DR addr: 11.11.11.11, Priority: 128
  Adj count: 0
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None
  Topology default (ID 0) -> Cost: 0
shamlink.0          PtToPt  0.0.0.10        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: 11.11.11.11, Remote: 33.33.33.33
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None, No eligible backup
  Topology default (ID 0) -> Cost: 1

root@Olive# run show ospf interface instance vpn-a logical-system PE2 detail   
Interface           State   Area            DR ID           BDR ID          Nbrs
em1.38              DR      0.0.0.10        33.33.33.33     8.8.8.8            1
  Type: LAN, Address: 192.168.38.3, Mask: 255.255.255.0, MTU: 1496, Cost: 1
  DR addr: 192.168.38.3, BDR addr: 192.168.38.8, Priority: 128
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None
  Topology default (ID 0) -> Cost: 1
lo0.33              DR      0.0.0.10        33.33.33.33     0.0.0.0            0
  Type: LAN, Address: 33.33.33.33, Mask: 255.255.255.255, MTU: 65535, Cost: 0
  DR addr: 33.33.33.33, Priority: 128
  Adj count: 0
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None
  Topology default (ID 0) -> Cost: 0
shamlink.0          PtToPt  0.0.0.10        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: 33.33.33.33, Remote: 11.11.11.11
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: None
  Protection type: None, No eligible backup
  Topology default (ID 0) -> Cost: 1


root@Olive# run show ospf neighbor instance vpn-a logical-system PE1 extensive    
Address          Interface              State     ID               Pri  Dead
192.168.16.6     em1.16                 Full      6.6.6.6          128    39
  Area 0.0.0.10, opt 0x42, DR 192.168.16.1, BDR 192.168.16.6
  Up 00:15:27, adjacent 00:14:42
  Topology default (ID 0) -> Bidirectional
192.168.17.7     em1.17                 Full      7.7.7.7          128    39
  Area 0.0.0.10, opt 0x42, DR 192.168.17.1, BDR 192.168.17.7
  Up 00:15:27, adjacent 00:14:42
  Topology default (ID 0) -> Bidirectional
33.33.33.33      shamlink.0             Full      33.33.33.33        0    37
  Area 0.0.0.10, opt 0x42, DR 0.0.0.0, BDR 0.0.0.0
  Up 00:14:38, adjacent 00:14:38
  Topology default (ID 0) -> Bidirectional

root@Olive# run show ospf neighbor instance vpn-a logical-system PE2 extensive   
Address          Interface              State     ID               Pri  Dead
192.168.38.8     em1.38                 Full      8.8.8.8          128    33
  Area 0.0.0.10, opt 0x42, DR 192.168.38.3, BDR 192.168.38.8
  Up 00:15:31, adjacent 00:14:47
  Topology default (ID 0) -> Bidirectional
11.11.11.11      shamlink.0             Full      11.11.11.11        0    37
  Area 0.0.0.10, opt 0x42, DR 0.0.0.0, BDR 0.0.0.0
  Up 00:14:42, adjacent 00:14:42
  Topology default (ID 0) -> Bidirectional


root@Olive# run show route 6.6.6.6/24 logical-system CE2

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

6.6.6.0/24         *[OSPF/10] 00:10:38, metric 3
                    > to 192.168.38.3 via em2.38 --> via PE2
6.6.6.6/32         *[OSPF/10] 00:10:38, metric 3
                    > to 192.168.38.3 via em2.38 --> via PE2

root@Olive# run show route 7.7.7.7/24 logical-system CE2   

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

7.7.7.0/24         *[OSPF/10] 00:10:45, metric 3
                    > to 192.168.38.3 via em2.38 --> via PE2
7.7.7.7/32         *[OSPF/10] 00:10:45, metric 3
                    > to 192.168.38.3 via em2.38 --> via PE2

root@Olive# run show route 8.8.8.8/24 logical-system CE1

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

8.8.8.0/24         *[OSPF/10] 00:12:11, metric 3
                    > to 192.168.16.1 via em2.16 --> via PE1
8.8.8.8/32         *[OSPF/10] 00:12:11, metric 3
                    > to 192.168.16.1 via em2.16 --> via PE1

root@Olive# run show route 8.8.8.8/24 logical-system CE3   

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

8.8.8.0/24         *[OSPF/10] 00:12:12, metric 3
                    > to 192.168.17.1 via em2.17 --> via PE1

8.8.8.8/32         *[OSPF/10] 00:12:12, metric 3
                    > to 192.168.17.1 via em2.17 --> via PE1

Now try deactivating interface on CE2 connect to PE2, refer to scenario on topology CE2 should choose backup link
root@Olive# deactivate CE2 interfaces em2 unit 38

root@Olive# commit
commit complete

root@Olive# run show configuration logical-systems | display set | match deactivate


deactivate logical-systems CE2 interfaces em2 unit 38


Results after deactivating interface on CE2
root@Olive# run show route 7.7.7.7/24 logical-system CE2   

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

7.7.7.0/24         *[OSPF/10] 00:10:23, metric 100
                    > to 192.168.78.7 via em2.78 --> Backup Link
7.7.7.7/32         *[OSPF/10] 00:10:23, metric 100
                    > to 192.168.78.7 via em2.78
--> Backup Link

root@Olive# run show route 6.6.6.6/24 logical-system CE2  

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

6.6.6.0/24         *[OSPF/10] 00:10:11, metric 102
                    > to 192.168.78.7 via em2.78
--> Backup Link
6.6.6.6/32         *[OSPF/10] 00:10:11, metric 102
                    > to 192.168.78.7 via em2.78
--> Backup Link

CE1 and CE3 still reachable from CE2 from Backup Link
root@Olive# run ping 6.6.6.6 logical-system CE2 rapid
PING 6.6.6.6 (6.6.6.6): 56 data bytes
!!!!!
--- 6.6.6.6 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.953/1.418/1.953/0.333 ms

[edit logical-systems]
root@Olive# run ping 7.7.7.7 logical-system CE2 rapid   
PING 7.7.7.7 (7.7.7.7): 56 data bytes
!!!!!
--- 7.7.7.7 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.084/1.587/2.533/0.541 ms

Why shamlink routes hidden in the VPN table
root@Olive# run show route hidden logical-system PE1

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

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

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

8.8.8.0/24          [OSPF] 00:05:33, metric 2
                    > via shamlink.0
8.8.8.8/32          [OSPF] 00:05:33, metric 2
                    > via shamlink.0
88.88.88.0/24       [OSPF] 00:05:33, metric 2
                    > via shamlink.0
88.88.88.88/32      [OSPF] 00:05:33, metric 2
                    > via shamlink.0
192.168.38.0/24     [OSPF] 00:05:33, metric 2
                    > via shamlink.0

mpls.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)

bgp.l3vpn.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)

root@Olive# run show route hidden logical-system PE1 detail

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

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

vpn-a.inet.0: 22 destinations, 28 routes (22 active, 0 holddown, 5 hidden)
8.8.8.0/24 (2 entries, 1 announced)
         OSPF 
                Next hop type: Router
                Next-hop reference count: 5
                Next hop: via shamlink.0, selected
                State:
                Inactive reason: Unusable path
                Age: 5:38       Metric: 2
                Area: 0.0.0.10
                Task: vpn-a-OSPF
                AS path: I
                Communities: rte-type:0.0.0.10:1:0

8.8.8.8/32 (2 entries, 1 announced)
         OSPF 
                Next hop type: Router
                Next-hop reference count: 5
                Next hop: via shamlink.0, selected
                State:
                Inactive reason: Unusable path
                Age: 5:38       Metric: 2
                Area: 0.0.0.10
                Task: vpn-a-OSPF
                AS path: I
                Communities: rte-type:0.0.0.10:1:0

88.88.88.0/24 (2 entries, 1 announced)
         OSPF 
                Next hop type: Router
                Next-hop reference count: 5
                Next hop: via shamlink.0, selected
                State:
                Inactive reason: Unusable path
                Age: 5:38       Metric: 2
                Area: 0.0.0.10
                Task: vpn-a-OSPF
                AS path: I
                Communities: rte-type:0.0.0.10:1:0

88.88.88.88/32 (2 entries, 1 announced)
         OSPF                          
                Next hop type: Router
                Next-hop reference count: 5
                Next hop: via shamlink.0, selected
                State:
                Inactive reason: Unusable path
                Age: 5:38       Metric: 2
                Area: 0.0.0.10
                Task: vpn-a-OSPF
                AS path: I
                Communities: rte-type:0.0.0.10:1:0

192.168.38.0/24 (2 entries, 1 announced)
         OSPF 
                Next hop type: Router
                Next-hop reference count: 5
                Next hop: via shamlink.0, selected
                State:
                Inactive reason: Unusable path
                Age: 5:38       Metric: 2
                Area: 0.0.0.10
                Task: vpn-a-OSPF
                AS path: I
                Communities: rte-type:0.0.0.10:1:0

Note: In Junos OS Release 9.6 and later, an OSPFv2 sham link is installed in the routing table as a hidden route. Additionally, a BGP route is not exported to OSPFv2 if a corresponding OSPF sham link is available.

http://www.juniper.net/techpubs/en_US/junos11.4/topics/topic-map/ospfv2-sham-links.html