16.1.4 Lab - Configure Route Redistribution Using BGP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Lab - Implement Route Redistribution Between Multiple Protocols

Topology

Addressing Table
Device Interface IP Address Subnet Mask

R1 G0/0/0 10.1.12.1 255.255.255.0

R1
G0/0/1 10.1.11.1 255.255.255.0

R1
Loopback 0 10.1.1.1 255.255.255.0
R2 G0/0/0 10.1.12.2 255.255.255.0

R2
G0/0/1 10.1.23.2 255.255.255.0
R3 G0/0/0 10.1.23.3 255.255.255.0

R3
G0/0/1 10.1.32.3 255.255.255.0

R3
Loopback 0 10.3.3.3 255.255.255.0
D1 G1/0/11 10.1.11.2 255.255.255.0

D1
Loopback 0 198.51.100.1 255.255.255.128
D2 G1/0/11 10.1.32.2 255.255.255.0

D2
Loopback 0 209.165.201.1 255.255.255.128

Objectives
Part 1: Build the Network and Configure Basic Device Settings
Part 2: Configure and Verify Two-Way Redistribution on R1
Part 3: Configure and Verify Two-Way Redistribution on R3
Part 4: Filter and Verify Redistribution using a Route Map
Background / Scenario
Every routing protocol has a unique redistribution behavior. The default redistribution behavior for EIGRP, OSPF, and
BGP is as follows:
o External routes redistributed into EIGRP have a seed metric of infinity and EIGRP routes set with infinity are
not installed into the EIGRP topology table.
o External routes redistributed into OSPF by default, are Type 2 (E2) external. Routes sourced from BGP will
have a seed metric of 1, while other routing protocols will have a seed metric of 20. Only classful networks
are redistributed, not subnets.
o External routes redistributed into BGP have the origin set to incomplete (?), the multi-exit discriminator
(MED) is set to the IGP metric and the weight is set to 32,768. By default, BGP does not redistribute internal
BGP routes.
In this lab, you will configure mutual or two-way redistribution between multiple EIGRP and OSPF on R1. Then you
will configure two-way redistribution between OSPF and BGP on R3. Finally, a route map will be used to selectively
redistribute routes.
Note: This lab is an exercise in configuring and verifying two-way route redistribution on router’s R1 and R3. Route
redistribution in this lab does not reflect networking best practices.
Note: The routers used with CCNP hands-on labs are Cisco 4221 with Cisco IOS XE Release 16.9.4 (universalk9
image). The switches used in the labs are Cisco Catalyst 3650 with Cisco IOS XE Release 16.9.4 (universalk9
image). Other routers, switches, and Cisco IOS versions can be used. Depending on the model and Cisco IOS
version, the commands available and the output produced might vary from what is shown in the labs.
Note: Make sure that all the devices have been erased and have no startup configurations. If you are unsure, contact
your instructor.
Instructor Note: Refer to the Instructor Lab Manual for the procedures to initialize and reload devices.

Required Resources
 3 Routers (Cisco 4221 with Cisco IOS XE Release 16.9.4 universal image or comparable)
 2 Switches (Cisco 3650 with Cisco IOS XE release 16.9.4 universal image or comparable)
 1 PC (Windows with terminal emulation program)
 Console cables to configure the Cisco IOS devices via the console ports
 Ethernet cables as shown in the topology

Instructions
Part 1: Build the Network and Configure Basic Device Settings
In Part 1, you will set up the network topology and configure basic settings.

Step 1: Cable the network as shown in the topology.


Attach the devices as shown in the topology diagram, and cable as necessary.

Step 2: Configure basic settings for each device.


a. Console into each device, enter global configuration mode, and apply the basic settings for the lab. Initial
configurations for each device are listed below.
Open configuration window

