Lab 1: Basic BGP Lab Diagram AS3 .1 24.234.21.0/24 Se0/1/0 R1 24.234.0.1 .2 Se0/0/1 .2 .2 Se0/1/0 24.234.12.0/24 .2 24.234.0.2 Se0/0/0.203 24.234.23.0/24 .3 Se0/0/0.302 24.234.0.3 R3 Se0/0/1 R2 AS12 .2 Se0/0/0.203 24.234.24.0/24 Se0/0/0.203 .4 24.234.0.4 R4 AS4 Lab Addressing Router R1 R2 R3 R4 Interface Loopback0 Serial0/0/1 Serial0/1/0 Loopback0 Serial0/0/1 Serial0/1/0 Serial0/0/0.203 Serial0/0/0.204 Loopback0 Serial0/0/0.302 Loopback0 Serial0/0/0.402 L2 (DLCI, VLAN) Loopback HDLC HDLC Loopback HDLC HDLC DLCI 203 DLCI 204 Loopback DLCI 302 Loopback DLCI 402 IP Address 24.234.0.1/32 24.234.12.1/24 24.234.21.1/24 24.234.0.2/32 24.234.12.2/24 24.234.21.2/24 24.234.23.2/24 24.234.24.2/24 24.234.0.3/32 24.234.23.3/24 24.234.0.4/32 24.234.24.4/24 Lab Walkthrough Configure BGP between R2 and R3 using directly connected interface. This is a straightforward task. All we have to do is to start BGP router process and define neighbors. R2(config)#router bgp 12 R2(config-router)#neighbor 24.234.23.3 remote-as 3 R3(config)#router bgp 3 R3(config-router)#neighbor 24.234.23.2 remote-as 12 R2#show ip bgp summary BGP router identifier 24.234.0.2, local AS number 12 BGP table version is 1, main routing table version 1 Neighbor 24.234.23.3 V 4 AS MsgRcvd MsgSent 3 21 21 TblVer 1 InQ OutQ Up/Down State/PfxRcd 0 0 00:00:05 0 To verify configuration, issue “show ip bgp summary” command. Don’t be alarmed if you see no prefixes received, as we are not supposed to advertise any at this moment. R3#show ip bgp summary BGP router identifier 24.234.0.3, local AS number 3 BGP table version is 1, main routing table version 1 Neighbor 24.234.23.2 V 4 AS MsgRcvd MsgSent 12 21 21 TblVer 1 InQ OutQ Up/Down State/PfxRcd 0 0 00:00:52 0 Configure BGP between R1 and R3 and ensure that session is up independent of either of the interconnecting links being up. You are not allowed to configure any static routes. Generally speaking, it is not possible to establish multiple BGP sessions between two routers. What this task is hinting at is to use loopback interfaces for session. However, we don’t have routes to loopbacks and we can’t use static routes. Some form of IGP is required. You can use any, as none is specifically required. We will use OSPF. Again, very simple configuration – the goal is only to get Loopback0 into the routing table of the neighbor. R1(config)#router ospf 1 R1(config-router)#network 24.234.0.1 0.0.0.0 area 0 R1(config-router)#network 24.234.12.0 0.0.0.255 area 0 R2(config)#router ospf 1 R2(config-router)#network 24.234.0.2 0.0.0.0 area 0 R2(config-router)#network 24.234.12.0 0.0.0.255 area 0 Make sure OSPF works properly before you continue. R1#show ip route ospf 24.0.0.0/8 is variably subnetted, 4 subnets, 2 masks O 24.234.0.2/32 [110/65] via 24.234.12.2, 00:11:15, Serial0/0/1 R2#show ip route ospf 24.0.0.0/8 is variably subnetted, 7 subnets, 2 masks O 24.234.0.1/32 [110/65] via 24.234.12.1, 00:10:53, Serial0/0/1 In order to use Loopback0 interface as an endpoint of BGP TCP session, use “neighbor source-interface” command, as shown below. R1(config)#router bgp 12 R1(config-router)#neighbor 24.234.0.2 remote-as 12 R1(config-router)#neighbor 24.234.0.2 update-source loopback0 R2(config)#router bgp 12 R2(config-router)#neighbor 24.234.0.1 remote-as 12 R2(config-router)#neighbor 24.234.0.1 update-source loopbac0 Similarly to the previous task, verify that the session is up. There is no need to verify on both ends. If it’s up on R1, it will be up on R2, too. R1#show ip bgp summary BGP router identifier 24.234.0.1, local AS number 12 BGP table version is 1, main routing table version 1 Neighbor 24.234.0.2 V 4 AS MsgRcvd MsgSent 12 18 18 TblVer 1 InQ OutQ Up/Down State/PfxRcd 0 0 00:01:45 0 Configure BGP between R2 and R4 and ensure that new links can be added in the future. You are allowed one host static route on R2 and R4 each. This task in some aspects similar to the previous one – it requires session between Loopback0 interfaces. However, here we are configuring external BGP (eBGP) and some additional steps are required. First of all, in real life it is very uncommon to run any IGP routing protocol between autonomous systems. In order to get Loopback0 of the neighbor into the routing table, we will use static host routes on both routers. R2(config)#ip route 24.234.0.4 255.255.255.255 24.234.24.4 name R4_Loopback0 R4(config)#ip route 24.234.0.2 255.255.255.255 24.234.24.2 name R2_Loopback0 We need to have in mind are eBGP session establishment rules. Due to very basic security reasons, session will not be established between neighbors that are not directly connected. Loopback0 interfaces are not directly connected, even though routers are! In order to establish the session, we need to “loosen” the security check and allow session to be established. Use “neighbor ebgp-multihop” command to accomplish that. R2(config)#router bgp 12 R2(config-router)#neighbor 24.234.0.4 remote-as 4 R2(config-router)#neighbor 24.234.0.4 update-source loopback0 R2(config-router)#neighbor 24.234.0.4 ebgp-multihop 2 R4(config)#router bgp 4 R4(config-router)#neighbor 24.234.0.2 remote-as 12 R4(config-router)#neighbor 24.234.0.2 update-source loopback0 R4(config-router)#neighbor 24.234.0.2 ebgp-multihop 2 Hint: It is a good habit to verify after configuration. It takes only few seconds and can save you valuable time down the road in the lab. R4#show ip bgp summary BGP router identifier 24.234.0.4, local AS number 4 BGP table version is 1, main routing table version 1 Neighbor 24.234.0.2 V 4 AS MsgRcvd MsgSent 12 24 24 TblVer 1 InQ OutQ Up/Down State/PfxRcd 0 0 00:03:12 0 Protect all eBGP sessions with password "cisco". Use the most secure method. Hint: Don’t fall for “mind tricks”. At this moment, BGP supports only one password protection method – there is no less and more secure one! R2(config)#router bgp 12 R2(config-router)#neighbor 24.234.0.4 password cisco R2(config-router)#neighbor 24.234.23.3 password cisco R2(config-router)#end R2#clear ip bgp * R3(config)#router bgp 3 R3(config-router)#neighbor 24.234.23.2 password cisco R4(config)#router bgp 4 R4(config-router)#neighbor 24.234.0.2 password cisco R2#show ip bgp summary BGP router identifier 24.234.0.2, local AS number 12 BGP table version is 1, main routing table version 1 Neighbor 24.234.0.1 24.234.0.4 24.234.23.3 V 4 4 4 AS MsgRcvd MsgSent 12 20 20 4 24 24 3 24 24 TblVer 1 1 1 InQ OutQ Up/Down State/PfxRcd 0 0 00:03:28 0 0 0 00:03:26 0 0 0 00:03:27 0 On each router, advertise Loopback0 interface into the BGP. Ensure full reachability between Loopback0 interfaces. Links connecting to any external AS are not allowed into any IGP. There are many ways in which a network can “end up” in BGP. Two most common ones are using “network” statement and redistribution. General rule of thumb is to use “network” statement if the task is talking about “advertising” and use redistribution only if asked to do so. However, if in doubt on the exam day – ask the Proctor for clarification. Proctor’s tip: Do not redistribute. R1(config)#router bgp 12 R1(config-router)#network 24.234.0.1 mask 255.255.255.255 R2(config)#router bgp 12 R2(config-router)#network 24.234.0.2 mask 255.255.255.255 R3(config)#router bgp 3 R3(config-router)#network 24.234.0.3 mask 255.255.255.255 R4(config)#router bgp 4 R4(config-router)#network 24.234.0.4 mask 255.255.255.255 Check BGP tables on all routers to ensure that all have proper routing information. R1#show ip bgp BGP table version is 10, local router ID is 24.234.0.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 *> 24.234.0.1/32 0.0.0.0 0 32768 i r>i24.234.0.2/32 24.234.0.2 0 100 0 i * i24.234.0.3/32 24.234.23.3 0 100 0 3 i * i24.234.0.4/32 24.234.0.4 0 100 0 4 i R1#show ip route Codes: 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 Gateway of last resort is not set C O C C 24.0.0.0/8 is variably subnetted, 4 subnets, 2 masks 24.234.21.0/24 is directly connected, Serial0/1/0 24.234.0.2/32 [110/65] via 24.234.12.2, 00:05:41, Serial0/0/1 24.234.0.1/32 is directly connected, Loopback0 24.234.12.0/24 is directly connected, Serial0/0/1 Notice the problem above! R1 is not installing R3 and R4 networks into the routing table, even though it’s receiving them in BGP from R2. The reason for that can be found in “nexthop” attribute. By default, routers will not change “next-hop” when advertising networks to iBGP neighbors. In this case, “next-hop” addresses are not known to R1 and it will not install those prefixes into the routing table. We will fix this later on, but let’s first ensure that there are no further surprises! R2#show ip bgp BGP table version is 10, local router ID is 24.234.0.2 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 r>i24.234.0.1/32 24.234.0.1 0 100 0 i *> 24.234.0.2/32 0.0.0.0 0 32768 i *> 24.234.0.3/32 24.234.23.3 0 0 3 i r> 24.234.0.4/32 24.234.0.4 0 0 4 i R2#show ip route Codes: 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 Gateway of last resort is not set C C C C B O S C 24.0.0.0/8 is variably subnetted, 8 subnets, 2 masks 24.234.23.0/24 is directly connected, Serial0/0/0.203 24.234.21.0/24 is directly connected, Serial0/1/0 24.234.24.0/24 is directly connected, Serial0/0/0.204 24.234.0.2/32 is directly connected, Loopback0 24.234.0.3/32 [20/0] via 24.234.23.3, 00:05:07 24.234.0.1/32 [110/65] via 24.234.12.1, 00:05:14, Serial0/0/1 24.234.0.4/32 [1/0] via 24.234.24.4 24.234.12.0/24 is directly connected, Serial0/0/1 R3#show ip bgp BGP table version is 7, local router ID is 24.234.0.3 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 *> 24.234.0.1/32 24.234.23.2 0 12 i *> 24.234.0.2/32 24.234.23.2 0 0 12 i *> 24.234.0.3/32 0.0.0.0 0 32768 i *> 24.234.0.4/32 24.234.23.2 0 12 4 i R3#show ip route Codes: 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 Gateway of last resort is not set C B C B B 24.0.0.0/8 is variably subnetted, 5 subnets, 2 masks 24.234.23.0/24 is directly connected, Serial0/0/0.302 24.234.0.2/32 [20/0] via 24.234.23.2, 00:05:17 24.234.0.3/32 is directly connected, Loopback0 24.234.0.1/32 [20/0] via 24.234.23.2, 00:05:47 24.234.0.4/32 [20/0] via 24.234.23.2, 00:00:18 R4#show ip bgp BGP table version is 11, local router ID is 24.234.0.4 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 *> 24.234.0.1/32 24.234.0.2 0 12 i r> 24.234.0.2/32 24.234.0.2 0 0 12 i *> 24.234.0.3/32 24.234.0.2 0 12 3 i *> 24.234.0.4/32 0.0.0.0 0 32768 i R4#show ip route Codes: 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 Gateway of last resort is not set C S B B C 24.0.0.0/8 is variably subnetted, 5 subnets, 2 masks 24.234.24.0/24 is directly connected, Serial0/0/0.402 24.234.0.2/32 [1/0] via 24.234.24.2 24.234.0.3/32 [20/0] via 24.234.0.2, 00:00:18 24.234.0.1/32 [20/0] via 24.234.0.2, 00:00:18 24.234.0.4/32 is directly connected, Loopback0 In order to fix the problem between R1 and R2, we will configure R2 to make itself “nexthop” for prefixes that it’s advertising to R1. Note that this applies only to eBGP-learned prefixes. R2(config)#router bgp 12 R2(config-router)#neighbor 24.234.0.1 next-hop-self R2(config-router)#end R2#clear ip bgp 24.234.0.1 R1#show ip route Codes: 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 Gateway of last resort is not set C O B C 24.0.0.0/8 is variably subnetted, 6 subnets, 2 masks 24.234.21.0/24 is directly connected, Serial0/1/0 24.234.0.2/32 [110/65] via 24.234.12.2, 00:07:32, Serial0/0/1 24.234.0.3/32 [200/0] via 24.234.0.2, 00:00:18 24.234.0.1/32 is directly connected, Loopback0 B C 24.234.0.4/32 [200/0] via 24.234.0.2, 00:00:18 24.234.12.0/24 is directly connected, Serial0/0/1 At the end, let’s verify connectivity. R1#ping 24.234.0.2 source loopback0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 24.234.0.2, timeout is 2 seconds: Packet sent with a source address of 24.234.0.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms R1#ping 24.234.0.3 source loopback0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 24.234.0.3, timeout is 2 seconds: Packet sent with a source address of 24.234.0.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 56/59/60 ms R1#ping 24.234.0.4 source loopback0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 24.234.0.4, timeout is 2 seconds: Packet sent with a source address of 24.234.0.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 56/60/68 ms R3#ping 24.234.0.4 source loopback0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 24.234.0.4, timeout is 2 seconds: Packet sent with a source address of 24.234.0.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 112/113/116 ms R2 will be connected to other internal neighbors in AS12. Configure R2 such that minimal configuration will be required when these neighbors are added. When there are multiple neighbors that share common parameters, their configuration can be greatly simplified using “peer-groups” or in more recent IOS versions, templates. As there are no limitations as to what method to use, we will use peer-groups. Hint: You will need to remove currently configured neighbor if you want to add it to “peergroup”. If you have read the entire lab before configuration, you may have spotted the requirement and adjusted your initial configuration accordingly. Well done if you have done it! R2#show running-config | include 24.234.0.1 neighbor 24.234.0.1 remote-as 12 neighbor 24.234.0.1 update-source Loopback0 neighbor 24.234.0.1 next-hop-self R2(config)#router bgp 12 R2(config-router)#neighbor AS12 peer-group R2(config-router)#neighbor AS12 remote-as 12 R2(config-router)#neighbor AS12 update-source loopback0 R2(config-router)#neighbor AS12 next-hop-self R2(config-router)#no neighbor 24.234.0.1 R2(config-router)#neighbor 24.234.0.1 peer-group AS12 Make sure that everything still works as expected. R1#show ip route bgp 24.0.0.0/8 is variably subnetted, 6 subnets, 2 masks B 24.234.0.3/32 [200/0] via 24.234.0.2, 00:00:12 B 24.234.0.4/32 [200/0] via 24.234.0.2, 00:00:12 R1#ping 24.234.0.3 source loopback0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 24.234.0.3, timeout is 2 seconds: Packet sent with a source address of 24.234.0.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 56/59/60 ms R1#ping 24.234.0.4 source loopback0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 24.234.0.4, timeout is 2 seconds: Packet sent with a source address of 24.234.0.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 56/58/60 ms