Hello, in this post we are gonna to introduce an example to redistribute the OSPF bidirectional between dual-point, it could help us understand the anti-loop mechanism in ospf
Topology and Description
![]()
1. The network topology and IP addresses are shown in the preceding figure.
2. The addresses of interconnected interfaces are in the format of 192.168.xy.0/24, where x and y are device IDs. For example, the network segment of the link between R1 and R3 is 192.168.13.0/24, the interface address of R1 is 192.168.13.1, and the interface address of R3 is 192.168.13.3. That is, the last octet of the IP address is the ID of the local device.
Requirements
1. Configure OSPF on R1, R2, and R3, and configure RIPv2 on R2, R3, and R4.
2. Configure a loopback 0 interface on R1, set its IP address to 1.1.1.1/32, and import the direct route of this interface to OSPF.
3. Perform bidirectional route redistribution on R2 and R3. That is, import OSPF routes to RIP and import RIP routes to OSPF. It is required that the network segments in each routing domain be reachable through routes of the corresponding routing protocol and no sub-optimal paths be allowed.
Experiment Procedure and Configurations
1. Perform basic configurations for all routers.
R1 configurations:
[R1] interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0] ip address 192.168.12.1 24
[R1] interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1] ip address 192.168.13.1 24
[R1] interface loopback0
[R1-LoopBack0] ip address 1.1.1.1 32
[R1] ospf 1 router-id 1.1.1.1
[R1-ospf-1] import-route direct
[R1-ospf-1] area 0
[R1-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0] network 192.168.13.0 0.0.0.255
R2 configurations:
[R2] interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0] ip address 192.168.12.2 24
[R2] interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1] ip address 192.168.24.2 24
[R2] ospf 1 router-id 2.2.2.2
[R2-ospf-1] area 0
[R2-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0] quit
[R2] rip
[R2-rip-1] version 2
[R2-rip-1] undo summary
[R2-rip-1] network 192.168.24.0
R3 configurations:
[R3] interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0] ip address 192.168.13.3 24
[R3] interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1] ip address 192.168.34.3 24
[R3] ospf 1 router-id 3.3.3.3
[R3-ospf-1] area 0
[R3-ospf-1-area-0.0.0.0] network 192.168.13.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0] quit
[R3] rip
[R3-rip-1] version 2
[R3-rip-1] undo summary
[R3-rip-1] network 192.168.34.0
R4 configurations:
[R4] interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0] ip address 192.168.24.4 24
[R4] interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1] ip address 192.168.34.4 24
[R4] rip
[R4-rip-1] version 2
[R4-rip-1] undo summary
[R4-rip-1] network 192.168.24.0
[R4-rip-1] network 192.168.34.0
2. Perform bidirectional route redistribution on R2 and R3.
![]()
R2 configurations:
[R2] ospf 1
[R2-ospf-1] import-route rip
[R2] rip
[R2-rip-1] import-route ospf 1
R3 configurations:
[R3] ospf 1
[R3-ospf-1] import-route rip
[R3] rip
[R3-rip-1] import-route ospf 1
After performing the preceding configurations, check the routing table of each device.
<R1> display ip routing-table protocol ospf
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.24.0/24 O_ASE 150 1 D 192.168.12.2 GigabitEthernet0/0/0
O_ASE 150 1 D 192.168.13.3 GigabitEthernet0/0/1
192.168.34.0/24 O_ASE 150 1 D 192.168.12.2 GigabitEthernet0/0/0
O_ASE 150 1 D 192.168.13.3 GigabitEthernet0/0/1
In the routing table of R1, the two RIP routes 192.168.24.0/24 and 192.168.23.0/24 participate in load balancing through R2 and R3. This is normal because the two RIP routes are imported to OSPF on R2 and R3 and have the same cost (1 by default).
<R4> display ip routing-table protocol rip
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 RIP 100 1 D 192.168.24.2 GigabitEthernet0/0/0
192.168.12.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet0/0/0
RIP 100 1 D 192.168.34.3 GigabitEthernet0/0/1
192.168.13.0/24 RIP 100 1 D 192.168.24.2 GigabitEthernet0/0/0
RIP 100 1 D 192.168.34.3 GigabitEthernet0/0/1
According to the routing table of R4, the two OSPF routes 192.168.12.0/24 and 192.168.13.0/24 participate in load balancing on R4. However, R4 has only one route to 1.1.1.1/32, and the next hop of the route is R2. What about R3? Information about the routing table on R3 is shown as follows:
<R3>display ip routing-table
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 RIP 100 2 D 192.168.34.4 GigabitEthernet0/0/1
192.168.12.0/24 OSPF 10 2 D 192.168.13.1 GigabitEthernet0/0/0
192.168.24.0/24 RIP 100 1 D 192.168.34.4 GigabitEthernet0/0/1
(Some output is omitted here.)
In the routing table of R3, the route 1.1.1.1/32 is originated from RIP, which is supposed to be OSPF. R3 is supposed to use an OSPF route with the next hop being R1 to communicate with 1.1.1.1/32. However, the displayed route is a RIP route, with the next hop being R4. In this case, R3 accesses 1.1.1.1/32 through a sub-optimal path R4 > R2 > R1.
Why does this problem occur? Why is only the OSPF external route 1.1.1.1/32 abnormal?
The priority of RIP is 100, whereas OSPF has two priorities: 10 (internal route priority) and 150 (external route priority). The process of route import from RIP to OSPF is analyzed as follows: R2 and R3 learn the routes in the RIP domain and add the routes to their routing tables. The priorities of the routes are 100. After the RIP routes are imported to OSPF on R2, the routes are also transmitted to R3 through OSPF. The same situation applies to R3. Take R3 as an example. The route 192.168.24.0/24 is learned both from RIP and OSPF. In this case, R3 compares the priorities of OSPF and RIP. The route is flooded in OSPF in the form of a Type-5 LSA (external route). Therefore, the priority of the OSPF external route is 150, whereas the priority of the RIP route is 100. The smaller the priority value, the higher the priority. Therefore, R3 selects the RIP route, which is correct.
The process of route import from OSPF to RIP is analyzed as follows: R3 is used as an example. After R3 learns the OSPF internal route 192.168.12.0/24, it adds the route to its routing table. The priority of the route is 10. In addition, route import from OSPF to RIP is deployed on R2. In this case, R3 learns the route from RIP and compares the priorities of the two types of routes. The priority of the OSPF internal route is 10 and that of the RIP route is 100. Therefore, the OSPF route is preferred, and no sub-optimal path problem occurs in the OSPF domain. For the external route 1.1.1.1/32, on the one hand, R3 learns it through OSPF and adds it to the routing table. The priority of the route is 150. On the other hand, R3 learns the route from RIP, and its priority is 100. In this case, R3 prefers the RIP route, which is a sub-optimal route.
![]()
3. Resolve the sub-optimal path problem.
Dual-point bidirectional route redistribution networking is prone to routing loops or sub-optimal path problems. There are many ways to resolve the problem. For example, we can change the route priority. On R2 and R3, create an IP prefix list 1 to match the OSPF external route 1.1.1.1/32, configure a route-policy ase in which the if-match clause is based on the IP prefix list and the apply clause is to set the priority of the route to 99 (smaller than the priority value of the RIP route), and run the preference ase command with the route-policy specified in the OSPF view to change the priority of the external route.
R2 configurations:
[R2] ip ip-prefix 1 permit 1.1.1.1 32
[R2] route-policy ase_policy permit node 10
[R2-route-policy] if-match ip-prefix 1
[R2-route-policy] apply preference 99
[R2] ospf 1
[R2-ospf-1] preference ase route-policy ase_policy
R3 configurations:
[R3] ip ip-prefix 1 permit 1.1.1.1 32
[R3] route-policy ase_policy permit node 10
[R3-route-policy] if-match ip-prefix 1
[R3-route-policy] apply preference 99
[R3] ospf 1
[R3-ospf-1] preference ase route-policy ase_policy
After performing the preceding configurations, check the routing tables of R2 and R3.
[R2] display ip routing-table
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 O_ASE 99 1 D 192.168.12.1 GigabitEthernet0/0/0
192.168.13.0/24 OSPF 10 2 D 192.168.12.1 GigabitEthernet0/0/0
192.168.34.0/24 RIP 100 1 D 192.168.24.4 GigabitEthernet0/0/1
[R3]display ip routing-table
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 O_ASE 99 1 D 192.168.13.1 GigabitEthernet0/0/0
192.168.12.0/24 OSPF 10 2 D 192.168.13.1 GigabitEthernet0/0/0
192.168.24.0/24 RIP 100 1 D 192.168.34.4 GigabitEthernet0/0/1
The routing tables of R2 and R3 are normal.
That's all for this post, hope you guys enjoy this, if you have any features want to learn or any questions, please describe it.
If you are searching for more information, you can visit our support website ( click here ) or KB ( click here )