Router R1
hostname R1
no ip domain lookup
banner motd # R1, Configure BGP Route Redistribution #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface g0/0/0
ip address 10.1.12.1 255.255.255.0
no shutdown
exit
interface g0/0/1
ip address 10.1.11.1 255.255.255.0
no shutdown
exit
interface loopback 0
ip address 10.1.1.1 255.255.255.0
ip ospf network point-to-point
ip ospf cost 15
no shutdown
exit
router eigrp 64512
eigrp router-id 1.1.1.1
network 10.1.11.0 0.0.0.255
exit
router ospf 1
router-id 1.1.1.1
network 10.1.1.0 0.0.0.255 area 1
network 10.1.12.0 0.0.0.255 area 0
exit
end
Router R2
hostname R2
no ip domain lookup
banner motd # R2, Configure BGP Route Redistribution #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface g0/0/0
ip address 10.1.12.2 255.255.255.0
no shutdown
exit
interface g0/0/1
ip address 10.1.23.2 255.255.255.0
no shutdown
exit
router ospf 1
router-id 2.2.2.2
network 10.1.12.0 0.0.0.255 area 0
network 10.1.23.0 0.0.0.255 area 0
end
Router R3
hostname R3
no ip domain lookup
banner motd # R3, Configure BGP Route Redistribution #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface g0/0/0
ip address 10.1.23.3 255.255.255.0
no shutdown
exit
interface g0/0/1
ip address 10.1.32.3 255.255.255.0
no shutdown
exit
interface loopback 0
ip address 10.3.3.1 255.255.255.0
ip ospf network point-to-point
no shutdown
exit
router ospf 1
router-id 3.3.3.3
network 10.3.3.0 0.0.0.255 area 0
network 10.1.23.0 0.0.0.255 area 0
router bgp 64532
bgp router-id 3.3.3.3
no bgp default ipv4-unicast
neighbor 10.1.32.2 remote-as 64532
address-family ipv4
neighbor 10.1.32.2 activate
neighbor 10.1.32.2 next-hop-self
exit-address-family
end
Switch D1
hostname D1
no ip domain lookup
ip routing
banner motd # D1, Configure BGP Route Redistribution #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface range g1/0/1-24
shutdown
exit
interface g1/0/11
no switchport
ip address 10.1.11.2 255.255.255.0
no shutdown
exit
interface loopback 0
ip address 198.51.100.1 255.255.255.128
no shutdown
exit
router eigrp 64512
eigrp router-id 11.11.11.11
network 10.1.11.0 0.0.0.255
network 198.51.100.0 0.0.0.127
end
Switch D2
hostname D2
no ip domain lookup
ip routing
banner motd # D2, Configure BGP Route Redistribution #
line con 0
exec-timeout 0 0
logging synchronous
exit
interface range g1/0/1-24
shutdown
exit
interface g1/0/11
no switchport
ip address 10.1.32.2 255.255.255.0
no shutdown
exit
interface loopback 0
ip address 209.165.201.1 255.255.255.128
no shutdown
exit
router bgp 64532
bgp router-id 22.22.22.22
no bgp default ipv4-unicast
neighbor 10.1.32.3 remote-as 64532
address-family ipv4
network 209.165.201.0 mask 255.255.255.128
neighbor 10.1.32.3 activate
exit-address-family
end
b. Set the clock on all devices to UTC time.
c. Save the running configuration to startup-config on all devices.
Close configuration window

Step 3: Verify EIGRP on R1.


a. Verify that R1 has one EIGRP neighbor with D1.
Open configuration window

R1# show ip eigrp neighbors


EIGRP-IPv4 Neighbors for AS(64512)
H Address Interface Hold Uptime SRTT RTO QSeq
(sec) (ms) CntNum
0 10.1.11.2 Gi0/0/1 10 00:04:08 3 100 032
b. Next, issue the show ip route eigrp command, as shown, and notice the internal EIGRP route is from D1,
Loopback 0.
R1# show ip route eigrp | begin Gateway
Gateway of last resort is not set
198.51.100.0/25 is subnetted, 1 subnets
D 198.51.100.0
[90/130816] via 10.1.11.2, 00:07:43, GigabitEthernet0/0/1

Step 4: Verify OSPF on R1.


