Lab Objective:
The focus of this lab is to understand BGP implementation and configuration in Cisco IOS routers. Additional technologies include route filtering and path control.
Lab Topology:
The lab network topology is illustrated below:
|
IMPORTANT NOTE If you are using the www.howtonetwork.net racks, please bring up the LAN interfaces connected to the routers by issuing the no shutdown command on the connected switches. If you are using a home lab with no interface fastethernet 0/0 Alternately, you can simply connect the interfaces to a hub or switch if you have one available in your own lab. |
Task 1
Configure hostnames and IP addressing on all routers as illustrated in the network topology.
Task 2
Configure BGP as illustrated in the topology. R1 will peer with R2 and R3. R2 will peer with R1 and R3. R3 will peer with R1, R2 and R4. R4 will peer only with R3. The routers should all use their physical interface addresses for BGP peering. Verify your configuration.
Task 3
Advertise the 150.x.x.x LAN subnets on all routers via BGP. These should be injected using the network command on all routers. Verify that all routers’ LAN subnets can ping every other routers LAN subnet. Use an extended ping to perform this verification.
Task 4
Configure BGP so that R1 prefers the path via R2 to reach the 150.4.4.0/24 subnet. You are NOT allowed to make any changes on R1 or R2 when completing this task. Ensure that when R2 is down, R1 can still reach the 150.4.4.0/24 subnet. Verify your configuration using the appropriate commands and simulating a R2 failure.
Task 5
Configure the following Loopback interfaces on R1:
Loopback 192: IP Address 192.1.1.1/32
Loopback 193: IP Address 193.1.1.1/32
Advertise the 192.1.1.1/32 subnet only to R2. Ensure that this is NOT re-advertised to R3. Next, advertise the 193.1.1.1/32 subnet only to R3. Ensure that this is NOT re-advertised to R2 or R4.
Task 6
Configure BGP in such a way that R4 can reach the 192.1.1.1/32 and 193.1.1.1/32 from its local LAN subnet. You are allowed to configure on R1 to complete this task; however, do NOT modify the existing configuration. You are NOT allowed to configure any static routes when completing this task. Ensure that R4 can always reach these prefixes even if the R1-R3 or R2-R3 link is down. Verify your configuration by pinging from the 150.4.4.0/24 subnet to the 193.1.1.1/32 host address on R1.
Lab Validation
Task 1
Please refer to previous labs for basic IP addressing and hostname configuration. This will not be included in this section to avoid being redundant.
Task 2
| R1(config)#router bgp 1 R1(config-router)#bgp router-id 1.1.1.1 R1(config-router)#neighbor 10.0.0.2 remote-as 2 R1(config-router)#neighbor 10.0.0.6 remote-as 3 R1(config-router)#exit |
| R2(config)#router bgp 2 R2(config-router)#bgp router-id 2.2.2.2 R2(config-router)#neighbor 10.0.0.1 remote-as 1 R2(config-router)#neighbor 10.0.0.10 remote-as 3 R2(config-router)#exit |
| R3(config)#router bgp 3 R3(config-router)#bgp router-id 3.3.3.3 R3(config-router)#neighbor 10.0.0.5 remote-as 1 R3(config-router)#neighbor 10.0.0.9 remote-as 2 R3(config-router)#neighbor 10.0.0.14 remote-as 3 R3(config-router)#exit |
| R4(config)#router bgp 3 R4(config-router)#bgp router-id 4.4.4.4 R4(config-router)#neighbor 10.0.0.13 remote-as 3 R4(config-router)#exit |
Verify your configuration using the show ip bgp summary command:
| R1#show ip bgp summary BGP router identifier 1.1.1.1, local AS number 1 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd |
| R2#show ip bgp summary BGP router identifier 2.2.2.2, local AS number 2 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd |
| R3#show ip bgp summary BGP router identifier 3.3.3.3, local AS number 3 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd |
| R4#show ip bgp summary BGP router identifier 4.4.4.4, local AS number 3 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd |
Task 3
| R1(config)#router bgp 1 R1(config-router)#network 150.1.1.0 mask 255.255.255.0 R1(config-router)#exit |
| R2(config)#router bgp 2 R2(config-router)#network 150.2.2.0 mask 255.255.255.0 R2(config-router)#exit |
Because R3 will be receiving prefixes from external peers (R1 and R2) and advertising those same prefixes to an internal peer (R4), you need to change the NEXT_HOP for the prefixes, otherwise R4 will not be able to reach them. The configuration to be implemented is as follows:
| R3(config)#router bgp 3 R3(config-router)#network 150.3.3.0 mask 255.255.255.0 R3(config-router)#neighbor 10.0.0.14 next-hop-self R3(config-router)#exit |
| R4(config)#router bgp 3 R4(config-router)#network 150.4.4.0 mask 255.255.255.0 R4(config-router)#exit |
Verify your configuration using the show ip bgp command:
| R1#show ip bgp BGP table version is 5, local router ID is 1.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 |
| R2#show ip bgp BGP table version is 5, local router ID is 2.2.2.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 |
| R3#show ip bgp BGP table version is 5, local router ID is 3.3.3.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 |
| R4#show ip bgp BGP table version is 5, local router ID is 4.4.4.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 |
Finally, verify that you have LAN-to-LAN connectivity on all routers using extended pings:
| 1#ping 150.2.2.2 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R1#ping 150.3.3.3 source fastethernet 0/0 repeat 10 Type escape sequence to abort. R1#ping 150.4.4.4 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
| R2#ping 150.1.1.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R2#ping 150.3.3.3 source fastethernet 0/0 repeat 10 Type escape sequence to abort. R2#ping 150.4.4.4 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
| R3#ping 150.1.1.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R3#ping 150.2.2.2 source fastethernet 0/0 repeat 10 Type escape sequence to abort. R3#ping 150.4.4.4 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
| R4#ping 150.1.1.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R4#ping 150.2.2.2 source fastethernet 0/0 repeat 10 Type escape sequence to abort. R4#ping 150.3.3.3 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
Task 4
Because the MED attribute is not compared when routes are received from multiple ASes, unless the bgp always-compare-med command is used, use AS_PATH prepending to complete this task. Prior to any changes, the BGP RIB on R1 shows the following entries:
| R1#show ip bgp BGP table version is 5, local router ID is 1.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 |
NOTE: The greater than sign (>) indicates the current best path in the BGP RIB.
The current best path for 150.4.4.0/24 is via R3 because of the shorter AS_PATH. To complete this task, prepend the AS_PATH for this prefix on R3 for the neighbor relationship to R1:
| R3(config)#ip prefix-list R4-LAN seq 5 permit 150.4.4.0/24 R3(config)#route-map PATH-CONTROL permit 10 R3(config-route-map)#match ip address prefix list R4-LAN R3(config-route-map)#set as-path prepend 3 3 R3(config-route-map)#exit R3(config)#route-map PATH-CONTROL permit 20 R3(config-route-map)#exit R3(config)#router bgp 3 R3(config-router)#neighbor 10.0.0.5 route-map PATH-CONTROL out R3(config-router)#exit |
Following this configuration, the BGP Table on R1 shows the following for 150.4.4.0/24:
| R1#show ip bgp BGP table version is 7, local router ID is 1.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 |
Next, verify that R1 and R4 can still ping each other LAN-to-LAN using an extended ping:
| R1#ping 150.4.4.4 source fastethernet 0/0 repeat 10
Type escape sequence to abort. |
Finally, test the redundancy by disabling the R1-R2 WAN link and ensuring that R1 can still ping the 150.4.4.0/24 subnet:
| R1(config)#interface serial 0/0 R1(config-if)#shutdown R1(config-if)#exit R1(config)#do show ip bgp 150.4.4.0 255.255.255.0 BGP routing table entry for 150.4.4.0/24, version 10 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 3 3 3 10.0.0.6 from 10.0.0.6 (3.3.3.3) Origin IGP, localpref 100, valid, external, best R1(config)# R1(config)#do ping 150.4.4.4 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
Task 5
This task requires some thought and is three-fold. The configuration of the Loopback interfaces on router R1 is straightforward. The second part of the task is to advertise the 192.1.1.1/32 address to R2 only and then the 193.1.1.1/32 address to R3 only. This requires the use of route maps in conjunction with IP ACLs or prefix lists. The reason route maps are used in because of the third required, which will be illustrated later. This second part is completed as follows:
| R1(config)#interface loopback 192 R1(config-if)#ip address 192.1.1.1 255.255.255.255 R1(config-if)#exit R1(config)#interface loopback 193 R1(config-if)#ip addres 193.1.1.1 255.255.255.255 R1(config-if)#exit R1(config)#ip prefix-list LOOPBACK192 seq 5 permit 192.1.1.1/32 R1(config)#ip prefix-list LOOPBACK193 seq 5 permit 193.1.1.1/32 R1(config)#route-map R2-OUTBOUND deny 10 R1(config-route-map)#match ip address prefix-list LOOPBACK193 R1(config-route-map)#exit R1(config)#route-map R2-OUTBOUND permit 20 R1(config-route-map)#exit R1(config)#route-map R3-OUTBOUND deny 10 R1(config-route-map)#match ip address prefix-list LOOPBACK192 R1(config-route-map)#exit R1(config)#route-map R3-OUTBOUND permit 20 R1(config-route-map)#exit R1(config)#router bgp 1 R1(config-router)#network 192.1.1.1 mask 255.255.255.255 R1(config-router)#network 193.1.1.1 mask 255.255.255.255 R1(config-router)#neighbor 10.0.0.2 route-map R2-OUTBOUND out R1(config-router)#neighbor 10.0.0.6 route-map R3-OUTBOUND out R1(config-router)#exit |
Verify the configuration using the show ip bgp neighbors <address> advertised-routes command on R1 to see the prefixes advertised to R2 and R3:
| R1#show ip bgp neighbors 10.0.0.2 advertised-routes BGP table version is 15, local router ID is 1.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 Total number of prefixes 2 |
| R1#show ip bgp neighbor 10.0.0.6 advertised-routes BGP table version is 15, local router ID is 1.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 |
The third part of this task requires the use of the COMMUNITY attribute. The BGP well-known communities are communities that have predefined meanings. Cisco IOS software supports four well-known communities which are:
- NO_EXPORT
- NO_ADVERTISE
- INTERNET
- LOCAL_AS
The NO_EXPORT well-known community prevents BGP prefixes that are specifically assigned this predefined community attribute value from being advertised to any eBGP peers. The prefixes, however, will continue to be advertised to all other BGP speakers within the local AS. In other words, prefixes assigned this community value will remain local to the AS.
The NO_ADVERTISE community prevents any prefixes that are assigned this predefined community attribute from being advertised to any peer – internal or external.
The INTERNET community allows all prefixes assigned to this community to be advertised to any and all BGP peers (assuming no filtering, etc, is in place). In Cisco IOS software, all BGP prefixes belong to the INTERNET community by default.
And finally, the LOCAL_AS community is used in a somewhat similar manner to another of the previously described communities: the NO_EXPORT community. If used in a Confederation, the LOCAL_AS community prevents all prefixes assigned this community from being advertised out of the local sub autonomous system. When Confederations are not implemented, the LOCAL_AS community is applied in the same manner as the NO_EXPORT community.
This task is therefore completed by modifying the existing configuration as follows:
| R1(config)#route-map R2-OUTBOUND permit 20 R1(config-route-map)#match ip address prefix-list LOOPBACK192 R1(config-route-map)#set community no-advertise R1(config-route-map)#exit R1(config)#route-map R2-OUTBOUND permit 30 R1(config-route-map)#exit R1(config)#route-map R3-OUTBOUND permit 20 R1(config-route-map)#match ip address prefix-list LOOPBACK193 R1(config-route-map)#set community no-advertise R1(config-route-map)#exit R1(config)#route-map R3-OUTBOUND permit 30 R1(config-route-map)#exit R1(config)#router bgp 1 R1(config-router)#neighbor 10.0.0.2 send-community standard R1(config-router)#neighbor 10.0.0.6 send-community standard R1(config-router)#end R1# R1#clear ip bgp * soft out |
Next, verify that these prefixes are received by R2 and R3 and are not re-advertised as required:
| R2#show ip bgp BGP table version is 11, local router ID is 2.2.2.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 |
Use the show ip bgp <network> <mask> command to view all attribute information:
| R2#show ip bgp 192.1.1.1 255.255.255.255 BGP routing table entry for 192.1.1.1/32, version 10 Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to any peer) Not advertised to any peer 1 10.0.0.1 from 10.0.0.1 (1.1.1.1) Origin IGP, metric 0, localpref 100, valid, external, best Community: no-advertise |
The BGP RIB on R3 shows the following entries:
| R3#show ip bgp BGP table version is 9, local router ID is 3.3.3.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 |
Use the show ip bgp <network> <mask> command to view all attribute information:
| R3#show ip bgp 193.1.1.1 255.255.255.255 BGP routing table entry for 193.1.1.1/32, version 9 Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to any peer) Not advertised to any peer 1 10.0.0.5 from 10.0.0.5 (1.1.1.1) Origin IGP, metric 0, localpref 100, valid, external, best Community: no-advertise |
The BGP RIB on R4 should have NO entries for the 192.1.1.1/32 or 193.1.1.1/32 prefixes:
| R4#show ip bgp BGP table version is 9, local router ID is 4.4.4.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 |
Task 6
To complete this task, configure R1 to advertise a default route to R2 and R3. This will allow R4 to always reach these two prefixes when either the R1-R3 or R2-R3 link is down:
| R1(config)#router bgp 1 R1(config-router)#neighbor 10.0.0.2 default-originate R1(config-router)#neighbor 10.0.0.6 default-originate R1(config-router)#exit |
Verify that the default route exists in R4s BGP RIB using the show ip bgp command:
| 4#show ip bgp 0.0.0.0 0.0.0.0 BGP routing table entry for 0.0.0.0/0, version 11 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Not advertised to any peer 1 10.0.0.13 from 10.0.0.13 (3.3.3.3) Origin IGP, metric 0, localpref 100, valid, internal, best |
Next, ping the 192.1.1.1/32 and 193.1.1.1/32 prefixes from R4s LAN subnet address:
| R4#ping 192.1.1.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R4#ping 193.1.1.1 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
Finally, test BGP redundancy by shutting down the R1-R3 link and performing the same test:
| R4#show ip bgp 0.0.0.0 0.0.0.0 BGP routing table entry for 0.0.0.0/0, version 13 Paths: (1 available, best #1, table Default-IP-Routing-Table) Flag: 0x820 Not advertised to any peer 2 1 10.0.0.13 from 10.0.0.13 (3.3.3.3) Origin IGP, metric 0, localpref 100, valid, internal, best |
| R4#ping 192.1.1.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R4#ping 193.1.1.1 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
Final Router Configurations
R1
|
R1#term len 0 Current configuration : 1995 bytes R1# |
R2
|
R2#term len 0 Current configuration : 1006 bytes R2# |
R3
|
R3#term len 0 Current configuration : 1667 bytes R3# |
R4
|
R4#term len 0 Current configuration : 964 bytes R4# |
