Lab Objective:
The focus of this lab is to understand BGP implementation and configuration in Cisco IOS routers. Additional technologies include confederations, 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 the following the following Loopback 0 interfaces on all routers and then enable OSPF using area 0 (backbone) on all routers. OSPF should only be enabled for the Loopback and 10.x.x.x/30 WAN subnets. Do NOT enable OSPF for the 150.x.x.x/24 LAN subnets.
R1: Loopback 0: IP Address 1.1.1.1/32
R2: Loopback 0: IP Address 2.2.2.2/32
R3: Loopback 0: IP Address 3.3.3.3/32
R4: Loopback 0: IP Address 4.4.4.4/32
Task 3
Configure BGP confederations as illustrated in the network topology. Use Loopback interface IP addresses for BGP peering. To the outside world, all routers should appear to be in BGP AS 254. Verify your configuration using the appropriate commands.
Task 4
Advertise the 150.x.x.x/24 subnets on R1, R2, R3, and R4 via BGP. Ensure that all routers can ping each others’ LAN subnet from their own LAN subnet. For example, from R1 ping the 150.4.4.4 address using an extended ping sourced from the routers FastEthernet0/0 interface.
Task 5
In the future, a link will be provisioned between R1 and R4. However, management has decided that R1 and R2 should ALWAYS prefer the path through sub-AS 65505 to reach each others’ LAN subnets ONLY. Any other subnets that may be added to additional sub-ASes in the future should be affected by this configuration. For example, if another sub-AS is connected to R4, then R1 should prefer the path directly through R4 to reach this sub-AS since it will have a shorter AS_PATH list than going through sub-AS 65505. You are NOT allowed to use IP ACLs or prefix lists to complete this task. Verify the solution using the appropriate commands.
Task 6
Configure sub-AS 65505 to advertise a single prefix instead of the two 150.2.2.0/24 as well as the 150.3.3./24 prefixes connected to R2 and R3s LAN interfaces to R1 and R4.
HINT: Use the neighbor <address> unsuppress-map <route-map-name> command on R2 and R3 to allow these prefixes to be advertised within sub AS 65505 so that R2 and R3 still have LAN-to-LAN connectivity.
Verify your configuration and ensure that R1 and R2 can still reach the LAN that are connected to R2 and R3. Use extended pings to verify your configuration.
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
Please refer to previous labs for basic OSPF configuration. This will not be included in this section to avoid being redundant. Following completion, the routing tables on your routers should show the following OSPF route entries:
| R1#show ip route ospf 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 10.0.0.2, 00:00:05, Serial0/0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/129] via 10.0.0.2, 00:00:05, Serial0/0 4.0.0.0/32 is subnetted, 1 subnets O 4.4.4.4 [110/910] via 10.0.0.2, 00:00:05, Serial0/0 10.0.0.0/30 is subnetted, 3 subnets O 10.0.0.8 [110/128] via 10.0.0.2, 00:00:05, Serial0/0 O 10.0.0.12 [110/909] via 10.0.0.2, 00:00:05, Serial0/0 |
| R2#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/65] via 10.0.0.1, 00:00:11, Serial0/0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/65] via 10.0.0.10, 00:00:11, Serial0/1 4.0.0.0/32 is subnetted, 1 subnets O 4.4.4.4 [110/846] via 10.0.0.10, 00:00:11, Serial0/1 10.0.0.0/30 is subnetted, 3 subnets O 10.0.0.12 [110/845] via 10.0.0.10, 00:00:11, Serial0/1 |
| R3#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/846] via 10.0.0.9, 00:00:14, Serial1/1 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/782] via 10.0.0.9, 00:00:14, Serial1/1 4.0.0.0/32 is subnetted, 1 subnets O 4.4.4.4 [110/782] via 10.0.0.14, 00:00:14, Serial1/2 10.0.0.0/30 is subnetted, 3 subnets O 10.0.0.0 [110/845] via 10.0.0.9, 00:00:14, Serial1/1 |
| R4#show ip route ospf 1.0.0.0/32 is subnetted, 1 subnets O 1.1.1.1 [110/910] via 10.0.0.13, 00:00:12, Serial0/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/846] via 10.0.0.13, 00:00:12, Serial0/0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/65] via 10.0.0.13, 00:00:12, Serial0/0 10.0.0.0/30 is subnetted, 3 subnets O 10.0.0.8 [110/845] via 10.0.0.13, 00:00:12, Serial0/0 O 10.0.0.0 [110/909] via 10.0.0.13, 00:00:12, Serial0/0 |
Task 3
The configuration of confederations is a little more complex than that required to configure and implement Route Reflectors. In Cisco IOS software, the following sequence of steps is required to configure and implement BGP confederations:
- Configure the local BGP speaker with the desired private AS number using the router bgp [private AS number] global configuration command
- Configure the local BGP speaker with the public AS using the bgp confederation identifier [public AS number] router configuration command
- Specify one or more sub-AS peers that this local BGP speaker will peer to using the bgp confederation peers [sub-AS] router configuration command. If the local BGP speaker will not peer to any other sub-AS, this command must be omitted
- Configure the BGP neighbor relationships following the standard steps. However, if a local BGP speaker will be peered to another BGP speaker in a different sub-AS, you must use the neighbor [address] ebgp-multihop command if you will be using Loopback interfaces for the BGP session
Following the sequence of steps illustrated above, this task is completed as follows:
| R1(config)#router bgp 65501 R1(config-router)#bgp confederation identifier 254 R1(config-router)#bgp confederation peers 65505 R1(config-router)#neighbor 2.2.2.2 remote-as 65505 R1(config-router)#neighbor 2.2.2.2 update-source loopback 0 R1(config-router)#neighbor 2.2.2.2 ebgp-multihop R1(config-router)#exit |
| R2(config)#router bgp 65505 R2(config-router)#bgp confederation identifier 254 R2(config-router)#bgp confederation peers 65501 R2(config-router)#neighbor 1.1.1.1 remote-as 65501 R2(config-router)#neighbor 1.1.1.1 update-source loopback 0 R2(config-router)#neighbor 1.1.1.1 ebgp-multihop R2(config-router)#neighbor 3.3.3.3 remote-as 65505 R2(config-router)#neighbor 3.3.3.3 update-source loopback 0 R2(config-router)#neighbor 3.3.3.3 ebgp-multihop R2(config-router)#exit |
| R3(config)#router bgp 65505 R3(config-router)#bgp confederation identifier 254 R3(config-router)#bgp confederation peers 65504 R3(config-router)#neighbor 2.2.2.2 remote-as 65505 R3(config-router)#neighbor 2.2.2.2 update-source loopback 0 R3(config-router)#neighbor 2.2.2.2 ebgp-multihop R3(config-router)#neighbor 4.4.4.4 remote-as 65504 R3(config-router)#neighbor 4.4.4.4 update-source loopback 0 R3(config-router)#neighbor 4.4.4.4 ebgp-multihop R3(config-router)#exit |
| R4(config)#router bgp 65504 R4(config-router)#bgp confederation identifier 254 R4(config-router)#bgp confederation peers 65505 R4(config-router)#neighbor 3.3.3.3 remote-as 65505 R4(config-router)#neighbor 3.3.3.3 update-source loopback 0 R4(config-router)#neighbor 3.3.3.3 ebgp-multihop 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 65501 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 65505 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 65505 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 65504 BGP table version is 1, main routing table version 1 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd |
Task 4
This is a straightforward task that is completed using the network command under BGP:
| R1(config)#router bgp 65501 R1(config-router)#network 150.1.1.0 mask 255.255.255.0 R1(config-router)#exit |
| R2(config)#router bgp 65505 R2(config-router)#network 150.2.2.0 mask 255.255.255.0 R2(config-router)#exit |
| R3(config)#router bgp 65505 R3(config-router)#network 150.3.3.0 mask 255.255.255.0 R3(config-router)#exit |
| R4(config)#router bgp 65504 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 on all routers:
| 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 4, 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, use the extended ping function to verify LAN-to-LAN connectivity between subnets:
| 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 5
To complete this task, you need to use either the WEIGHT or LOCAL_PREF attributes along with a regular expression (since using IP ACLs and prefix lists is forbidden). In Cisco IOS software, AS path filters are used to perform BGP filtering policy control based on the AS_PATH attribute. The AS path attribute pattern used in these filters is defined by a regular expression string that is configured using the ip as-path access-list [number] [permit | deny] <regexp> global configuration command. The configured filter list may then be applied directly on a per-neighbor basis using the neighbor [address] filter-list <as_path_acl_number> router configuration command or indirectly on a per-neighbor basis by referencing an route map which matches one or more AS path filters using the match as-path <as_path_acl_number> route map match clause.
The table below shows some basic regular expression configuration and what they match:
| Regular Expression | Matches |
| .* | This regular expression is used to match all prefixes |
| ^$ | This regular expression matches only prefixes local to the AS |
| _254$ | This regular expression matches only prefixes that originate in AS 254 |
| ^254_ [0-9]*$ | This regular expression matches prefixes received from directly connected AS 254 and any ASes directly attached to AS 254 |
| _254_ | This regular expression matches prefixes that have traversed AS 254 |
| ^254$ | This regular expression matches prefixes only originated from directly connected AS 254 |
This task is completed using regular expressions and the Cisco proprietary WEIGHT attribute. However, keep in mind that you may also use LOCAL_PREF. Either attribute is acceptable. Match on prefixes originated from sub-AS 65501 and sub-AS 65504 to complete this task. You can verify which prefixes will match your AS_PATH ACL Filter beforehand using the show ip bgp regexp <regular expression> command as follows:
| R1#show ip bgp regexp _\(65505 65504\)$ 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 |
| R4#show ip bgp regexp _\(65505 65501\)$ 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 |
This task is completed as follows:
| R1(config)#ip as-path access-list 1 permit _\(65505 65504\)$ R1(config)#route-map WEIGHT permit 10 R1(config-route-map)#match as-path 1 R1(config-route-map)#set weight 50000 R1(config-route-map)#exit R1(config)#route-map WEIGHT permit 20 R1(config-route-map)#exit R1(config)#router bgp 65501 R1(config-router)#neighbor 2.2.2.2 route-map WEIGHT in R1(config-router)#exit |
| R4(config)#ip as-path access-list 1 permit _\(65505 65501\)$ R4(config)#route-map WEIGHT permit 10 R4(config-route-map)#match as-path 1 R4(config-route-map)#set weight 50000 R4(config-route-map)#exit R4(config)#route-map WEIGHT permit 20 R4(config-route-map)#exit R4(config)#router bgp 65504 R4(config-router)#neighbor 3.3.3.3 route-map WEIGHT in R4(config-router)#exit |
Verify your configuration using the show ip bgp command on routers R1 and R4 as follows:
| R1#show ip bgp BGP table version is 6, 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 |
| R4#show ip bgp BGP table version is 10, 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 |
NOTE: Additional information on regular expressions is available in the ROUTE guide.
Task 6
This task is completed using the aggregate-address command. By default, this command will advertise BOTH the aggregate (summary) and the more specific prefixes. To advertise only the summary, you need to append the summary-only keyword. This keyword instructs the router to advertise the aggregate only and suppress the more specific routes that are covered by the summary. This task is completed as follows:
| R2(config)#router bgp 65505 R2(config-router)#aggregate-address 150.2.0.0 255.254.0.0 summary-only R2(config-router)#exit |
| R3(config)#router bgp 65505 R3(config-router)#aggregate-address 150.2.0.0 255.254.0.0 summary-only R3(config-router)#exit |
Next, verify that the more specific 150.2.2.0/24 and 150.3.3.0/24 prefixes are suppressed:
| R2#show ip bgp BGP table version is 9, 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 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 |
You will notice that neither R2 nor R3 has a route to the other routers’ LAN subnet. Therefore, as was hinted in the task, use the neighbor<address> unsuppress-map <route-map-name> command to unsuppress (leak) these routes between the routers. This is similar to route leaking with EIGRP. This task is completed as follows:
|
R2(config)#ip prefix-list LAN-SUBNET seq 5 permit 150.2.2.0/24 R2(config)#route-map UNSUPRESS permit 10 R2(config-route-map)#match ip addres prefix-list LAN-SUBNET R2(config-route-map)#exit R2(config)#router bgp 65505 R2(config-router)#neighbor 3.3.3.3 unsuppress-map UNSUPRESS R2(config-router)#exit |
| R3(config)#ip prefix-list LAN-SUBNET seq 5 permit 150.3.3.0/24 R3(config)#route-map UNSUPRESS permit 10 R3(config-route-map)#match ip addres prefix-list LAN-SUBNET R3(config-route-map)#exit R3(config)#router bgp 65505 R3(config-router)#neighbor 2.2.2.2 unsuppress-map UNSUPRESS R3(config-router)#exit |
Following this configuration, you will notice that the LAN prefixes are now present as well:
| 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 |
| R3#show ip bgp BGP table version is 11, 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 |
Although the specific LAN subnets are advertised within sub-AS 65505, verify that only a single prefix is received by routers R1 and R4 from peers R2 and R3, respectively:
| R1#show ip bgp BGP table version is 9, 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 |
| R4#show ip bgp BGP table version is 14, 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 R1 and R4 can still ping the R2 and R3 LAN subnets using an extended ping:
| 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. |
| 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. |
Final Router ConfigurationsR1
|
R1#term len 0 Current configuration : 1424 bytes R1# |
R2
|
R2#term len 0 Current configuration : 1589 bytes R2# |
R3
|
R3#term len 0 Current configuration : 1930 bytes R3# |
R4
|
R4#term len 0 Current configuration : 1405 bytes R4# |
