Network Requirements
- OSPF runs between Device1 and Device2. Device2 learns OSPF routes 100.0.0.0/24 and 200.0.0.0/24 advertised by Device1.
- RIPv2 runs between Device2 and Device3. Device2 redistributes OSPF route 100.0.0.0/24 to RIP and advertises the route to Device3.
Network Topology
Figure 5-2 Networking for Configuring RIP to Redistribute Routes
Configuration Steps
Step 1: Create VLANs, and add ports to the required VLANs. (Omitted)
Step 2: Configure IP addresses for the ports. (Omitted)
Step 3: Configure OSPF.
#Configure Device1.
Device1#configure terminal
Device1(config)#router ospf 100
Device1(config-ospf)#network 1.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#network 100.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#network 200.0.0.0 0.0.0.255 area 0
Device1(config-ospf)#exit
|
#Configure Device2.
Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#network 1.0.0.0 0.0.0.255 area 0
Device2(config-ospf)#exit
|
#Query the routing table of Device2.
Device2#show ip route
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
C 1.0.0.0/24 is directly connected, 00:23:06, vlan2
C 2.0.0.0/24 is directly connected, 00:13:06, vlan3
O 100.0.0.0/24 [110/2] via 1.0.0.1, 00:04:12, vlan2
C 127.0.0.0/8 is directly connected, 76:51:00, lo0
O 200.0.0.0/24 [110/2] via 1.0.0.1, 00:04:12, vlan2
According to the routing table, Device2 has learnt the OSPF routes that have been advertised by Device1.
Step 4: Configure RIP.
#Configure Device2.
Device2(config)#router rip
Device2(config-rip)#version 2
Device2(config-rip)#network 2.0.0.0
Device2(config-rip)#exit
|
#Configure Device3.
Device3#configure terminal
Device3(config)#router rip
Device3(config-rip)#version 2
Device3(config-rip)#network 2.0.0.0
Device3(config-rip)#exit
|
Step 5: Configure the routing policy.
#On Device2, configure route-map to invoke ACL to match 100.0.0.0/24 and filter 200.0.0.0/24.
Device2(config)#ip access-list standard 1
Device2(config-std-nacl)#permit 100.0.0.0 0.0.0.255
Device2(config-std-nacl)#commit
Device2(config-std-nacl)#exit
Device2(config)#route-map OSPFtoRIP
Device2(config-route-map)#match ip address 1
Device2(config-route-map)#exit
|
-
In configuring a routing policy, you can create a filtration rule based on a prefix list or ACL. The prefix list can precisely match routing masks while the ACL cannot match routing masks.
Step 6: Configure RIP to redistribute routes.
#Configure Device2.
Device2(config)#router rip
Device2(config-rip)#redistribute ospf 100 route-map OSPFtoRIP
Device2(config-rip)#exit
|
Step 7: Check the result.
#Query the RIP routing table of Device2.
Device2#show ip rip database
Types: N - Network, L - Learn, R - Redistribute, D - Default config, S - Static config
Proto: C - connected, S - static, R - RIP, O - OSPF, E - IRMP,
o - SNSP, B - BGP, i-ISIS
RIP routing database in VRF kernel (Counter 3):
T/P Network ProID Metric Next-Hop From Time Tag Interface
N/C 2.0.0.0/24 none 1 --------------------0 vlan3
R/O 100.0.0.0/24 1 1 1.0.0.1 0 vlan2
#Query the routing table of Device3.
Device3#show ip route
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
C 2.0.0.0/24 is directly connected, 00:23:06, vlan2
R 100.0.0.0/24 [120/1] via 2.0.0.1, 00:13:26, vlan2
C 127.0.0.0/8 is directly connected, 76:51:00, lo0
By querying the RIP routing table on Device2 and the querying the routing table on Device3, it is found that route 100.0.0.0/24 on Device2 has been redistributed to RIP and route 200.0.0.0/24 has been successfully filtered out.
-
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 filtration and filtration summary on the AS boundary routers to prevent routing loops.