a. Verify that R1 has one OSPF neighbor with R2.
R1# show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface


2.2.2.2 1 FULL/BDR 00:00:39 10.1.12.2 GigabitEthernet0/0/0
b. Next, on R1 issue the show ip route ospf command, as shown. Notice the two OSPF intra–area routes.
R1# show ip route ospf | begin Gateway
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O 10.1.23.0/24 [110/2] via 10.1.12.2, 00:35:32, GigabitEthernet0/0/0
O 10.3.3.0/24 [110/3] via 10.1.12.2, 00:35:32, GigabitEthernet0/0/0
Close configuration window

Step 5: Verify OSPF on R3.


a. Verify that R3 has one OSPF neighbor with R2 using the show ip ospf neighbor command.
Open configuration window

R3# show ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface


2.2.2.2 1 FULL/DR 00:00:36 10.1.23.2 GigabitEthernet0/0/0
b. Next, issue the show ip route ospf command, as shown. Notice the first route is an OSPF inter–area route from
Area 1 on R1 with an OSPF cost of 17. Notice the other route is an OSPF intra–area prefix with an OSPF cost of
2.
R3# show ip route ospf | begin Gateway
Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks


O IA 10.1.1.0/24 [110/17] via 10.1.23.2, 06:07:43, GigabitEthernet0/0/0
O 10.1.12.0/24 [110/2] via 10.1.23.2, 06:16:33, GigabitEthernet0/0/0

Step 6: Verify BGP on R3.


a. Issue the show bgp ipv4 unicast neighbors command, as shown. Notice the “established” BGP peer at
10.1.32.2, D2.
R3# show bgp ipv4 unicast neighbors | include BGP
BGP neighbor is 10.1.32.2, remote AS 64532, internal link
BGP version 4, remote router ID 22.22.22.22
BGP state = Established, up for 00:11:11
< some output omitted >
b. Next, issue the show bgp ipv4 unicast command and notice the 209.165.201.0/25 prefix is learned via internal
BGP (iBGP).
R3# show bgp ipv4 unicast | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 209.165.201.0/25 10.1.32.2 0 100 0 i
Close configuration window
Part 2: Configure Two-Way Redistribution on R1
In this part of the lab, you will perform mutual EIGRP-to-OSPF and OSPF-to-EIGRP redistribution on R1.

Step 1: Redistribute EIGRP 64512 into OSPF.


By default, EIGRP routes redistributed into OSPF will be seen as external Type 2 (E2) routes. In this step, you will
change the external Type 2 (E2) routes to external Type 1 (E1) routes and specify the subnets keyword.
Note: Best practice suggests always entering the keyword subnets. However, depending on the IOS version, the
keyword subnets may automatically be appended to the redistribute command in OSPFv2.
Open configuration window

R1(config)# router ospf 1


R1(config-router)# redistribute eigrp 64512 metric-type 1 subnets
R1(config-router)# exit
Close configuration window

Step 2: Verify One-Way Redistribution on R3.


a. Issue the show ip route ospf on R3 to see the external OSPF routes are Type 1 with a cost of 22. Both E1
routes originated from EIGRP AS 64512.
Open configuration window

R3# show ip route ospf | begin Gateway


Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
O IA 10.1.1.0/24 [110/17] via 10.1.23.2, 08:19:58, GigabitEthernet0/0/0
O E1 10.1.11.0/24 [110/22] via 10.1.23.2, 01:21:42, GigabitEthernet0/0/0
O 10.1.12.0/24 [110/2] via 10.1.23.2, 08:28:48, GigabitEthernet0/0/0
198.51.100.0/25 is subnetted, 1 subnets
O E1 198.51.100.0 [110/22] via 10.1.23.2, 01:21:42, GigabitEthernet0/0/0
Close configuration window

Step 3: Redistribute OSPF into EIGRP 64512.


