Friday, October 12, 2012

MPLS BGP Soo Example




Issue

We have 3 CEs in VRF RED, R4 and R7 have a backdoor link connected between them and they run RIP to advertise their loopbacks
As well, we have BGP as the PE-CE routing protocol and all the CEs are in the same AS number, let us go through and check


Configuration

R1

R1#sh run int f0/0
interface FastEthernet0/0
 ip address 192.1.15.1 255.255.255.0
 speed 100
 full-duplex
 mpls ip

R1#sh run int f0/1
interface FastEthernet0/1
 ip vrf forwarding RED
 ip address 192.1.14.1 255.255.255.0
 speed 100
 full-duplex

R1#sh run int f1/0
interface FastEthernet1/0
 ip vrf forwarding RED
 ip address 192.1.17.1 255.255.255.0
 speed 100
 full-duplex

R1#sh run int lo0
interface Loopback0
 ip address 1.1.1.1 255.255.255.255

R1#sh run | sec ip vrf
ip vrf RED
 rd 200:10
 route-target export 200:10
 route-target import 200:10

R1#sh run | sec router ospf
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.1 0.0.0.0 area 0
 network 192.1.15.1 0.0.0.0 area 0

R1#sh run | sec router bgp
router bgp 10
 no synchronization
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 10
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 no auto-summary
 !
 address-family vpnv4
  neighbor 3.3.3.3 activate
  neighbor 3.3.3.3 send-community both
 exit-address-family
 !
 address-family ipv4 vrf RED
  neighbor 192.1.14.4 remote-as 200
  neighbor 192.1.14.4 activate
  neighbor 192.1.17.7 remote-as 200
  neighbor 192.1.17.7 activate
  no synchronization
 exit-address-family
R1#sh run | inc mpls
mpls label protocol ldp
 mpls ip
mpls ldp router-id Loopback0 force

R3

R3#sh run int f0/0
interface FastEthernet0/0
 ip vrf forwarding RED
 ip address 192.1.36.3 255.255.255.0
 speed 100
 full-duplex

R3#sh run int lo0
interface Loopback0
 ip address 3.3.3.3 255.255.255.255

R3#sh run | sec router ospf
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 network 3.3.3.3 0.0.0.0 area 0
 network 192.1.23.3 0.0.0.0 area 0
R3#sh run | inc mpls
mpls label protocol ldp
 mpls ip
mpls ldp router-id Loopback0 force
R3#sh run | sec router bgp
router bgp 10
 no synchronization
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 10
 neighbor 1.1.1.1 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 1.1.1.1 activate
  neighbor 1.1.1.1 send-community both
 exit-address-family
 !
 address-family ipv4 vrf RED
  neighbor 192.1.36.6 remote-as 200
  neighbor 192.1.36.6 activate
  no synchronization
 exit-address-family

R4

R4#sh run int lo0
interface Loopback0
 ip address 4.4.4.4 255.255.255.255

R4#sh run int f0/0
interface FastEthernet0/0
 ip address 192.1.14.4 255.255.255.0
 speed 100
 full-duplex

R4#sh run int f0/1
interface FastEthernet0/1
 ip address 192.1.47.4 255.255.255.0
 speed 100
 full-duplex

R4#sh run | sec router rip
router rip
 version 2
 network 4.0.0.0
 network 192.1.47.0
 no auto-summary

R4#sh run | sec router bgp
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 4.4.4.4 mask 255.255.255.255
 neighbor 192.1.14.1 remote-as 10
 no auto-summary

R6

R6#sh run int f0/0
interface FastEthernet0/0
 ip address 192.1.36.6 255.255.255.0
 speed 100
 full-duplex

R6#sh run int lo0
interface Loopback0
 ip address 6.6.6.6 255.255.255.255

R6#sh run | sec router bgp
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 6.6.6.6 mask 255.255.255.255
 neighbor 192.1.36.3 remote-as 10
 no auto-summary

R7

R7#sh run int f0/0
interface FastEthernet0/0
 ip address 192.1.17.7 255.255.255.0
 speed 100
 full-duplex

R7#sh run int f0/1
interface FastEthernet0/1
 ip address 192.1.47.7 255.255.255.0
 speed 100
 full-duplex

R7#sh run int lo0
interface Loopback0
 ip address 7.7.7.7 255.255.255.255

R7#sh run | sec router rip
router rip
 version 2
 network 7.0.0.0
 network 192.1.47.0
 no auto-summary

R7#sh run | sec router bgp
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 7.7.7.7 mask 255.255.255.255
 neighbor 192.1.17.1 remote-as 10
 no auto-summary


Verification

R1#sh mpls ld nei
    Peer LDP Ident: 5.5.5.5:0; Local LDP Ident 1.1.1.1:0
        TCP connection: 5.5.5.5.42565 - 1.1.1.1.646
        State: Oper; Msgs sent/rcvd: 12229/12225; Downstream
        Up time: 1w0d
        LDP discovery sources:
          FastEthernet0/0, Src IP addr: 192.1.15.5
        Addresses bound to peer LDP Ident:
          192.1.15.5      192.1.25.5      5.5.5.5      
 
