hcip的重发布实验(2)

题目

在这里插入图片描述

拓扑图

在这里插入图片描述

IP地址和环回的配置

R1

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]int l0
[r1-LoopBack0]ip add 1.1.1.1 24
[r1-LoopBack0]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
Aug  9 2023 10:38:48-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
Aug  9 2023 10:39:00-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r1-GigabitEthernet0/0/1]q
[r1]

R2

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r2
[r2]int l0
[r2-LoopBack0]ip add 2.2.2.2 24
[r2-LoopBack0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 12.1.1.2 24
Aug  9 2023 10:39:25-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r2-GigabitEthernet0/0/1]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 24.1.1.1 24
[r2-GigabitEthernet0/0/0]
Aug  9 2023 10:39:37-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r2-GigabitEthernet0/0/0]q
[r2]

R3

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r3
[r3]int l0
[r3-LoopBack0]ip add 3.3.3.3 24
[r3-LoopBack0]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 13.1.1.2 24
Aug  9 2023 10:40:10-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[r3-GigabitEthernet0/0/1]
Aug  9 2023 10:40:26-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r3-GigabitEthernet0/0/1]q
[r3]

R4

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r4
[r4]int l0
[r4-LoopBack0]ip add 4.4.4.4 24
[r4-LoopBack0]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 34.1.1.1 24
Aug  9 2023 10:40:54-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 24.1.1.2 24
[r4-GigabitEthernet0/0/1]
Aug  9 2023 10:41:08-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 45.1.1.1 24
[r4-GigabitEthernet0/0/2]
Aug  9 2023 10:41:24-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[r4-GigabitEthernet0/0/2]q
[r4]

R5

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r5
[r5]int l0
[r5-LoopBack0]ip add 5.5.5.5 24
[r5-LoopBack0]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
Aug  9 2023 10:41:58-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
Aug  9 2023 10:42:08-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r5-GigabitEthernet0/0/1]q
[r5]

R6

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r6
[r6]int l0
[r6-LoopBack0]ip add 6.6.6.6 24
[r6-LoopBack0]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
Aug  9 2023 10:42:41-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 67.1.1.1 24
Aug  9 2023 10:42:51-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r6-GigabitEthernet0/0/1]q
[r6]

R7

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r7
[r7]int l0
[r7-LoopBack0]ip add 7.7.7.7 24
[r7-LoopBack0]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
Aug  9 2023 10:43:21-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r7-GigabitEthernet0/0/0]q
[r7]

宣告

R1

[r1]
[r1]rip 1
[r1-rip-1]vers	
[r1-rip-1]version 2
[r1-rip-1]net	
[r1-rip-1]network 1.0.0.0
[r1-rip-1]network 12.0.0.0
[r1-rip-1]network 13.0.0.0
[r1-rip-1]

R2

[r2]rip 1
[r2-rip-1]vers	
[r2-rip-1]version 2
[r2-rip-1]net	
[r2-rip-1]network 2.0.0.0
[r2-rip-1]network 12.0.0.0
[r2-rip-1]q
[r2]ospf 1 rou	
[r2]ospf 1 router-id 2.2.2.2 
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net	
[r2-ospf-1-area-0.0.0.0]network 24.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]

R3

[r3]rip 1
[r3-rip-1]vers	
[r3-rip-1]version 2
[r3-rip-1]net	
[r3-rip-1]network 13.0.0.0
[r3-rip-1]q
[r3]ospf 1 rou	
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net	
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]

R4

[r4]ospf 1 rou	
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]net	
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 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

R5

[r5]ospf 1 rou	
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]net	
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 45.1.1.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 56.1.1.0 0.0.0.255

R6

[r6]ospf 1 rou	
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]net	
[r6-ospf-1-area-0.0.0.0]network 56.1.1.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 67.1.1.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]net	
[r6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0

R7

[r7]ospf 1
[r7-ospf-1]q
[r7]ospf 1 rou	
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]net	
[r7-ospf-1-area-0.0.0.0]network 67.1.1.0 0.0.0.255
[r7-ospf-1-area-0.0.0.0]

重发布

先重发布R7的环回,再在R2和R3上重发布

R7

[r7-ospf-1]im	
[r7-ospf-1]import-route dir	
[r7-ospf-1]import-route direct 
[r7-ospf-1]

R2

[r2]ospf 1
[r2-ospf-1]im	
[r2-ospf-1]import-route rip 1
[r2-ospf-1]q
[r2]rip 1
[r2-rip-1]im	
[r2-rip-1]import-route ospf 1
[r2-rip-1]

R3

[r3]ospf 1
[r3-ospf-1]im	
[r3-ospf-1]import-route rip 1
[r3-ospf-1]
[r3-ospf-1]q
[r3]rip 1
[r3-rip-1]im	
[r3-rip-1]import-route ospf 1
[r3-rip-1]

