Lab Objective:
The focus of this lab is to understand BGP implementation and configuration in Cisco IOS routers. Additional technologies include route filtering, summarization 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 R1 with the following Loopback interfaces:
Loopback 1920: IP Address 192.0.0.1/32
Loopback 1921: IP Address 192.0.1.1/32
These prefixes should be advertised only to R2. Next, configure R2 to advertise a single route for these prefixes to R3. Ensure that this aggregate route ONLY appears in the BGP Table of R4 but not in the BGP Table of R1. Adhere to the following restrictions when completing this task:
- You can NOT use an outbound route map on R1
- You can NOT use any outbound filters or route maps on R2 or R3
- You can NOT use any inbound filters or route maps on R1 or R3
- You can NOT modify administrative distance values
Verify your configuration using the appropriate commands. Verify that R2, R3, and R4 can ping these prefixes from their LAN subnets, i.e. the 150.x.x.x/24 addresses.
Task 5
To support a future Anycast solution, configure R2 and R4 with a Loopback 200 interface with the IP address 200.8.8.8/32. Next, redistribute this prefix into BGP on R2 and R4 and configure BGP path control so that R1 prefers the prefix originated by R4 over the prefix originated by R1. However, you must adhere to the following restrictions when completing this task:
- You can NOT modify the AS_PATH length for this prefix on ANY router
- You can NOT modify default administrative distance values
- You can NOT modify the WEIGHT or LOCAL_PREF attributes on R1
- You can only issue ONE single command on R1, i.e. one line of code
- You MUST use route maps when redistributing this interface on R2 and R4
Verify your configuration using the appropriate commands. Ensure that R1 can ping this address from its LAN IP address of 150.1.1.1/24.
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 5 R3(config-router)#neighbor 10.0.0.9 remote-as 2 R3(config-router)#neighbor 10.0.0.14 remote-as 4 R3(config-router)#exit |
| R4(config)#router bgp 4 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 on all routers:
| 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 4 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 |
| R3(config)#router bgp 3 R3(config-router)#network 150.3.3.0 mask 255.255.255.0 R3(config-router)#exit |
| R4(config)#router bgp 4 R4(config-router)#network 150.4.4.0 mask 255.255.255.0 R4(config-router)#exit |
Verify that all routers have the 150.x.x.x/24 subnets in their BGP Tables:
| 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 each router can ping every other routers’ LAN interface from its own:
| R1#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.3.3.3 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
The requirements of this task are three-fold. First, configure the Loopback interfaces on R1 and then advertise them via BGP but ONLY to R2. This is done using an outbound prefix list that prevents the prefixes from being advertised to R3. The first part is completed on R1 as follows:
| R1(config)#interface loopback 1920 R1(config-if)#ip add 192.0.0.1 255.255.255.255 R1(config-if)#exit R1(config)#interface loopback 1921 R1(config-if)#ip add 192.0.1.1 255.255.255.255 R1(config-if)#exit R1(config)#ip prefix-list FILTER seq 1 deny 192.0.0.1/32 R1(config)#ip prefix-list FILTER seq 2 deny 192.0.1.1/32 R1(config)#ip prefix-list FILTER seq 3 permit 0.0.0.0/0 le 32 R1(config)#router bgp 1 R1(config-router)#network 192.0.0.1 mask 255.255.255.255 R1(config-router)#network 192.0.1.1 mask 255.255.255.255 R1(config-router)#exit |
Verify your configuration using show ip bgp neighbor <address> advertised-routes command on R1 to see which prefixes are advertised to R2 and R3:
| R1#show ip bgp neighbors 10.0.0.2 advertised-routes 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 Total number of prefixes 6 |
| R1#show ip bgp neighbors 10.0.0.6 advertised-routes 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 Total number of prefixes 2 |
The second part of this task requires that you summarize these prefixes and ensure that they are NOT advertised back to R1 by R3. Given the restrictions, which prevent the manipulation of attributes, administrative distance values, or using inbound or outbound filters, we need to use another solution. When summarizing with BGP, if you use the aggregate-address command, the router that performs the aggregation removes, by default, any other AS_PATH information (AS_SET). The summarized route is therefore originated from the AS of the router that generated the summary. This means that if the routes that are summarized were received from another AS, as is our case, the aggregate can be re-advertised back to that AS, causing all sorts of issues. For example, assume the following command was issued on R2:
| R2(config)#router bgp 2 R2(config-router)#aggregate-address 192.0.0.0 255.255.254.0 summary-only R2(config-router)#exit |
Given this configuration, R2 suppresses the specific 192.0.0.1/32 and 192.0.1.1/32 prefixes and advertises only a single route to R3. This route appears on R3 as follows:
| R3#show ip bgp 192.0.0.0 255.255.254.0 BGP routing table entry for 192.0.0.0/23, version 10 Paths: (2 available, best #2, table Default-IP-Routing-Table) Flag: 0x820 Advertised to update-groups: 1 1 2, (aggregated by 2 2.2.2.2) 10.0.0.5 from 10.0.0.5 (1.1.1.1) Origin IGP, localpref 100, valid, external, atomic-aggregate 2, (aggregated by 2 2.2.2.2) 10.0.0.9 from 10.0.0.9 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best |
Notice that the AS_PATH shows that this aggregate originates in AS 2, even though it is based on prefixes originated in AS 1. Given this, R1 will accept this same prefix from both R2 an R3:
| R1#show ip bgp 192.0.0.0 255.255.254.0 BGP routing table entry for 192.0.0.0/23, version 8 Paths: (2 available, best #2, table Default-IP-Routing-Table) Advertised to update-groups: 2 3 2, (aggregated by 2 2.2.2.2) 10.0.0.6 from 10.0.0.6 (3.3.3.3) Origin IGP, localpref 100, valid, external, atomic-aggregate 2, (aggregated by 2 2.2.2.2) 10.0.0.2 from 10.0.0.2 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best |
To complete this task, we need append the as-set keyword to the BGP aggregate-address command. The as-set argument creates an aggregate address with a mathematical set of autonomous systems. In other words, it includes all ASes of the specific prefixes from which the aggregate is generated. This prevents the aggregate from being advertised back to those ASes; i.e. the routers receiving this UPDATE will see their own AS_PATH in the string and drop it. To complete this task, configure R2 as follows:
| R2(config)#router bgp 2 R2(config-router)#aggregate-add 192.0.0.0 255.255.254.0 summary-only as-set R2(config-router)#exit |
Following this change, the aggregate now reflects an origin of AS 1 when seen on R3:
| R3#show ip bgp 192.0.0.0 255.255.254.0 BGP routing table entry for 192.0.0.0/23, version 13 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 2 1, (aggregated by 2 2.2.2.2) 10.0.0.9 from 10.0.0.9 (2.2.2.2) Origin IGP, metric 0, localpref 100, valid, external, best |
Because R1 sees its own AS_PATH in the list, it does NOT accept the aggregate:
| R1#show ip bgp 192.0.0.0 255.255.254.0 % Network not in table |
However, the aggregate is still advertised to R4:
| R4#show ip bgp 192.0.0.0 255.255.254.0 BGP routing table entry for 192.0.0.0/23, version 13 Paths: (1 available, best #1, table Default-IP-Routing-Table) Not advertised to any peer 3 2 1, (aggregated by 2 2.2.2.2) 10.0.0.13 from 10.0.0.13 (3.3.3.3) Origin IGP, localpref 100, valid, external, best |
The final task is to verify that R1, R2 and R3 can all ping the 192.0.0.1/32 and 192.0.1.1/32 prefixes from their LAN interfaces. This last part is completed as follows:
| R2#ping 192.0.0.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R2#ping 192.0.1.1 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
| R3#ping 192.0.0.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R3#ping 192.0.1.1 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
| R4#ping 192.0.0.1 source fastethernet 0/0 repeat 10
Type escape sequence to abort. R4#ping 192.0.1.1 source fastethernet 0/0 repeat 10 Type escape sequence to abort. |
Task 5
While seemingly very difficult, this task is quite simple IF you have read the BGP path selection process in the ROUTE guide. Because we cannot use WEIGHT or LOCAL_PREF, those two attributes are ruled out. Because both prefixes are not originated on the local router, we can skip this step of the path selection process.
The next attribute to consider then would be the AS_PATH length. However, the task says that we cannot MODIFY the AS_PATH length; however, it says nothing about ignoring the AS_PATH. In the ROUTE guide, in the BGP path selection process section, it reads as follows:
| If no route was originated, prefer the route that has the shortest AS_PATH. However, if the bgp bestpath as-path ignore command is issued on the router, the AS_PATH attribute is not used in BGP best path selection. Also, when comparing this attribute, an AS_SET is counted once, regardless of the number of autonomous systems in the set. And, finally, the AS_CONFED_SEQUENCE is not included in the AS_PATH length |
Therefore, we can configure R1 to IGNORE the AS_PATH attribute in best path selection and look at the next attribute in the best path selection process, which is ORIGIN, we can influence the path selection by configuring R1 to ignore the AS_PATH attribute in the path selection process and advertising the prefix from R4 with a better ORIGIN code than that on R2. This task is completed as follows:
| R1(config)#router bgp 1 R1(config-router)#bgp bestpath as-path ignore R1(config-router)#exit |
NOTE: The bgp bestpath as-path ignore command is a hidden command. It will not show up when you hit the question mark (?). Simply type it in and is shows up in the config.
| R1(config)#router bgp 1 R1(config-router)#bgp bestpath ? compare-routerid Compare router-id for identical EBGP paths cost-community cost community med MED attribute |
Complete your configuration on routers R2 and R4 as follows:
| R2(config)#interface loopback 200 R2(config-if)#ip address 200.8.8.8 255.255.255.255 R2(config-if)#exit R2(config)#route-map LOOPBACK permit 10 R2(config-route-map)#match interface loopback 200 R2(config-route-map)#exit R2(config)#router bgp 2 R2(config-router)#redistribute connected route-map LOOPBACK R2(config-router)#exit |
| R4(config)#interface loopback 200 R4(config-if)#ip address 200.8.8.8 255.255.255.255 R4(config-if)#exit R4(config)#route-map LOOPBACK permit 10 R4(config-route-map)#match interface loopback 200 R4(config-route-map)#set origin igp R4(config-route-map)#exit R4(config)#router bgp 4 R4(config-router)#redistribute connected route-map LOOPBACK R4(config-router)#exit |
Following this change, the BGP Table on R1 reflects the following for the 200.8.8.8/32 prefix:
| R1#show ip bgp 200.8.8.8 255.255.255.255 BGP routing table entry for 200.8.8.8/32, version 8 Paths: (2 available, best #2, table Default-IP-Routing-Table) Flag: 0x820 Advertised to update-groups: 1 2 10.0.0.2 from 10.0.0.2 (2.2.2.2) Origin incomplete, metric 0, localpref 100, valid, external 3 4 10.0.0.6 from 10.0.0.6 (3.3.3.3) Origin IGP, localpref 100, valid, external, best |
Because the AS_PATH attribute is ignored in best path selection on R1, it is omitted in the path selection process and the next valid attribute, ORIGIN, is used instead. Given that an ORIGIN of IGP > EGP > Incomplete, the path from R4 wins and is used instead. The same logic is also applicable to R3, which prefers this same path because of the ORIGIN:
| R3#show ip bgp 200.8.8.8 255.255.255.255 BGP routing table entry for 200.8.8.8/32, version 15 Paths: (2 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 4 10.0.0.14 from 10.0.0.14 (4.4.4.4) Origin IGP, metric 0, localpref 100, valid, external, best 2 10.0.0.9 from 10.0.0.9 (2.2.2.2) Origin incomplete, metric 0, localpref 100, valid, external |
Finally, complete this task by pinging from R1s LAN to the 192.8.8.8/32 address:
| R1#ping 200.8.8.8 source 150.1.1.1 repeat 10
Type escape sequence to abort. |
Final Router Configurations
R1
|
R1#term len 0 Current configuration : 1447 bytes R1# |
R2
|
R2#sh run Current configuration : 1234 bytes R2# |
R3
|
R3#term len 0 Current configuration : 1390 bytes R3# |
R4
|
R4#term len 0 Current configuration : 1145 bytes R4# |