By default, external EIGRP routes are given an administrative distance of 170 and a seed metric of infinity, which
prevents the installation of the redistributed routes into the EIGRP topology table. This default path metric can be
changed from infinity to a specific value for bandwidth, delay, reliability, load, and maximum transmission unit (MTU).
Redistribute OSPF into EIGRP 64512 and set the EIGRP K values as shown.
Open configuration window

R1(config)# router eigrp 64512


R1(config-router)# redistribute ospf 1 metric 1000000 10 255 1 1500
R1(config-router)# end
close configuration window

Step 4: Verify Two-Way Redistribution on D1.


Issue the show ip route eigrp | begin Gateway on D1 to see four external EIGRP routes from OSPF.
Open configuration window

D1# show ip route eigrp | begin Gateway


Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
D EX 10.1.1.0/24 [170/5376] via 10.1.11.1, 00:00:12, GigabitEthernet1/0/11
D EX 10.1.12.0/24
[170/5376] via 10.1.11.1, 00:00:12, GigabitEthernet1/0/11
D EX 10.1.23.0/24
[170/5376] via 10.1.11.1, 00:00:12, GigabitEthernet1/0/11
D EX 10.3.3.0/24 [170/5376] via 10.1.11.1, 00:00:12, GigabitEthernet1/0/11
Close configuration window

Part 3: Configure Two-Way Redistribution on R3


In this part of the lab you will perform OSPF-to-BGP and BGP-to-OSPF redistribution on R3.
Step 1: Redistribute OSPF into BGP.
By default, when configuring redistribution of OSPF into BGP without any keywords, only OSPF intra–area and inter–
area routes are redistributed. Your BGP configuration determines where the redistribute command is entered. When
using an address family, the redistribute command is entered in the address family configuration mode, otherwise it
is entered under the BGP process.
In this lab, the redistribute command is configured under the BGP IPv4 address family as shown. Notice that no
additional keywords or sub-commands are configured.
Open configuration window

R3(config)# router bgp 64532


R3(config-router)# address-family ipv4
R3(config-router-af)# redistribute ospf 1
R3(config-router-af)# exit
close configuration window

Step 2: Verify redistribution on D2.


a. Issue the show bgp ipv4 unicast on D2 to see the default behavior of OSPF being redistributed into BGP.
Notice that only intra-area and inter-area routes are redistributed. All routes redistributed into BGP have the origin
code set to incomplete (?) and the weight set to 32,768. Additionally, the MED / Metric value was set based on
the OSPF cost on R3. The 10.1.1.0/24 was the inter-area route and shows a Metric of 17. The 10.1.12.0/24 route
was an intra-area route with a Metric of 2. The 10.1.23.0/24 and 10.3.3.0/24 routes were directly connected via
OSPF and show a Metric of 0.
Open configuration window

D2# show bgp ipv4 unicast | begin Origin


Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path


*>i 10.1.1.0/24 10.1.23.2 17 100 0 ?
*>i 10.1.12.0/24 10.1.23.2 2 100 0 ?
*>i 10.1.23.0/24 0.0.0.0 0 100 0 ?
*>i 10.3.3.0/24 0.0.0.0 0 100 0 ?
*> 209.165.201.0/25 10.1.32.2 0 32768 i
Close configuration window

b. Next, on R3 issue the redistribute command again, and add the keyword match to redistribute internal and
external Type 1 OSPF routes into BGP.
Open configuration window

R3(config)# router bgp 64532


R3(config-router)# address-family ipv4
R3(config-router-af)# redistribute ospf 1 match internal external 1
R3(config-router-af)# exit
close configuration window

c. Issue the show bgp ipv4 unicast on D2, as shown, to see the two external OSPF routes redistributed into BGP.
Notice the metric of 22 and origin code of incomplete (?). Remember that both prefixes originated in EIGRP AS
Open configuration window
64512.
D2# show bgp ipv4 unicast | begin Network
Network Next Hop Metric LocPrf Weight Path
*>i 10.1.1.0/24 10.1.32.3 17 100 0 ?
*>i 10.1.11.0/24 10.1.32.3 22 100 0 ?
*>i 10.1.12.0/24 10.1.32.3 2 100 0 ?
*>i 10.1.23.0/24 10.1.32.3 0 100 0 ?
*>i 10.3.3.0/24 10.1.32.3 0 100 0 ?
*>i 198.51.100.0/25 10.1.32.3 22 100 0 ?
*> 209.165.201.0/25 0.0.0.0 0 32768 i
close configuration window

