Network Requirements
- Set up OSPF neighbors between Device3 and Device2, and advertise interface direct-connect route 200.0 0.0/24 to Device2.
- Set up EBGP neighbors between Device1 and Device2, and redistribute the OSPF route that Device2 learns to BGP and advertise the route to Device1.
Network Topology
![Networking for configuring BGP to redistribute routes](/storage/images/Document/Maipu/unicast-routing/bgp-redistribute-route.jpg)
Figure 12–2 Networking for configuring BGP to redistribute routes
Configuration Steps
Step 1: Configure the VLAN and join the interface to the corresponding VLAN. (Omitted)
Step 2: Configure the IP addresses of the interfaces. (Omitted)
Step 3: Configure OSPF so that loopback routes are reachable between devices.
#Configure Device2.
Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#network 2.0.0.0 0.0.0.255 area 0
Device2(config-ospf)#exit
|
#Configure Device3.
Device3#configure terminal
Device3(config)#router ospf 100
Device3(config-ospf)#network 200.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#network 2.0.0.0 0.0.0.255 area 0
Device3(config-ospf)#exit
|
#Query the routing table of Device2.
Device2#show ip route ospf
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS
U - Per-user Static route
O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external
O 200.0.0.0/24 [110/2] via 2.0.0.2, 00:01:45, vlan3
According to the routing table, Device2 has learnt the OSPF route 200.0.0.0/24 that has been advertised by Device3.
Step 4: Configure BGP.
#Configure Device1.
Device1#configure terminal
Device1(config)#router bgp 200
Device1(config-bgp)#neighbor 1.0.0.2 remote-as 100
Device1(config-bgp)#exit
|
#Configure Device2.
Device2(config)#router bgp 100
Device2(config-bgp)#neighbor 1.0.0.1 remote-as 200
Device2(config-bgp)#exit
|
#On Device2, check the BGP neighbor status.
Device2#show ip bgp summary
BGP router identifier 2.0.0.1, local AS number 100 BGP table version is 2
1 BGP AS-PATH entries 0 BGP community entries
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
1.0.0.1 4 200 2 2 2 0 0 00:00:42 0
BGP neighbors have been successfully set up between Device2 and Device1.
Step 5: Configure BGP to redistribute the OSPF route.
#Configure Device2.
Device2(config)#router bgp 100
Device2(config-bgp)#redistribute ospf 100
Device2(config-bgp)#exit
|
Step 6: Check the result.
#Query the BGP routing table of Device2.
Device2#show ip bgp
BGP table version is 6, local router ID is 2.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
[O]*> 2.0.0.0/24 0.0.0.0 1 32768 ?
[O]*> 200.0.0.0/24 2.0.0.2 2 32768 ?
According to the queried information, OSPF routes have been successfully redistributed to BGP.
#Query the routing table of Device1.
Device1#show ip route bgp
Codes: C - Connected, L - Local, S - static, R - RIP, B BGP, i-ISIS
U Per-user Static route
O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX IRMP external
B 2.0.0.0/24 [20/1] via 1.0.0.2, 00:06:14, vlan2
B 200.0.0.0/24 [20/2] via 1.0.0.2, 00:06:14, vlan2
According to the queried information, Device1 has successfully learnt routes 2.0.0.0/24 and 200.0.0.0/24.
![note](/storage/images/Document/Maipu/note-icon.jpg)
-
In an actual application, if there are two or more AS boundary routers, it is recommended that you do not redistribute routes between different routing protocols. If route redistribution must be configured, you are required to configure route control policies such as route filtering and filtration summary on the AS boundary routers to prevent routing loops.