Monday, 28 January 2019

BGP community Local-AS


 Local-AS is a well known BGP community and its use in confederations scenarios to prevent the transmit of traffic outside the local-as. If you are not sure about what is BGP communities are and how its work then I advises you to read my introduction to BGP community first before you continue this lab.

Let see the configuration for better understanding, we are continuing our previous topology.







Topology:-



Goal:

  • configure the topology as per the diagram and assign the IP addresses.
  • configure iBGP and EBGP neighborship. 
  • configure router 2 to advertise 12.0.0.0/24 prefix all the routers within the AS 650123.


R1#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        10.1.1.1        YES manual up                    up
Serial3/0                    1.1.1.1         YES manual up                    up
Serial3/3                    4.1.1.2         YES manual up                    up
Loopback0               11.0.0.1        YES manual up                    up



R2#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        20.1.1.1        YES manual up                    up
Serial3/0                     1.1.1.2         YES manual up                    up
Serial3/1                     2.1.1.1         YES manual up                    up
Loopback0               12.0.0.1        YES manual up                    up

R3#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        30.1.1.1        YES manual up                    up
Serial3/1                    2.1.1.2         YES manual up                    up
Serial3/2                    3.1.1.1         YES manual up                    up
Loopback0               13.0.0.1        YES manual up                    up




R4#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        40.1.1.1        YES manual up                    up
Serial3/2                    3.1.1.2         YES manual up                    up
Serial3/3                    4.1.1.1         YES manual up                    up
Loopback0               14.0.0.1        YES manual up                    up



R5#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        10.1.1.2        YES manual up                    up
Loopback0               15.0.0.1        YES manual up                    up



R6#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        30.1.1.2        YES manual up                    up
Loopback0              16.0.0.1        YES manual up                    up


R1(config)#router bgp 650123
R1(config-router)#neighbor 1.1.1.2 remote-as 650123
R1(config-router)#neighbor 10.1.1.2 remote-as 650005
R1(config-router)#neighbor 4.1.1.1 remote-as 650004
R1(config-router)#neighbor 2.1.1.2 remote-as 650123

R1(config-router)#neighbor 2.1.1.2 next-hop-self
R1(config-router)#neighbor 1.1.1.2 next-hop-self


R1(config-router)#network 10.0.0.0
R1(config-router)#network 1.0.0.0
R1(config-router)#network 4.0.0.0
R1(config-router)#network 11.0.0.0 mask 255.255.255.0
R1(config-router)#no auto-summary
R1(config-router)#no synchronization
R1(config-router)#exit

R2(config)#router bgp 650123
R2(config-router)#neighbor 1.1.1.1 remote-as 650123

*Jan 26 13:34:05.043: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up

R2(config-router)#neighbor 2.1.1.2 remote-as 650123
R2(config-router)#network 20.0.0.0
R2(config-router)#network 2.0.0.0
R2(config-router)#network 1.0.0.0
R2(config-router)#network 12.0.0.0 mask 255.255.255.0
R2(config-router)#no synchronization
R2(config-router)#no auto-summary
R2(config-router)#exit




R3(config)#router bgp 650123
R3(config-router)#neighbor 2.1.1.1 remote-as 650123

*Jan 26 13:36:03.887: %BGP-5-ADJCHANGE: neighbor 2.1.1.1 Up

R3(config-router)#neighbor 30.1.1.2 remote-as 650006
R3(config-router)#neighbor 1.1.1.1 remote-as 650123

*Jan 26 14:00:00.539: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up

R3(config-router)#neighbor 1.1.1.1 next-hop-self
R3(config-router)#neighbor 2.1.1.1 next-hop-self

R3(config-router)#network 2.0.0.0
R3(config-router)#network 3.0.0.0
R3(config-router)#network 30.0.0.0
R3(config-router)#network 13.0.0.0 mask 255.255.255.0
R3(config-router)#no synchronization
R3(config-router)#no auto-summary
R3(config-router)#exit


R4(config)#router bgp 650004
R4(config-router)#neighbor 3.1.1.1 remote 650123