Step 3: Redistribute BGP into OSPF.


In this step of the lab, you will redistribute BGP into OSPF.
Note: BGP is designed to support a large routing table, whereas, IGP’s are not. Redistribution of BGP into an IGP on
a router with a larger BGP routing table (for example the internet table with 800,000 plus routes) should use selective
route redistribution. Otherwise the IGP can become unstable in the routing domain, which can lead to packet loss.
When redistributing BGP into OSPF, internal BGP routes are not redistributed, by default.
On R3 redistribute BGP into OSPF as shown, adding the subnets keyword and leaving the default OSPF external
Type 2.
Open configuration window

R3(config)# router ospf 1


R3(config-router)# redistribute bgp 64532 subnets
R3(config-router)# exit
close configuration window

Step 4: Verify Redistribution of BGP into OSPF on R1.


Issue the show ip route ospf on R1. Notice the internal BGP prefix 209.165.201.0/25 was not redistributed and
missing from the OSPF routing table. Normally only external BGP routes are redistributed. However, in this lab there
are no eBGP routes.
Open configuration window

R1# show ip route ospf | begin Gateway


Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks


O 10.1.23.0/24 [110/2] via 10.1.12.2, 03:49:00, GigabitEthernet0/0/0
O 10.3.3.0/24 [110/3] via 10.1.12.2, 03:49:00, GigabitEthernet0/0/0
close configuration window

Step 5: Allow iBGP routes to be redistributed into OSPF.


To allow internal BGP routes to be redistributed into OSPF requires the bgp redistribute-internal command. This
command is issued within the BGP address family process for IPv4, as shown.
Open configuration window

R3(config)# router bgp 64532


R3(config-router)# address-family ipv4
R3(config-router-af)# bgp redistribute-internal
R3(config-router-af)# end
close configuration window

Step 6: Verify Redistribution of iBGP into OSPF on R1.


a. Issue the show ip route ospf on R1 to see the OSPF external Type 2 (E2) route from BGP. Notice the default
seed metric of 1 for BGP routes redistributed into OSPF.
Open configuration window

R1# show ip route ospf | begin Gateway


Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks


O 10.1.23.0/24 [110/2] via 10.1.12.2, 04:12:12, GigabitEthernet0/0/0
O 10.3.3.0/24 [110/3] via 10.1.12.2, 04:12:12, GigabitEthernet0/0/0
209.165.201.0/25 is subnetted, 1 subnets
O E2 209.165.201.0 [110/1] via 10.1.12.2, 00:00:06, GigabitEthernet0/0/0
close configuration window

b. From D2 ping the 198.51.100.1 address on D1 using the Loopback 0 address on D2. The ping should be
successful. This verifies full end-to-end connectivity and successful redistribution on R1 and R3.
Open configuration window

D2# ping 198.51.100.1 source 209.165.201.1


Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.1, timeout is 2 seconds:
Packet sent with a source address of 209.165.201.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/4 ms
close configuration window
Part 4: Filter and Verify Redistribution using a Prefix List and Route Map
In this part of the lab, you will use a prefix list and router map on R3 to filter specific OSPF prefixes from being
redistributed into BGP.

Step 1: Create a prefix list named LOOPBACK and specify the action for each statement.
Permit only the Loopback addresses on D1, R1 and R3, as shown. The last sequence 20 statement filters all other
prefixes. If not explicitly set, the deny statement is implied similar to using an ACL.
Open configuration window

R3(config)# ip prefix-list LOOPBACK seq 5 permit 198.51.100.0/25


