Wednesday 12 April 2017

None Community configuration example - BGP




Below is the configuration example for None Community. As we have seen in previous examples that Community is the attribute which can be used to apply policies on he routes.

Instead of matching individual routes to apply policy we can use community to reduce the repetitive work.

We just need to match route community and apply policy to it. All routes which has the community will apply the policy automatically.

None community is used to remove all community from the routes which are in there.

As per our above example. R1 is setting NO-ADVERTISE community on the routes and sending it to R2. R2 are not sending any routes with NO-ADVERTISE community to any neighbor.

To advertise R1 Routes from R2 to R3 and R5, I just set the community none to neighbor R1. What it will do is, it will remove the NO-ADVERTISE community from R1 routes and hence R2 will be able to send R1 routes to R3/R5.

Routing table of R3/R4/R5 can confirm the above statement.


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-advertise

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

Without None Community:-

R2#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table default, not advertised to any peer)
  Not advertised to any peer
  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-advertise  --<< Learning Community which is set by R1

Set None Community:-

router bgp 2
neighbor 12.12.12.1 route-map None_Community in

route-map None_Community permit 10
 set community none   --<<< Setiing none community to all R1 routes

R2#sh ip bgp 1.1.1.1   --<<< No Community is visible now.
BGP routing table entry for 1.1.1.1/32, version 7
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     1          2
  1
    12.12.12.1 from 12.12.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best


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, 00:31:49
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [20/0] via 12.12.12.2, 00:11:38
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/0] via 12.12.12.2, 00:31:18
      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 5, 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  --<<<  R1 advertising Lo0
*> 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
*> 5.5.5.5/32       12.12.12.2                             0 2 3 i

R1#sh ip bgp summary
BGP router identifier 1.1.1.1, local AS number 1
BGP table version is 5, main routing table version 5
4 network entries using 512 bytes of memory
4 path entries using 208 bytes of memory
4/4 BGP path/bestpath attribute entries using 496 bytes of memory
2 BGP AS-PATH entries using 48 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 1264 total bytes of memory
BGP activity 4/0 prefixes, 4/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.12.12.2      4            2      40      41        5    0    0 00:33:03        3

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, 00:24:33
      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, 00:12:16
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [20/0] via 25.25.25.5, 00:32:26
      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
R2#sh ip bgp
BGP table version is 6, 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 su
R2#sh ip bgp summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 6, main routing table version 6
5 network entries using 640 bytes of memory
5 path entries using 260 bytes of memory
4/4 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP rrinfo entries using 24 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
1 BGP 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 1492 total bytes of memory
BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
12.12.12.1      4            1      41      41        6    0    0 00:33:42        1
23.23.23.3      4            2      19      19        6    0    0 00:12:24        2
25.25.25.5      4            3      41      41        6    0    0 00:33:01        1
R2#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 5
Paths: (1 available, best #1, table default, not advertised to any peer)
  Not advertised to any peer
  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-advertise  -<<< without None Community Learning Community which is set on R1

R2#sh ip bgp 1.1.1.1  --<< No Community is visible with None Community
BGP routing table entry for 1.1.1.1/32, version 7
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     1          2
  1
    12.12.12.1 from 12.12.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best

R3:-

R3#sh ip bgp
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, 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    ----<<<<< R1 routes
*>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 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, 00:13:28
      2.0.0.0/32 is subnetted, 1 subnets
B        2.2.2.2 [200/0] via 23.23.23.2, 00:15:55
      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, 00:15:55
      5.0.0.0/32 is subnetted, 1 subnets
B        5.5.5.5 [200/0] via 23.23.23.2, 00:15:55
      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.3/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/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 summary
BGP router identifier 3.3.3.3, local AS number 2
BGP table version is 6, main routing table version 6
5 network entries using 640 bytes of memory
5 path entries using 260 bytes of memory
4/4 BGP path/bestpath attribute entries using 496 bytes of memory
2 BGP AS-PATH entries using 48 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 1444 total bytes of memory
BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
23.23.23.2      4            2      24      25        6    0    0 00:16:53        3
34.34.34.4      4            2      22      24        6    0    0 00:16:57        1

R4:-

R4#sh ip bgp
BGP table version is 6, 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 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, 00:14:55
      2.0.0.0/32 is subnetted, 1 subnets
B        2.2.2.2 [200/0] via 23.23.23.2, 00:17:22
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [200/0] via 34.34.34.3, 00:17:22
      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, 00:17:22
      23.0.0.0/24 is subnetted, 1 subnets
D        23.23.23.0 [90/30720] via 34.34.34.3, 00:18:26, 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 summary
BGP router identifier 4.4.4.4, local AS number 2
BGP table version is 6, main routing table version 6
5 network entries using 640 bytes of memory
5 path entries using 260 bytes of memory
4/4 BGP path/bestpath attribute entries using 496 bytes of memory
1 BGP rrinfo entries using 24 bytes of memory
2 BGP AS-PATH entries using 48 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 1468 total bytes of memory
BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
34.34.34.3      4            2      26      24        6    0    0 00:18:25        4

R5:-

R5#sh ip bgp
BGP table version is 1, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - in                                                                              ternal,
              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
*  5.5.5.5/32       0.0.0.0                  0         32768 i

R5#sh ip bgp
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
*> 1.1.1.1/32       25.25.25.2                             0 2 1 i
*> 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

      1.0.0.0/32 is subnetted, 1 subnets
B        1.1.1.1 [20/0] via 25.25.25.2, 00:15:44
      2.0.0.0/32 is subnetted, 1 subnets
B        2.2.2.2 [20/0] via 25.25.25.2, 00:18:12
      3.0.0.0/32 is subnetted, 1 subnets
B        3.3.3.3 [20/0] via 25.25.25.2, 00:17:41
      4.0.0.0/32 is subnetted, 1 subnets
B        4.4.4.4 [20/0] via 25.25.25.2, 00:17:41
      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

R5#sh ip bgp summary
BGP router identifier 5.5.5.5, local AS number 3
BGP table version is 7, main routing table version 7
5 network entries using 640 bytes of memory
5 path entries using 260 bytes of memory
4/4 BGP path/bestpath attribute entries using 496 bytes of memory
2 BGP AS-PATH entries using 48 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 1444 total bytes of memory
BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

25.25.25.2      4            2      28      26        7    0    0 00:19:12        4

No comments:

Post a Comment