*Jan 26 13:30:57.211: %BGP-5-ADJCHANGE: neighbor 3.1.1.1 Up

R4(config-router)#neighbor 4.1.1.2 remote 650123

*Jan 26 13:31:14.247: %BGP-5-ADJCHANGE: neighbor 4.1.1.2 Up

R4(config-router)#network 4.0.0.0
R4(config-router)#network 3.0.0.0
R4(config-router)#network 40.0.0.0
R4(config-router)#network 14.0.0.0 mask 255.255.255.0
R4(config-router)#no auto-summary
R4(config-router)#no synchronization
R4(config-router)#exit


R5(config)#router bgp 650005
R5(config-router)#neighbor 10.1.1.1 remote-as 650123
R5(config-router)#network 10.0.0.0


*Jan 26 13:31:08.975: %BGP-5-ADJCHANGE: neighbor 10.1.1.1 Up

R5(config-router)#network 15.0.0.0 mask 255.255.255.0
R5(config-router)#no auto-summary
R5(config-router)#no synchronization
R5(config-router)#exit

R6(config)#router bgp 650006
R6(config-router)#neighbor 30.1.1.1 remote-as 650123

*Jan 26 13:31:00.731: %BGP-5-ADJCHANGE: neighbor 30.1.1.1 Up

R6(config-router)#network 16.0.0.0 mask 255.255.255.0
R6(config-router)#network 30.0.0.0
R6(config-router)#no auto-summary
R6(config-router)#no synchronization
R6(config-router)#exit

R1#show ip bgp summary
BGP router identifier 11.0.0.1, local AS number 650123
BGP table version is 24, main routing table version 24
14 network entries using 2016 bytes of memory
21 path entries using 1680 bytes of memory
6/5 BGP path/bestpath attribute entries using 816 bytes of memory
3 BGP AS-PATH entries using 72 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 4584 total bytes of memory
BGP activity 14/0 prefixes, 30/9 paths, scan interval 60 secs



Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.2         4       650123      40      45       24    0    0 00:30:07        4
2.1.1.2         4       650123      10      11       24    0    0 00:01:10        7
4.1.1.1         4       650004      34      33       24    0    0 00:22:46        4
10.1.1.2        4       650005      27      35       24    0    0 00:20:32        2


R2#show ip bgp summary
BGP router identifier 12.0.0.1, local AS number 650123
BGP table version is 20, main routing table version 20
14 network entries using 2016 bytes of memory
19 path entries using 1520 bytes of memory
5/5 BGP path/bestpath attribute entries using 680 bytes of memory
3 BGP AS-PATH entries using 72 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 4288 total bytes of memory
BGP activity 14/0 prefixes, 23/4 paths, scan interval 60 secs


Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4       650123      46      41       20    0    0 00:31:05        7
2.1.1.2         4       650123      46      38       20    0    0 00:29:07        8

R3#show ip bgp summary
BGP router identifier 13.0.0.1, local AS number 650123
BGP table version is 38, main routing table version 38
14 network entries using 2016 bytes of memory
21 path entries using 1680 bytes of memory
6/5 BGP path/bestpath attribute entries using 816 bytes of memory
3 BGP AS-PATH entries using 72 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 4584 total bytes of memory
BGP activity 14/0 prefixes, 38/17 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4       650123      10      10       38    0    0 00:00:08        7
2.1.1.1         4       650123      40      48       38    0    0 00:30:12        4
3.1.1.2         4       650004      33      39       33    0    0 00:25:07        4
30.1.1.2        4       650006      27      37       33    0    0 00:20:53        2

R4#show ip bgp summary
BGP router identifier 14.0.0.1, local AS number 650004
BGP table version is 17, main routing table version 17
14 network entries using 2016 bytes of memory
24 path entries using 1920 bytes of memory
5/5 BGP path/bestpath attribute entries using 680 bytes of memory
3 BGP AS-PATH entries using 72 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 4688 total bytes of memory
BGP activity 14/0 prefixes, 36/12 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
3.1.1.1         4       650123      41      33       17    0    0 00:25:28        8
4.1.1.2         4       650123      40      37       17    0    0 00:25:11       12



