Monday 10 April 2017

No-Export Community configuration example -BGP



BGP has few well known community and No-export is one of them. In IGP we uses Tagging to identity perticular routes but in bgp there is no tagging but in BGP we have Communities. 

Community is very much similar to tagging which can be set on a router and send to the neighbor routers. Neighbor routers can match these community to apply policies.

Routes which are learn with no-Export community are not sent further to any eBGP neighbors and can be send to iBGP neighbors only as shown in above diagram.

R1:-

interface Loopback0
 ip address 1.1.1.1 255.255.255.255

interface FastEthernet2/0
Description “ Connected to R2”
 ip address 12.12.12.1 255.255.255.0
 no shut

router bgp 1
 no synchronization
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 12.12.12.2 remote-as 2
 neighbor 12.12.12.2 send-community both  --<< Without it Community will not send to neighbor
 neighbor 12.12.12.2 route-map setCommunity out
 no auto-summary

route-map setCommunity permit 10
 set community no-export  -<< Set the no export community to all R1 Routes 

R2:-

interface Loopback0
 ip address 2.2.2.2 255.255.255.255

interface FastEthernet0/0
 ip address 23.23.23.2 255.255.255.0
 speed auto
 duplex auto

interface FastEthernet1/0
Description “Connected to R5”
 ip address 25.25.25.2 255.255.255.0
no shut

interface FastEthernet2/0
Description “Connected to R1”
 ip address 12.12.12.2 255.255.255.0
no shut

Router eigrp 2    ----<< To provide connectivity between AS2 Routers
 network 23.23.23.2 0.0.0.0

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 neighbor 12.12.12.1 remote-as 1
 neighbor 23.23.23.3 remote-as 2
 neighbor 23.23.23.3 next-hop-self
 neighbor 23.23.23.3 send-community both
 neighbor 25.25.25.5 remote-as 3
 no auto-summary

R3:-

interface Loopback0
 ip address 3.3.3.3 255.255.255.255

interface FastEthernet0/1
Description “Connected to R4”
 ip address 34.34.34.3 255.255.255.0
 no shut


interface FastEthernet0/0
Description “Connected to R3”
 ip address 23.23.23.3 255.255.255.0
no shut

router eigrp 2
 network 23.23.23.3 0.0.0.0
 network 34.34.34.3 0.0.0.0

router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 3.3.3.3 mask 255.255.255.255
 neighbor 23.23.23.2 remote-as 2
 neighbor 23.23.23.2 route-reflector-client  --<< R3 is RR for R2 and R4
 neighbor 34.34.34.4 remote-as 2
 neighbor 34.34.34.4 route-reflector-client --<< R3 is RR for R2 and R4
 neighbor 34.34.34.4 send-community both
 no auto-summary

R4:-

interface Loopback0
 ip address 4.4.4.4 255.255.255.255

interface FastEthernet0/1
Description “Connected to R4”
 ip address 34.34.34.4 255.255.255.0

router eigrp 2
 network 34.34.34.4 0.0.0.0
!
router bgp 2
 no synchronization
 bgp log-neighbor-changes
 network 4.4.4.4 mask 255.255.255.255
 neighbor 34.34.34.3 remote-as 2
 no auto-summary

R5:-

interface Loopback0
 ip address 5.5.5.5 255.255.255.255

interface FastEthernet1/0
Description “Connected to R2”
 ip address 25.25.25.5 255.255.255.0

router bgp 3
 no synchronization
 bgp log-neighbor-changes
 network 5.5.5.5 mask 255.255.255.255
 neighbor 25.25.25.2 remote-as 2
 no auto-summary

Verification:-

R1:-

R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
B        2.2.2.2 [20/0] via 12.12.12.2, 02:33:00
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [20/0] via 12.12.12.2, 01:38:37
      4.0.0.0/32 is subnetted, 1 subnets
B        4.4.4.4 [20/0] via 12.12.12.2, 01:31:59
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/0] via 12.12.12.2, 01:28:17
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.12.12.0/24 is directly connected, FastEthernet2/0
L        12.12.12.1/32 is directly connected, FastEthernet2/0

R1#sh ip bgp
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, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32       0.0.0.0                  0         32768 i
*> 2.2.2.2/32       12.12.12.2               0             0 2 i
*> 3.3.3.3/32       12.12.12.2                             0 2 i
*> 4.4.4.4/32       12.12.12.2                             0 2 i
*> 5.5.5.5/32       12.12.12.2                             0 2 3 i

R2:-

R2#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [20/0] via 12.12.12.1, 01:22:32
      2.0.0.0/32 is subnetted, 1 subnets
C        2.2.2.2 is directly connected, Loopback0
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [200/0] via 23.23.23.3, 01:39:19
      4.0.0.0/32 is subnetted, 1 subnets
B        4.4.4.4 [200/0] via 34.34.34.4, 01:32:11
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/0] via 25.25.25.5, 01:28:29
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.12.12.0/24 is directly connected, FastEthernet2/0
L        12.12.12.2/32 is directly connected, FastEthernet2/0
      23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        23.23.23.0/24 is directly connected, FastEthernet0/0