R1#sh ip bgp vpnv4 all summary
BGP router identifier 1.1.1.1, local AS number 10
BGP table version is 10, main routing table version 10
3 network entries using 411 bytes of memory
3 path entries using 204 bytes of memory
4/2 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
1 BGP extended community entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1159 total bytes of memory
BGP activity 7/4 prefixes, 10/7 paths, scan interval 15 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
3.3.3.3         4    10   10632   10628       10    0    0 00:08:36        1
192.1.14.4      4   200   10624   10633       10    0    0 1d09h           1
192.1.17.7      4   200    8752    8762       10    0    0 1d09h           1

R1#sh ip bgp vpnv4 all       
BGP table version is 10, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 200:10 (default for vrf RED)
*> 4.4.4.4/32       192.1.14.4               0             0 200 i
*>i6.6.6.6/32       3.3.3.3                  0    100      0 200 i
*> 7.7.7.7/32       192.1.17.7               0             0 200 i

R3#sh mpls ld nei
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 3.3.3.3:0
        TCP connection: 2.2.2.2.646 - 3.3.3.3.22664
        State: Oper; Msgs sent/rcvd: 12226/12216; Downstream
        Up time: 1w0d
        LDP discovery sources:
          Serial0/0, Src IP addr: 192.1.23.2
        Addresses bound to peer LDP Ident:
          192.1.25.2      192.1.23.2      2.2.2.2        
R3#sh ip bgp vpnv4 all summ
BGP router identifier 3.3.3.3, local AS number 10
BGP table version is 6, main routing table version 6
3 network entries using 411 bytes of memory
3 path entries using 204 bytes of memory
4/2 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
1 BGP extended community entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1159 total bytes of memory
BGP activity 6/3 prefixes, 11/8 paths, scan interval 15 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4    10   10629   10633        6    0    0 00:09:21        2
192.1.36.6      4   200   10636   10639        6    0    0 00:09:19        1
R3#sh ip bgp vpnv4 all    
BGP table version is 6, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 200:10 (default for vrf RED)
*>i4.4.4.4/32       1.1.1.1                  0    100      0 200 i
*> 6.6.6.6/32       192.1.36.6               0             0 200 i
*>i7.7.7.7/32       1.1.1.1                  0    100      0 200 i

R4#sh ip bgp summary
BGP router identifier 4.4.4.4, local AS number 200
BGP table version is 2, main routing table version 2
1 network entries using 117 bytes of memory
1 path entries using 52 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 417 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.1.14.1      4    10   10634   10625        2    0    0 1d09h           0
R4#sh ip bgp
BGP table version is 2, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       0.0.0.0                  0         32768 i

R6#sh ip bgp summary
BGP router identifier 6.6.6.6, local AS number 200
BGP table version is 10, main routing table version 10
1 network entries using 117 bytes of memory
1 path entries using 52 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 417 total bytes of memory
BGP activity 6/5 prefixes, 6/5 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.1.36.3      4    10   10639   10636       10    0    0 00:09:39        0
R6#sh ip bgp        
BGP table version is 10, local router ID is 6.6.6.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 6.6.6.6/32       0.0.0.0                  0         32768 i

R7#sh ip bgp summary
BGP router identifier 7.7.7.7, local AS number 200
BGP table version is 2, main routing table version 2
1 network entries using 117 bytes of memory
1 path entries using 52 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 417 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.1.17.1      4    10    8763    8753        2    0    0 1d09h           0
R7#sh ip bgp        
BGP table version is 2, local router ID is 7.7.7.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 7.7.7.7/32       0.0.0.0                  0         32768 i

R7#sh ip route rip
     4.0.0.0/32 is subnetted, 1 subnets
R       4.4.4.4 [120/1] via 192.1.47.4, 00:00:14, FastEthernet0/1

R4#sh ip route rip
     7.0.0.0/32 is subnetted, 1 subnets
R       7.7.7.7 [120/1] via 192.1.47.7, 00:00:12, FastEthernet0/1

As we can see that neither of the CEs can receive the loopback of any other CEs (which is advertised in BGP) why?
The reason behind that is that the bgp speaker will not accept a route with its own AS number (which is 200 in our case)
The ways to solve this issue is:
  • BGP AS-Override
  • BGP AllowAS-in
We will go with AS-Override; the configuration will be applied on the PE towards the CE under the address-family ipv4 configuration mode
R1#conf t
R1(config)#router bgp 10
R1(config-router)# address-family ipv4 vrf RED
R1(config-router-af)#neighbor 192.1.17.7 as-override
*Mar  9 06:20:01.078: %BGP-5-ADJCHANGE: neighbor 192.1.17.7 vpn vrf RED Down AS-override change
R1(config)#router bgp 10
R1(config-router)# address-family ipv4 vrf RED
R1(config-router-af)#neighbor 192.1.14.4 as
R1(config-router-af)#neighbor 192.1.14.4 as-override
R1(config-router-af)#end
*Mar  9 06:16:44.762: %BGP-5-ADJCHANGE: neighbor 192.1.14.4 vpn vrf RED Down AS-override change