R5#show ip bgp summary
BGP router identifier 15.0.0.1, local AS number 650005
BGP table version is 32, main routing table version 32
14 network entries using 2016 bytes of memory
15 path entries using 1200 bytes of memory
5/5 BGP path/bestpath attribute entries using 680 bytes of memory
3 BGP AS-PATH entries using 72 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 3968 total bytes of memory
BGP activity 20/6 prefixes, 21/6 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.1.1        4       650123      41      30       32    0    0 00:23:19       13



R1#show ip bgp 15.0.0.1
BGP routing table entry for 15.0.0.0/24, version 12
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     2          3
  Refresh Epoch 1
  650005
    10.1.1.2 from 10.1.1.2 (15.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0

R2#show ip bgp 15.0.0.1
BGP routing table entry for 15.0.0.0/24, version 19
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  650005
    1.1.1.1 from 1.1.1.1 (11.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      rx pathid: 0, tx pathid: 0x0

R3#show ip bgp 15.0.0.1
BGP routing table entry for 15.0.0.0/24, version 122
Paths: (1 available, no best path)
Flag: 0x820
  Not advertised to any peer
  Refresh Epoch 2
  650005
    1.1.1.1 (inaccessible) from 1.1.1.1 (11.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal
      rx pathid: 0, tx pathid: 0

(now we are going to  configure router 2 to advertise 12.0.0.0/24 prefix all the routers within the AS 650123, make sure it will not cross the AS)


R4#show ip bgp 12.0.0.1
BGP routing table entry for 12.0.0.0/24, version 10
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     1
  Refresh Epoch 1
  650123
    4.1.1.2 from 4.1.1.2 (12.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0



R6#show ip bgp 12.0.0.1
BGP routing table entry for 12.0.0.0/24, version 6
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 2
  650123
    30.1.1.1 from 30.1.1.1 (13.0.0.1)
      Origin IGP, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0


[AS_650004 and AS_650006  is getting 12.0.0.1/24 prefixe]




R2(config)#access-list 12 permit 12.0.0.0 0.0.0.255


R2(config)#route-map local-as permit 12
R2(config-route-map)#match ip address 12
R2(config-route-map)#set community local-AS
R2(config-route-map)#exit

R2(config)#route-map local-as permit 120
R2(config-route-map)#exit

R2(config)#router bgp 650123

R2(config-router)#no network 12.0.0.0 mask 255.255.255.0
R2(config-router)#network 12.0.0.0 mask 255.255.255.0 route-map local-as
R2(config-router)#neighbor 1.1.1.1 send-community
R2(config-router)#neighbor 2.1.1.2 send-community
R2(config-router)#end



R3#show ip bgp 12.0.0.1
BGP routing table entry for 12.0.0.0/24, version 52
Paths: (1 available, best #1, table default, not advertised outside local AS)
  Not advertised to any peer
  Refresh Epoch 3
  Local
    2.1.1.1 from 2.1.1.1 (12.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Community: local-AS
      rx pathid: 0, tx pathid: 0x0



R1#show ip bgp 12.0.0.1
BGP routing table entry for 12.0.0.0/24, version 125
Paths: (1 available, best #1, table default, not advertised outside local AS)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    1.1.1.2 from 1.1.1.2 (12.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best
      Community: local-AS
      rx pathid: 0, tx pathid: 0x0


(from the above output we can see all routers in AS 650123 is getting 12.0.0.0/24 prefixe, lets see AS 650006 and 650004)


R4#show ip bgp 12.0.0.1
% Network not in table

[from AS_650004]

R6#sh ip bgp 12.0.0.1
% Network not in table

[from  AS_650006]


R5#show ip bgp 12.0.0.1
% Network not in table

[from AS_650005]

No comments:

PIM Sparse Mode

PIM Sparse Mode  ( PIM-SM )  PIM  Sparse Mode explicitly builds unidirectional shared trees rooted at a ( RP ) rendezvous point per...