Wednesday, March 28, 2012

BGP Confederation

BGP confederation divide an AS into sub AS running eBGP on every router, or we can say that it is a group of router running eBGP, but known as a single AS from outside. BGP confederation can reduce the iBGP mesh inside an AS, besides BGP route reflector. BGP confederation is more complex than route reflector, since we have to configure for every router inside a confederation. 

Here is our topology. We use 4 router running BGP, consist of 3 router within a confederation and 1 router from outside. Router R4 will recognize ASN R3 as 100, not 65003. To activate BGP confederation on cisco router, use the following command:


1:  bgp confederation identifier <asn>   
2:  bgp confederation peers <sub-asn 1> <sub-asn 2> <sub-asn ...>  

bgp confederation identifier refer to confederation's ASN, in this topology, our confederation's ASN is 100. And bgp confederation peers refer to sub ASN for all peers router.


Here is the configuration for every router:
R1:
1:  interface Loopback0  
2:   ip address 1.1.1.1 255.255.255.255  
3:   ipv6 address 2001:100:100:2::1/64  
4:  !  
5:  interface FastEthernet0/0  
6:   ip address 172.16.1.2 255.255.255.252  
7:   duplex auto  
8:   speed auto  
9:  !  
10:  router bgp 65001  
11:   no synchronization  
12:   bgp log-neighbor-changes  
13:   bgp confederation identifier 100  
14:   bgp confederation peers 65002 65003  
15:   network 1.1.1.1 mask 255.255.255.255  
16:   neighbor 172.16.1.1 remote-as 65002  
17:   neighbor 172.16.1.1 description Connected to R2  
18:   neighbor 172.16.1.1 next-hop-self  
19:   no auto-summary  
20:  !  

R2:
1:  !  
2:  interface Loopback0  
3:   ip address 2.2.2.2 255.255.255.255  
4:   ipv6 address 2001:100:100:1::1/64  
5:  !  
6:  interface FastEthernet0/0  
7:   ip address 172.16.1.1 255.255.255.252  
8:   duplex auto  
9:   speed auto  
10:  !  
11:  interface FastEthernet0/1  
12:   ip address 172.16.2.1 255.255.255.252  
13:   duplex auto  
14:   speed auto  
15:  !  
16:  router bgp 65002  
17:   no synchronization  
18:   bgp log-neighbor-changes  
19:   bgp confederation identifier 100  
20:   bgp confederation peers 65001 65003  
21:   network 2.2.2.2 mask 255.255.255.255  
22:   neighbor 172.16.1.2 remote-as 65001  
23:   neighbor 172.16.1.2 description Connected to R1  
24:   neighbor 172.16.1.2 next-hop-self  
25:   neighbor 172.16.2.2 remote-as 65003  
26:   neighbor 172.16.2.2 description Connected to R3  
27:   neighbor 172.16.2.2 next-hop-self  
28:   no auto-summary  
29:  !  

R3:

1:  interface Loopback0  
2:   ip address 3.3.3.3 255.255.255.255  
3:  !  
4:  interface FastEthernet0/0  
5:   ip address 172.16.2.2 255.255.255.252  
6:   duplex auto  
7:   speed auto  
8:  !  
9:  interface FastEthernet0/1  
10:   ip address 172.16.3.2 255.255.255.252  
11:   duplex auto  
12:   speed auto  
13:  !  
14:  router bgp 65003  
15:   no synchronization  
16:   bgp log-neighbor-changes  
17:   bgp confederation identifier 100  
18:   bgp confederation peers 65001 65002  
19:   network 3.3.3.3 mask 255.255.255.255  
20:   neighbor 172.16.2.1 remote-as 65002  
21:   neighbor 172.16.2.1 description Connected to R2  
22:   neighbor 172.16.2.1 next-hop-self  
23:   neighbor 172.16.3.1 remote-as 200  
24:   neighbor 172.16.3.1 description Connected to R4  
25:   no auto-summary  
26:  !  

R4: Note that, you have to use ASN 100 for peering to R3, because R4 is not part of confederation.
1:  interface Loopback0  
2:   ip address 4.4.4.4 255.255.255.255  
3:  !  
4:  interface FastEthernet0/0  
5:   ip address 172.16.3.1 255.255.255.252  
6:   duplex auto  
7:   speed auto  
8:  !  
9:  router bgp 200  
10:   bgp log-neighbor-changes  
11:   neighbor 172.16.3.2 remote-as 100  
12:   neighbor 172.16.3.2 description Connected to R3  
13:   network 4.4.4.4 mask 255.255.255.255  
14:   exit-address-family  
15:  !  

Apply all configuration above and check bgp status for every router. You can use "show ip bgp summary".