R3(config)# ip prefix-list LOOPBACK seq 10 permit 10.1.1.0/24
R3(config)# ip prefix-list LOOPBACK seq 15 permit 10.3.3.0/24
R3(config)# ip prefix-list LOOPBACK seq 20 deny 0.0.0.0/0 le 32

Step 2: Apply the IP prefix list using a route map.


Create a route map named OSPF-into-BGP. Next, apply the prefix-list LOOPBACK to the route map which allows
redistribution of prefixes into BGP. Any prefixes matching the named prefix list LOOPBACK with a permit statement,
will be redistributed into BGP.
R3(config)# route-map OSPF-into-BGP permit 10
R3(config-route-map)# match ip address prefix-list LOOPBACK
R3(config-route-map)# exit

Step 3: Apply the route map to the redistribute command.


Apply the route map named OSPF-into-BGP at the end of the redistribute command, as shown.
R3(config)# router bgp 64532
R3(config-router)# address-family ipv4
R3(config-router-af)# redistribute ospf 1 match internal external 1 route-map OSPF-
into-BGP
R3(config-router-af)# end

Step 4: Verify Redistribution Filtering.


a. Issue the show ip prefix-list detail command on R3 to verify the hit count for each sequence in the prefix list.
Notice in our example each Loopback address has 2 hits, while the deny statement has 6 hits.
R3# show ip prefix-list detail
Prefix-list with the last deletion/insertion: LOOPBACK
ip prefix-list LOOPBACK:
count: 4, range entries: 1, sequences: 5 - 20, refcount: 3
seq 5 permit 198.51.100.0/25 (hit count: 2, refcount: 1)
seq 10 permit 10.1.1.0/24 (hit count: 2, refcount: 1)
seq 15 permit 10.3.3.0/24 (hit count: 2, refcount: 2)
seq 20 deny 0.0.0.0/0 le 32 (hit count: 6, refcount: 1)
close configuration window

b. Issue the show bgp ipv4 unicast to verify filtering of OSPF prefixes into BGP. Notice only the Loopback
addresses on D1, R1 and R3 are redistributed into BGP.
Open configuration window

D2# show bgp ipv4 unicast | begin Network


Network Next Hop Metric LocPrf Weight Path
*>i 10.1.1.0/24 10.1.32.3 17 100 0 ?
*>i 10.3.3.0/24 10.1.32.3 0 100 0 ?
*>i 198.51.100.0/25 10.1.32.3 22 100 0 ?
*> 209.165.201.0/25 0.0.0.0 0 32768 i
c. From D2 ping the 198.51.100.1 address on D1. The ping should not be successful.
D2# ping 198.51.100.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
d. From D2 ping the 198.51.100.1 address on D1 using the Loopback 0 address on D2. The ping should be
successful. This verifies full end-to-end connectivity and successful redistribution on R1 and R3 as well as
redistribution filtering on R3 using a prefix list and route map.
D2# ping 198.51.100.1 source 209.165.201.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 198.51.100.1, timeout is 2 seconds:
Packet sent with a source address of 209.165.201.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/4 ms
close configuration window

Reflection Questions
1. Why does the ping to 198.51.100.1 fail when you do not specify the source Loopback 209.165.201.1 on D2?
The ping from D2 uses the source address of 10.1.32.2 which is not an iBGP nor eBGP route. Therefore, this
prefix is not being redistributed into OSPF. The ICMP echo reaches D1 but the ICMP echo-reply is being
dropped by D1 since the 10.1.32.0/24 prefix in not in the routing table on D1.
2. By default, routes redistributed into BGP have the origin code, weight, and MED have which values?
The origin code is set to incomplete or ?, the weight is 32,768 and the MED is based on the IGP metric unless
directly connected, which is given a MED value of 0.
3. By default, which OSFP prefixes are redistributed into BGP using the redistribute ospf 1 command?
Only classful intra-area and inter-area prefixes are redistributed into BGP.
4. Redistributed routes into OSPF have a metric of 20, with the exception of redistributed BGP routes which has a seed
metric of _____ ?
one

You might also like