L        23.23.23.2/32 is directly connected, FastEthernet0/0
      25.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        25.25.25.0/24 is directly connected, FastEthernet1/0
L        25.25.25.2/32 is directly connected, FastEthernet1/0
      34.0.0.0/24 is subnetted, 1 subnets
D        34.34.34.0 [90/30720] via 23.23.23.3, 01:32:16, FastEthernet0/0

R2#sh ip bgp
BGP table version is 11, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32       12.12.12.1               0             0 1 i
*> 2.2.2.2/32       0.0.0.0                  0         32768 i
*>i3.3.3.3/32       23.23.23.3               0    100      0 i
*>i4.4.4.4/32       34.34.34.4               0    100      0 i
*> 5.5.5.5/32       25.25.25.5               0             0 3 i

R2#sh ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32, version 11
Paths: (1 available, best #1, table default, not advertised to EBGP peer)
  Advertised to update-groups:
     5
  1
    12.12.12.1 from 12.12.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: no-export --<<< Learning Community which is set on R1

R3:-

R3#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [200/0] via 23.23.23.2, 05:39:39
      2.0.0.0/32 is subnetted, 1 subnets
B        2.2.2.2 [200/0] via 23.23.23.2, 05:49:37
      3.0.0.0/32 is subnetted, 1 subnets
C        3.3.3.3 is directly connected, Loopback0
      4.0.0.0/32 is subnetted, 1 subnets
B        4.4.4.4 [200/0] via 34.34.34.4, 05:49:37
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [200/0] via 23.23.23.2, 05:45:36
      23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        23.23.23.0/24 is directly connected, FastEthernet0/0
L        23.23.23.3/32 is directly connected, FastEthernet0/0
      34.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        34.34.34.0/24 is directly connected, FastEthernet0/1
L        34.34.34.3/32 is directly connected, FastEthernet0/1

R3#sh ip bgp
BGP table version is 13, 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, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.1/32       23.23.23.2               0    100      0 1 i
*>i2.2.2.2/32       23.23.23.2               0    100      0 i
*> 3.3.3.3/32       0.0.0.0                  0         32768 i
*>i4.4.4.4/32       34.34.34.4               0    100      0 i
*>i5.5.5.5/32       23.23.23.2               0    100      0 3 i

R3#sh ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32, version 13
Paths: (1 available, best #1, table default, not advertised to EBGP peer)
  Advertised to update-groups:
     3
  1, (Received from a RR-client)
    23.23.23.2 from 23.23.23.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Community: no-export

R4:-

R4#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [200/0] via 23.23.23.2, 05:40:19
      2.0.0.0/32 is subnetted, 1 subnets
B        2.2.2.2 [200/0] via 23.23.23.2, 05:49:25
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [200/0] via 34.34.34.3, 05:56:59
      4.0.0.0/32 is subnetted, 1 subnets
C        4.4.4.4 is directly connected, Loopback0
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [200/0] via 23.23.23.2, 05:46:16
      23.0.0.0/24 is subnetted, 1 subnets
D        23.23.23.0 [90/30720] via 34.34.34.3, 05:49:30, FastEthernet0/1
      34.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        34.34.34.0/24 is directly connected, FastEthernet0/1
L        34.34.34.4/32 is directly connected, FastEthernet0/1
      45.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        45.45.45.0/24 is directly connected, FastEthernet2/0
L        45.45.45.4/32 is directly connected, FastEthernet2/0

R4#sh ip bgp
BGP table version is 12, 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, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i1.1.1.1/32       23.23.23.2               0    100      0 1 i
*>i2.2.2.2/32       23.23.23.2               0    100      0 i
*>i3.3.3.3/32       34.34.34.3               0    100      0 i
*> 4.4.4.4/32       0.0.0.0                  0         32768 i
*>i5.5.5.5/32       23.23.23.2               0    100      0 3 i

R4#sh ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32, version 12
Paths: (1 available, best #1, table default, not advertised to EBGP peer)
  Not advertised to any peer
  1
    23.23.23.2 (metric 30720) from 34.34.34.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Community: no-export
      Originator: 2.2.2.2, Cluster list: 3.3.3.3

R5:-

R5#sh ip bgp --<<< No R1 Route advertised from R2 to R5
BGP table version is 7, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.2.2/32       25.25.25.2               0             0 2 i
*> 3.3.3.3/32       25.25.25.2                             0 2 i
*> 4.4.4.4/32       25.25.25.2                             0 2 i
*> 5.5.5.5/32       0.0.0.0                  0         32768 i

R5#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets --<<< No R1 Route advertised from R2 to R5
B        2.2.2.2 [20/0] via 25.25.25.2, 01:30:55
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [20/0] via 25.25.25.2, 01:30:55
      4.0.0.0/32 is subnetted, 1 subnets
B        4.4.4.4 [20/0] via 25.25.25.2, 01:30:55
      5.0.0.0/32 is subnetted, 1 subnets
C        5.5.5.5 is directly connected, Loopback0
      25.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        25.25.25.0/24 is directly connected, FastEthernet1/0
L        25.25.25.5/32 is directly connected, FastEthernet1/0



No comments:

Post a Comment