R3(config)#router bgp 10
R3(config-router)# address-family ipv4 vrf RED
R3(config-router-af)#neighbor 192.1.36.6 as
R3(config-router-af)#neighbor 192.1.36.6 as-override
*Mar  9 06:19:36.374: %BGP-5-ADJCHANGE: neighbor 192.1.36.6 vpn vrf RED Down AS-override change

R4#sh ip bgp    
BGP table version is 4, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       0.0.0.0                  0         32768 i
*> 6.6.6.6/32       192.1.14.1                             0 10 10 i
*> 7.7.7.7/32       192.1.14.1                             0 10 10 i

R6#sh ip bgp    
BGP table version is 4, local router ID is 6.6.6.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       192.1.36.3                             0 10 10 i
*> 6.6.6.6/32       0.0.0.0                  0         32768 i
*> 7.7.7.7/32       192.1.36.3                             0 10 10 i
R7#sh ip bgp
BGP table version is 4, local router ID is 7.7.7.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       192.1.17.1                             0 10 10 i
*> 6.6.6.6/32       192.1.17.1                             0 10 10 i
*> 7.7.7.7/32       0.0.0.0                  0         32768 i
Now , the SOO community is used in MPLS networks to prevent looping between the PEs , when a PE advertise a route to its neighbor PE that is attached with a soo community that matches the same rd configured under the ip vrf configuration mode , it will not advertise it to its CE
Let us configure it on R1 and check
R1#conf t
R1(config)#route-map SOO permit 10
R1(config-route-map)#set extcommunity soo 200:10

R1(config)#router bgp 10
R1(config-router)#address-family ipv4 vrf RED        
R1(config-router-af)#neighbor 192.1.14.4 route-map SOO in
R1(config-router-af)#neighbor 192.1.17.7 route-map SOO in
R1#clear ip bgp *

R1#sh ip bgp vpnv4 vrf RED 6.6.6.6
BGP routing table entry for 200:10:6.6.6.6/32, version 20
Paths: (1 available, best #1, table RED)
  Advertised to update-groups:
     2          3        
  200
    3.3.3.3 (metric 67) from 3.3.3.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Extended Community: RT:200:10
      mpls labels in/out nolabel/23
R1#
R1#
R1#sh ip bgp vpnv4 vrf RED 4.4.4.4
BGP routing table entry for 200:10:4.4.4.4/32, version 14
Paths: (1 available, best #1, table RED)
  Advertised to update-groups:
     1        
  200
    192.1.14.4 from 192.1.14.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Extended Community: SoO:200:10 RT:200:10
      mpls labels in/out 29/nolabel


.net file

For anyone want to lab it up, please find the .net file below

autostart = False
[127.0.0.1:7200]
    workingdir = /tmp
    udp = 10001
    [[3725]]
        image = INE/c3725-adventerprisek9-mz.124-18.bin
        ram = 128
        ghostios = True
    [[ROUTER R4]]
        model = 3725
        console = 2004
        aux = 2100
        f0/0 = R1 f0/1
        f0/1 = R7 f0/1
        x = -283.0
        y = 102.0
    [[ROUTER R5]]
        model = 3725
        console = 2005
        aux = 2101
        f0/0 = R1 f0/0
        f0/1 = R2 f0/0
        x = -38.0
        y = -165.0
    [[ROUTER R6]]
        model = 3725
        console = 2006
        aux = 2102
        f0/0 = R3 f0/0
        x = 58.0
        y = 99.0
    [[ROUTER R7]]
        model = 3725
        console = 2007
        aux = 2103
        f0/0 = R1 f1/0
        f0/1 = R4 f0/1
        x = -150.0
        y = 103.0
    [[ROUTER R1]]
        model = 3725
        console = 2001
        aux = 2104
        f0/0 = R5 f0/0
        f0/1 = R4 f0/0
        slot1 = NM-1FE-TX
        f1/0 = R7 f0/0
        x = -223.0
        y = -16.0
    [[ROUTER R2]]
        model = 3725
        console = 2002
        aux = 2105
        wic0/0 = WIC-2T
        s0/0 = FR1 2
        f0/0 = R5 f0/1
        x = 87.0
        y = -87.0
    [[ROUTER R3]]
        model = 3725
        console = 2003
        aux = 2106
        wic0/0 = WIC-2T
        s0/0 = FR1 3
        f0/0 = R6 f0/0
        f0/1 = R8 f0/0
        x = 175.0
        y = -17.0
    [[ROUTER R8]]
        model = 3725
        console = 2008
        aux = 2107
        f0/0 = R3 f0/1
        x = 199.0
        y = 97.0
    [[FRSW FR1]]
        2:203 = 3:302
        3:302 = 2:203
        2 = R2 s0/0
        3 = R3 s0/0
        x = 193.5
        y = -109.5

No comments: