Configuring BGP
To start BGP on a Cisco router, the following command is required:router bgp autonomous system numberTo define networks to be advertised, apply the following command:
network network-number mask network-maskYou must be aware that the network command is not used in the same way you use it when you apply networks in OSPF or EIGRP. With BGP, you use the network command to advertise networks that originate from the router and need to be advertised through BGP.
To identify peer routers, apply the following command:
neighbor ip-address | peer-group name remote-as autonomous system numberNext, you see how to configure IBGP and EBGP among the three routers in Figure 6-1. Example 6-1 displays the IBGP configuration on R1 to R2.
Example 6-1. IBGP on R1
R1(config)#router bgp ? <1-65535> Autonomous system number R1(config)#router bgp 1 R1(config-router)#neighbor 131.108.1.2 remote 1Example 6-2 displays the IBGP configuration to R1 and EBGP configuration to R3.
Example 6-2. IBGP/EBGP on R2
R2(config)#router bgp 1 R2(config-router)#neighbor 131.108.1.1 remote-as 1 R2(config-router)#neighbor 131.108.255.2 remote-as 2Finally, Example 6-3 displays the EBGP connection from R3 to R2.
Example 6-3. EBGP on R3
R3(config)#router bgp ? <1-65535> Autonomous system number R3(config)#router bgp 2 R3(config-router)#neighbor 131.108.255.1 remote-as 1At this stage, because no network statements have been applied, no BGP entries are on any routers. Use some loopback interfaces on R1 and advertise them through BGP to R2 and R3.
Example 6-4 displays the three new loopback addresses on R1, ranging from 131.108.2.0 to 131.108.4.0.
Example 6-4. Loopback Configuration on R1
R1(config)#interface loopback 0 R1(config-if)#ip address 131.108.2.1 255.255.255.0 R1(config-if)#interface loopback 1 R1(config-if)#ip address 131.108.3.1 255.255.255.0 R1(config-if)#interface loopback 2 R1(config-if)#ip address 131.108.4.1 255.255.255.0You must next advertise these loopbacks with the network command. Because these networks are local to R1 and present in R1's IP routing table as connected routes, you can apply the network command as displayed in Example 6-5.
Example 6-5. network Command on R1
R1(config)#router bgp 1 R1(config-router)#network 131.108.2.0 mask 255.255.255.0 R1(config-router)#network 131.108.3.0 mask 255.255.255.0 R1(config-router)#network 131.108.4.0 mask 255.255.255.0Example 6-6 displays the BGP table on R1, using the command show ip bgp.
Example 6-6. show ip bgp on R1
R1#show ip bgp BGP table version is 4, local router ID is 131.108.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 131.108.2.0/24 0.0.0.0 0 32768 i *> 131.108.3.0/24 0.0.0.0 0 32768 i *> 131.108.4.0/24 0.0.0.0 0 32768 iThe BGP table on R1 displays three local networks (next hop is 0.0.0.0 or local interfaces). Example 6-6 also displays the path as i, or advertised through BGP. The local router ID is 131.108.1.1.
Example 6-7 displays the BGP table on R2.
Example 6-7. show ip bgp on R2
R2#show ip bgp BGP table version is 7, local router ID is 171.109.3.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * i131.108.2.0/24 131.108.1.1 0 100 0 i * i131.108.3.0/24 131.108.1.1 0 100 0 i * i131.108.4.0/24 131.108.1.1 0 100 0 iR2's local router is 131.108.1.2, and it learns the remote loopbacks on R1 through the next hop address 131.108.1.1, or R1's Ethernet interface. Notice that R2 has set the local preference to 100 (default value); the origin attribute is set to i or IGP.
Because R1 and R2 are running only IBGP and no other interior gateway protocol, R2's IP routing table does not have the BGP entries inserted because of synchronization. Example 6-8 confirms this with only the locally connected routes visible on R2.
Example 6-8. show ip route on R2
R2#show ip route 131.108.0.0/24 is subnetted, 2 subnets C 131.108.255.0 is directly connected, Serial1/0 C 131.108.1.0 is directly connected, Ethernet0/0To enable BGP to insert the routes, you must disable synchronization or configure an IGP routing protocol. R2, in turn, does not propagate the loopbacks to R3; therefore, R3 does not have any entries at all, either in the BGP table or IP routing table.
Disable synchronization on R1 and R2. Example 6-9 displays the no synchronization command on R1 and R2.
Example 6-9. Disabling Synchronization on R1/R2
R1(config)#router bgp 1 R1(config-router)#no synchronization R2(config)#router bgp 1 R2(config-router)#no synchronizationExample 6-10 displays R2's routing table.
Example 6-10. R2's Routing Table
R2#sh ip route 131.108.0.0/24 is subnetted, 5 subnets C 131.108.255.0 is directly connected, Serial1/0 B 131.108.4.0 [200/0] via 131.108.1.1, 00:00:43 B 131.108.3.0 [200/0] via 131.108.1.1, 00:00:43 B 131.108.2.0 [200/0] via 131.108.1.1, 00:00:43 C 131.108.1.0 is directly connected, Ethernet0/0The three remote networks are inserted into the IP routing tables as BGP-learned networks.
Example 6-11 displays R3's BGP and IP routing table.
Example 6-11. R3's BGP and IP Tables
R3>show ip bgp BGP table version is 10, local router ID is 131.108.255.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 131.108.2.0/24 131.108.255.1 0 1 i *> 131.108.3.0/24 131.108.255.1 0 1 i *> 131.108.4.0/24 131.108.255.1 0 1 i R3>show ip route 131.108.0.0/24 is subnetted, 5 subnets C 131.108.255.0 is directly connected, Serial0 B 131.108.4.0 [20/0] via 131.108.255.1, 00:02:09 B 131.108.3.0 [20/0] via 131.108.255.1, 00:02:09 B 131.108.2.0 [20/0] via 131.108.255.1, 00:02:09 C 131.108.1.0 is directly connected, Ethernet0Notice that the next hop address on R3 is R2. The AS path on R3 indicates that the remote networks, 131.108.2.0 to 131.108.4.0/24, transverse autonomous system number 1, as displayed in the BGP table in Example 6-11.
The following five scenarios examine how BGP is configured and monitored and how BGP can use policy-based routing to change the routing decision of any IP network using powerful tools, such as route maps and the changing the BGP attributes.
No comments:
Post a Comment