Republishing Routing Policy Experiment
Experimental requirements
Experimental procedure
1. IP Planning
Because this experiment does not require specific IP planning, the public address configuration is directly used between the routers, and the loopback interface is divided into the 192.168.0.0/32 network segment.
After division
2. Configuration Protocol
Configure the RIP protocol on the left, take AR1 as an example
[r1]rip 1
[r1-rip-1] undo summary
[r1-rip-1]version 2
[r1-rip-1] network 192.168.1.0
[r1-rip-1] network 12.0.0.0
[r1-rip-1] network 13.0.0.0
Configure OSPF on the right, take AR4 as an example
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1] area 0.0.0.0
[r4-ospf-1-area-0.0.0.0] network 24.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0] network 34.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0] network 45.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0] network 192.168.4.0 0.0.0.255
3. Republishing process
Because the loopback of AR7 is not in the OSPF area, it needs to be republished
[r7]ospf 1
[r7-ospf-1]import-route direct
Two-way republish on AR2 and AR3 respectively
[r2]ospf 1
[r2-ospf-1]import-route rip 1
[r2]rip 1
[r2-rip-1]import-route ospf 1
[r3]ospf 1
[r3-ospf-1]import-route rip 1
[r3]rip 1
[r3-rip-1]import-route ospf 1
4. Solve the loop
After configuration, check the routing table of AR2 and find that two loopbacks from AR3 will be received. The
reason is that their network segments are different, so the router thinks that they are two different routes.
Solution:
Change the network interface type to broadcast on the loopback interface on AR3
[r3-LoopBack0]ospf network-type broadcast
When checking the routing table of AR1/2/3/4, it is found that the loopback of AR7 will cause a loop
Reason: When AR7 routes are re-advertised to AR3, the RIP priority is 100 and the OSPF priority is 150, so AR3 only learns the routes on the RIP side, which leads to a loop.
Solution:
Change the learning priority of the left RIP to the AR7 loopback to 151, which is higher than the right priority, so that the left will not be selected when routing.
[r3]ip ip-prefix a permit 192.168.7.0 24
[r3]route-policy q permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix a
[r3-route-policy]apply preference 151
[r3-rip-1]preference route-policy q
Note: If [r3-rip-1]preference 151 route-policy q will cause all rip routes to become 151.
If you want to view the rip route with a priority of 151, you can first check the interface port of the 34 network segment.
5. Choose the best route
By looking at the routing table of AR1, it is found that the loopback from AR1 to network segment 34 and 3 should not be load balancing.
Solution:
Increase the metric for the RIP route sent to the AR, so that no load balancing occurs during routing.
on AR2
[r2]ip ip-prefix qq permit 192.168.3.0 24
[r2]ip ip-prefix qq permit 34.1.1.0 24
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]rip metricout ip-prefix qq 2
on AR3
[r3]ip ip-prefix qq permit 24.1.1.0 24
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]rip metricout ip-prefix qq 2
Check the routing table after the solution
By checking the routing table of AR4, it is found that the network segments from AR4 to 12 and 13 should not be load balanced.
Solution:
Use the prefix list to grab the route, and change the route of the 12/13 network segment to type 1, so that ospf will preferentially select the type 2 route when selecting the route to prevent load balancing.
on AR2
[r2]ip ip-prefix bb permit 12.1.1.0 24
[r2]ip ip-prefix bb permit 192.168.2.0 24
[r2]route-policy bb permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-match ip-prefix bb
[r2-route-policy]apply cost-type type-1
[r2-route-policy]q
[r2]route-policy bb permit node 20
Info: New Sequence of this List.
[r2-route-policy]q
[r2]ospf 1
[r2-ospf-1]import-route rip route-policy bb
on AR3
[r3]ip ip-prefix bb permit 13.1.1.0 24
[r3]route-policy bb permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match ip-prefix bb
[r3-route-policy]apply cost-type type-1
[r3-route-policy]q
[r3]route-policy bb permit node 20
Info: New Sequence of this List.
[r3-route-policy]q
[r3]ospf 1
[r3-ospf-1]import-route rip 1 route-policy bb
After modification, check the routing table of AR1 and AR4, and the load balancing has been eliminated.