查看R1和R4的路由表

R1

在这里插入图片描述
发现3环回的掩码不同,修改接口工作方式

[r3]int l0
[r3-LoopBack0]ospf net	
[r3-LoopBack0]ospf network-type br	
[r3-LoopBack0]ospf network-type broadcast 
[r3-LoopBack0]

更改过后掩码统一变为 24位
在这里插入图片描述

R4

在这里插入图片描述
检验,用R1去ping各个环回
发现只有R7的环回ping不通
在这里插入图片描述
经分析,发现因为R2和R3的双向重发布,使得 R1 ping R7的环回 时,产生了环路,所以到不了R7的环回

解决ping不通R7环回问题

R2

[r2]acl 2000
[r2-acl-basic-2000]rule permit source 7.7.7.0 0
[r2]route-policy a permit node 10
[r2-route-policy]if-match acl 2000
[r2-route-policy]apply preference 151
[r2-route-policy]q
[r2]rip 1
[r2-rip-1]preference route-policy a

R3

[r3]route-policy a permit node 10
[r3-route-policy]apply preference 151
[r2-route-policy]q
[r3]rip 1
[r3-rip-1]preference route-policy a

检验:

在这里插入图片描述

可以ping通了

最佳选路

R2

[r2]acl 2001
[r2-acl-basic-2001]rule per	
[r2-acl-basic-2001]rule permit sou	
[r2-acl-basic-2001]rule permit source 3.3.3.3 0
[r2-acl-basic-2001]rule permit source 34.1.1.0 0.0.0.255
[r2-acl-basic-2001]q
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]rip me	
[r2-GigabitEthernet0/0/1]rip metricout 2001 2
[r2-GigabitEthernet0/0/1]q
[r2]ip ip-	
[r2]ip ip-prefix c per	
[r2]ip ip-prefix c permit 12.1.1.0 24
[r2]ip ip-prefix c permit 2.2.2.0 24
[r2]rou	
[r2]route
[r2]route-policy o per	
[r2]route-policy o permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-	
[r2-route-policy]if-match ip-	
[r2-route-policy]if-match ip-prefix c
[r2-route-policy]app	
[r2-route-policy]apply cost-	
[r2-route-policy]apply cost-type type-1
[r2-route-policy]q
[r2]rou	
[r2]route
[r2]route-policy o permit node 20
Info: New Sequence of this List.
[r2-route-policy]ospf 1
[r2-ospf-1]im	
[r2-ospf-1]import-route rip rou	
[r2-ospf-1]import-route rip route-policy o
[r2-ospf-1]

R3

[r3]acl 2001
[r3-acl-basic-2001]rule per	
[r3-acl-basic-2001]rule permit sou	
[r3-acl-basic-2001]rule permit source 24.1.1.0 0.0.0.255
[r3-acl-basic-2001]int g0/0/0
[r3-GigabitEthernet0/0/0]rip me	
[r3-GigabitEthernet0/0/0]rip metricout 2001 2
[r3-GigabitEthernet0/0/0]q
[r3]ip ip-	
[r3]ip ip-prefix c per	
[r3]ip ip-prefix c permit 13.1.1.0 24
[r3]rou	
[r3]route
[r3]route-policy o per	
[r3]route-policy o permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-	
[r3-route-policy]if-match ip-	
[r3-route-policy]if-match ip-prefix c
[r3-route-policy]app	
[r3-route-policy]apply cost-	
[r3-route-policy]apply cost-type type-1
[r3-route-policy]apply cost-type type-2
[r3-route-policy]undo apply cost-type type-1
                                      ^
Error:Too many parameters found at '^' position.
[r3-route-policy]q
[r3]route-policy o permit node 20
Info: New Sequence of this List.
[r3-route-policy]q
[r3]ospf 1
[r3-ospf-1]im	
[r3-ospf-1]import-route rip 1 rou	
[r3-ospf-1]import-route rip 1 route-policy o
[r3-ospf-1]q
[r3]rou	
[r3]route
[r3]route-policy h per	
[r3]route-policy h permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-	
[r3-route-policy]if-match ip-	
[r3-route-policy]if-match ip-prefix c
[r3-route-policy]app	
[r3-route-policy]apply cost-type type-1
[r3-route-policy]q
[r3]route-policy h permit node 20
Info: New Sequence of this List.
[r3-route-policy]ospf 1
[r3-ospf-1]import-	
[r3-ospf-1]import-route rip 1 rou	
[r3-ospf-1]import-route rip 1 route-policy h
[r3-ospf-1]

检验:

R1的环回也能ping通其他的环回
在这里插入图片描述
查看R1的路径
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Nirvana92/article/details/132183108