HCIP——routing policy experiment (two-way redistribution)

1. Experimental requirements

1. Multipoint two-way redistribution between two protocols

2. The loopback of R7 is not announced in the OSPF protocol, but republished and entered later

3. To solve the loop, all paths are selected optimally, and there are backups 

2. Experimental topology 

 

 3. Experimental process

1. Configure the IP address

R1:

[Huawei]sys
[Huawei]sys R1
[R1]int g0/0/0 
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
[R1]int lo0
[R1-LoopBack0]ip add 1.1.1.1 24

 R2:

[Huawei]sys
[Huawei]sys R2
[R2]int g0/0/0 
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 24.1.1.1 24
[R2]int lo0
[R2-LoopBack0]ip add 2.2.2.2 24

R3:

[Huawei]sys
[Huawei]sys R3
[R3]int g0/0/0 
[R3-GigabitEthernet0/0/0]ip add 34.1.1.1 24
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 13.1.1.2 24
[R3]int lo0
[R3-LoopBack0]ip add 3.3.3.3 24

R4:

[Huawei]sys
[Huawei]sys R4
[R4]int g0/0/0 
[R4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 24.1.1.2 24
[R4]int g0/0/2
[R4-GigabitEthernet0/0/2]ip add 45.1.1.1 24
[R4]int lo0
[R4-LoopBack0]ip add 4.4.4.4 24

R5:

[Huawei]sys
[Huawei]sys R5
[R5]int g0/0/0 
[R5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
[R5]int lo0
[R5-LoopBack0]ip add 5.5.5.5 24

R6:

[Huawei]sys
[Huawei]sys R6
[R6]int g0/0/0 
[R6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
[R6]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 67.1.1.1 24
[R6]int lo0
[R6-LoopBack0]ip add 6.6.6.6 24

R7:

[Huawei]sys
[Huawei]sys R7
[R7]int g0/0/0 
[R7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
[R7-GigabitEthernet0/0/0]int lo0
[R7-LoopBack0]ip add 7.7.7.7 24

2. Configure routing (start rip and ospf)

R1:

[R1}rip 1
[R1-rip-1]ver 2
[R1-rip-1]network 12.0.0.0
[R1-rip-1]network 13.0.0.0
[R1-rip-1]network 1.0.0.0

R2:

[R2]rip
[R2-rip-1]ver 2
[R2-rip-1]network 12.0.0.0
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1]network 24.1.1.0 0.0.0.255
[R2-ospf-1]network 2.2.2.2 0.0.0.0

R3:

[R3]rip
[R3-rip-1]ver 2
[R3-rip-1]network 13.0.0.0
[R3-rip-1]q
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1]network 34.1.1.0 0.0.0.255
[R3-ospf-1]network 3.3.3.3 0.0.0.0

R4:

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1]network 24.1.1.0 0.0.0.255
[R4-ospf-1]network 34.1.1.0 0.0.0.255
[R4-ospf-1]network 45.1.1.0 0.0.0.255
[R4-ospf-1]network 4.4.4.4 0.0.0.0

R5:

[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1]network 45.1.1.0 0.0.0.255
[R5-ospf-1]network 56.1.1.0 0.0.0.255
[R5-ospf-1]network 5.5.5.5 0.0.0.0

R6:

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1]network 56.1.1.0 0.0.0.255
[R6-ospf-1]network 67.1.1.0 0.0.0.255
[R6-ospf-1]network 6.6.6.6 0.0.0.0

R7:

[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1]network 67.1.1.0 0.0.0.255

3. Republish the loopback of R7 and enter the ospf area

R7:

[R7]ospf 1
[R7-ospf-1]import-route direct

4. Double-point two-way redistribution of R2 and R3

R2:

[R2]ospf 1
[R2-ospf-1]import-route rip 1
[R2-ospf-1]q
[R2]rip 1
[R2-rip-1]import-route ospf 1

R3:

[R3]ospf 1
[R3-ospf-1]import-route rip 1
[R3-ospf-1]q
[R3]rip 1
[R3-rip-1]import-route ospf 1

5. Solve the routing feedback problem (routing feedback: one is the /32 route learned inside OSPF, the other is R3 redistributed into rip, and then R2 redistributed into OSPF to learn the /24 route, resulting in route feedback .)

Modify the working mode of the loopback OSPF interface of R3 to broadcast

[r3]int lo0
[r3-LoopBack0]ospf network-type broadcast

6. Solve the routing loop problem

Cause of loop out: When R7 advertises its direct route to the OSPF protocol, the preference of this route is 150. In Huawei equipment, the priority of OSPF is 10, and the priority of rip is 100. Republish OSPF The subsequent priority is 150, so after R7 republishes the route, R2 republishes it to the RIP protocol, and then RIP launders it and republishes it to the OSPF protocol, making the original 150 priority become 100 , so the R4 router chooses to trust the route with a priority of 100 published by R3, resulting in a loop. Therefore, on R5, there is a load balance to reach R7, pointing to R4 and R6 respectively.
R2:

[R2]ip ip-prefix a index 10 permit 7.7.7.0 24   //创建名为a 序号为10的前缀列表抓取流量
[R2]route-policy b permit node 10  //创建名为b,大动作为允许,序号为10的路由策略
[R2]if-match ip-prefix a     //匹配名为a的前缀列表
[R2]apply preference 151   //定义小动作为修改优先级为151
[R2]rip 1
[R2-rip-1]preference route-policy b  //进入RIP调用名为b的路由策略修改优先级

R3:

[R3]ip ip-prefix a index 10 permit 7.7.7.0 24   
[R3]route-policy b permit node 10  
[R3]if-match ip-prefix a    
[R3]apply preference 151    
[R3]rip 1
[R3-rip-1]preference route-policy b

7. Optimize routing

R2:

[R2]ip ip-prefix qq permit 3.3.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

[R2]ip ip-prefix z permit 12.1.1.0 24
[R2]ip ip-prefix z permit 2.2.2.0 24
[R2]route-policy z permit node 10
[R2-route-policy]if-match ip-prefix z
[R2-route-policy]apply cost-type type-1
[R2-route-policy]q	
[R2]route-policy z permit node 20

R3:

[R3]ip ip-prefix hh index 10 permit 24.1.1.0 24
[R3]interface GigabitEthernet0/0/1
[R3-GigabitEthernet0/0/1]rip metricout ip-prefix hh 2

[R3]ip ip-prefix z permit 13.1.1.0 24
[R3]ip ip-prefix z permit 3.3.3.0 24
[R3]route-policy z permit node 10
[R3-route-policy]if-match ip-prefix z
[R3-route-policy]apply cost-type type-1
[R3-route-policy]q	
[R3]route-policy z permit node 20

Guess you like

Origin blog.csdn.net/qq_63099085/article/details/128879203