1:  R1#sh ip bgp su  
2:  BGP router identifier 172.16.1.2, local AS number 65001  
3:  BGP table version is 23, main routing table version 23  
4:  4 network entries using 468 bytes of memory  
5:  4 path entries using 208 bytes of memory  
6:  5/4 BGP path/bestpath attribute entries using 620 bytes of memory  
7:  3 BGP AS-PATH entries using 72 bytes of memory  
8:  0 BGP route-map cache entries using 0 bytes of memory  
9:  0 BGP filter-list cache entries using 0 bytes of memory  
10:  BGP using 1368 total bytes of memory  
11:  BGP activity 11/7 prefixes, 13/9 paths, scan interval 60 secs  
12:  Neighbor    V  AS MsgRcvd MsgSent  TblVer InQ OutQ Up/Down State/PfxRcd  
13:  172.16.1.1   4 65002   75   53    23  0  0 00:41:27    3  

Use "show ip bgp" to list all of routes received from peer router.


14:  R1#sh ip bgp  
15:  BGP table version is 23, local router ID is 172.16.1.2  
16:  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
17:         r RIB-failure, S Stale  
18:  Origin codes: i - IGP, e - EGP, ? - incomplete  
19:    Network     Next Hop      Metric LocPrf Weight Path  
20:  *> 1.1.1.1/32    0.0.0.0         0     32768 i  
21:  *> 2.2.2.2/32    172.16.1.1        0  100   0 (65002) i  
22:  *> 3.3.3.3/32    172.16.1.1        0  100   0 (65002 65003) i  
23:  *> 4.4.4.4/32    172.16.1.1        0  100   0 (65002 65003) 200 i  

24:  R1#sh ip bgp 2.2.2.2  
25:  BGP routing table entry for 2.2.2.2/32, version 9  
26:  Paths: (1 available, best #1, table Default-IP-Routing-Table)  
27:   Not advertised to any peer  
28:   (65002)  
29:    172.16.1.1 from 172.16.1.1 (2.2.2.2)  
30:     Origin IGP, metric 0, localpref 100, valid, confed-external, best  

32:  R1#ping 4.4.4.4 source 1.1.1.1  
33:  Type escape sequence to abort.  
34:  Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:  
35:  Packet sent with a source address of 1.1.1.1  
36:  !!!!!  
37:  Success rate is 100 percent (5/5), round-trip min/avg/max = 8/20/28 ms  

1:  R1#traceroute 4.4.4.4 source 1.1.1.1  
2:  Type escape sequence to abort.  
3:  Tracing the route to 4.4.4.4  
4:   1 172.16.1.1 12 msec 20 msec 36 msec  
5:   2 172.16.2.2 8 msec 8 msec 20 msec  
6:   3 172.16.3.1 16 msec 20 msec *  

On router R4, we can see that R4 received routes from R1 and R2 via R3.
1:  R4#sh ip bgp su  
2:  BGP router identifier 4.4.4.4, local AS number 200  
3:  BGP table version is 11, main routing table version 11  
4:  4 network entries using 468 bytes of memory  
5:  4 path entries using 208 bytes of memory  
6:  4/3 BGP path/bestpath attribute entries using 496 bytes of memory  
7:  1 BGP AS-PATH entries using 24 bytes of memory  
8:  0 BGP route-map cache entries using 0 bytes of memory  
9:  0 BGP filter-list cache entries using 0 bytes of memory  
10:  BGP using 1196 total bytes of memory  
11:  BGP activity 28/24 prefixes, 33/29 paths, scan interval 60 secs  
12:  Neighbor    V  AS MsgRcvd MsgSent  TblVer InQ OutQ Up/Down State/PfxRcd  
13:  172.16.3.2   4  100   33   25    11  0  0 00:00:47    3  

A routes from router R1, R2 and R3 will be known as an ASN 100

14:  R4#sh ip bgp  
15:  BGP table version is 11, local router ID is 4.4.4.4  
16:  Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,  
17:         r RIB-failure, S Stale  
18:  Origin codes: i - IGP, e - EGP, ? - incomplete  
19:    Network     Next Hop      Metric LocPrf Weight Path  
20:  *> 1.1.1.1/32    172.16.3.2               0 100 i  
21:  *> 2.2.2.2/32    172.16.3.2               0 100 i  
22:  *> 3.3.3.3/32    172.16.3.2        0       0 100 i  
23:  *> 4.4.4.4/32    0.0.0.0         0     32768 i  

25:  R4#ping 1.1.1.1 source 4.4.4.4  
26:  Type escape sequence to abort.  
27:  Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:  
28:  Packet sent with a source address of 4.4.4.4  
29:  !!!!!  
30:  Success rate is 100 percent (5/5), round-trip min/avg/max = 16/24/32 ms  

No comments: