Saturday 1 February 2020

BGP Communities


Here to demolish this community attribute am going to take R6 from our example
Lets check what all the prefixes R6 sending to its eBGP peer.

R6#sh ip bgp reg ^$
BGP table version is 91, local router ID is 150.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.1.0.0/16       0.0.0.0                  0         32768 i
*> 6.2.0.0/16       0.0.0.0                  0         32768 i
*> 6.3.0.0/16       0.0.0.0                  0         32768 i

Lets add the NO EXPORT community in all the prefixes is sending to eBGP peer R1.
Before adding the community NO-EXPORT we should send the community to its neighbor.

R6(config)#router bgp 600
R6(config-router)#neighbor 155.1.16.1 send-community

Now lets add the NO-EXPORT community

R6(config)#route-map noexport
R6(config-route-map)#set community no-export
R6(config)#router bgp 600
R6(config-router)#neighbor 155.1.16.1 route-map noexport out.

Lets check whether the community NO-EXPORT field added in the prefixes.

R1#sh ip bgp 6.1.0.1
BGP routing table entry for 6.1.0.0/16, version 98
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
  Advertised to update-groups:
     3
  600
    155.1.16.6 from 155.1.16.6 (150.6.6.6)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: no-export

Here we verified the community NO-EXPORT is added
Lets see on R5 the prefixes from R6 should not be advertised out of its AS rite?
R5#sh ip bgp
BGP table version is 111, local router ID is 150.5.5.5
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.1.0.0/16       150.4.4.4       4294967295             0 500 500 500 500 400 100 600 i
*>                         155.1.35.3      4294967295             0 100 600 i
*  6.2.0.0/16       150.4.4.4       4294967295             0 500 500 500 500 400 100 600 i
*>                         155.1.35.3      4294967295             0 100 600 i
*  6.3.0.0/16       150.4.4.4       4294967295             0 500 500 500 500 400 100 600 i
*>                         155.1.35.3      4294967295             0 100 600 i

What??? We are getting here that too out of the AS 100. but howwwww????
Lets check the community NO-EXPORT is present in the prefixes.

R5#sh ip bgp 6.1.0.0
BGP routing table entry for 6.1.0.0/16, version 117
Paths: (3 available, best #1, table Default-IP-Routing-Table)
Flag: 0x4840
  Advertised to update-groups:
     1
  100 600
    155.1.57.7 from 155.1.57.7 (155.1.123.7)
      Origin IGP, metric 50, localpref 100, valid, external, best
  500 500 500 500 400 100 600
    150.4.4.4 (metric 2297856) from 150.4.4.4 (150.4.4.4)
      Origin IGP, metric 4294967295, localpref 100, valid, external
  100 600
    155.1.35.3 from 155.1.35.3 (150.3.3.3)
      Origin IGP, metric 4294967295, localpref 100, valid, external
Huh the community NO-EXPORT is gone lets check on R3 and R7. see whether they have the community or not.

R3#sh ip bgp 6.1.0.0
BGP routing table entry for 6.1.0.0/16, version 70
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  600
    155.1.16.6 (metric 65) from 150.1.1.1 (150.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best

Hello where is the community NO-EXPORT.
Yeah you are rite its because we didn't send the community to R3 from R1. Lets send the community

R1(config)#router bgp 100
R1(config-router)#neighbor 150.3.3.3 send-community
R1(config-router)#neighbor 150.7.7.7 send-community

Now lets verify it.
R3#sh ip bgp 6.1.0.0
BGP routing table entry for 6.1.0.0/16, version 73
Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)
Flag: 0x880
  Not advertised to any peer
  600
    155.1.16.6 (metric 65) from 150.1.1.1 (150.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Community: no-export

Now lets have a look on R5.

R5#sh ip bgp 6.1.0.1
% Network not in table

Now lets have a look for another community LOCAL-AS.
Here am going to configure LOCAL-AS  on R5.

R4(config)#router bgp 400
R4(config-router)#neighbor 155.1.34.3 send-community

R4(config)#route-map localas
R4(config-route-map)#set community local-AS
R4(config)#router bgp 400
R4(config-router)#neighbor 155.1.34.3  route-map localas in

R5#sh ip bgp
BGP table version is 150, local router ID is 150.5.5.5
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
*> 150.1.1.0/24     155.1.57.7              50             0 100 i
*                               155.1.35.3      4294967295             0 100 i
*> 150.2.2.0/24     155.1.57.7              50             0 100 i
*                               155.1.35.3      4294967295             0 100 i
*> 150.3.3.0/24     155.1.57.7              50             0 100 i

See R4 not sending the update to R5 because its local to that particular AS 400.

Now am going to configure match the community and set the attributes according to that community.

R6(config)#route-map addcommunity
R6(config-route-map)#set community 600:6

R6(config)#router bgp 600
R6(config-router)#neighbor 155.1.16.1 route-map addcommunity out

See R1 whether getting the community or not
R1#sh ip bgp 6.1.0.1
BGP routing table entry for 6.1.0.0/16, version 113
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x880
  Advertised to update-groups:
     2          3
  600
    155.1.16.6 from 155.1.16.6 (150.6.6.6)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 39321606

See its sending the community in decimal format.

R1(config)#ip community-list standard 600:6 permit 600:6

R1(config)#route-map R6
R1(config-route-map)#match community 600:6 600:6
R1(config-route-map)#set as-path prepend 600 600

R1(config)#router bgp 100
R1(config-router)#neighbor 155.1.16.6 route-map R6 in

R1#sh ip bgp
BGP table version is 116, local router ID is 150.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
*> 6.1.0.0/16       155.1.16.6               0             0 600 600 600 i
*> 6.2.0.0/16       155.1.16.6               0             0 600 600 600 i
*> 6.3.0.0/16       155.1.16.6               0             0 600 600 600 i


Community Name
Working
No-Export
It will not send the prefixes out of the AS but it will send to the sub AS
That means it wont be propagated to true eBGP peers. 
Local AS
It will not send out of the AS not even to sub AS



No comments:

Post a Comment