hcip的重发布实验(1)

题目

在这里插入图片描述

拓扑图

在这里插入图片描述

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 8 2023 21:28:29-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 14.1.1.1 24
[r1-GigabitEthernet0/0/1]
Aug 8 2023 21:28:42-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]

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/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
Aug 8 2023 21:29:14-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 23.1.1.1 24
Aug 8 2023 21:29:26-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]

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 23.1.1.2 24
Aug 8 2023 21:29:54-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.1 24
Aug 8 2023 21:30:05-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]

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.2 24
Aug 8 2023 21:30:36-08:00 Huawei %%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 14.1.1.2 24
[r4-GigabitEthernet0/0/1]
Aug 8 2023 21:30:46-08:00 Huawei %%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]

配置RIP和OSPF并且实现重分布

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 12.0.0.0
[r2-rip-1]network 2.0.0.0
[r2-rip-1]q
[r2]ospf 1 rou
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]net
[r2-ospf-1-area-0.0.0.1]network 23.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.1]q
[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]q

R3

[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 23.1.1.0 0.0.0.255
[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]network 3.3.3.3 0.0.0.0

R4

[r4]rip 1
[r4-rip-1]vers
[r4-rip-1]version 2
[r4-rip-1]net
[r4-rip-1]network 14.0.0.0
[r4-rip-1]q
[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 34.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0]q
[Huawei-ospf-1]im
[Huawei-ospf-1]import-route rip 1
[Huawei-ospf-1]q
[Huawei]rip 1
[Huawei-rip-1]im
[Huawei-rip-1]import-route ospf 1
[Huawei-rip-1]

查看R4的路由表

将掩码都改为24
在这里插入图片描述

R2

[r2]int l0
[r2-LoopBack0]ospf network-type broadcast

R4

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

OSPF向RIP的重分布

在R2出口处,抓取4.4.4.0和34.1.1.0,然后加大其度量,使R1走最佳路径

R2

[r2]ip ip-
[r2]ip ip-prefix c permit 4.4.4.0 24
[r2]ip ip-prefix c permit 34.1.1.0 24
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]rip met
[r2-GigabitEthernet0/0/0]rip metricout ip-
[r2-GigabitEthernet0/0/0]rip metricout ip-prefix c 3

在这里插入图片描述

在R4出口处,抓取23.1.1.0,然后加大其度量,使R3走最佳路径

R4

[r4]ip ip-
[r4]ip ip-prefix c per
[r4]ip ip-prefix c permit 23.1.1.0 24
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]rip met
[r4-GigabitEthernet0/0/1]rip metricout ip-
[r4-GigabitEthernet0/0/1]rip metricout ip-prefix c 3
[r4-GigabitEthernet0/0/1]

在这里插入图片描述

RIP向OSPF的重分布

在R2处抓取2.2.2.0 和 12.1.1.0 将其类型改为1类,优于2类,能优先选取该路径

R2

[r2]ip ip-
[r2]ip ip-prefix chs per
[r2]ip ip-prefix chs permit 2.2.2.0 24
[r2]ip ip-prefix chs permit 12.1.1.0 24
[r2]rou
[r2]route
[r2]route-policy hs per
[r2]route-policy hs 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 chs
[r2-route-policy]app
[r2-route-policy]apply cost-
[r2-route-policy]apply cost-type type-1
[r2-route-policy]q
[r2]route-policy hs permit node 20
Info: New Sequence of this List.
[r2-route-policy]q
[r2]ospf 1
[r2-ospf-1]im
[r2-ospf-1]import-route rip 1 rou
[r2-ospf-1]import-route rip 1 route-policy hs
[r2-ospf-1]

在R4处抓取14.1.1.0 将其类型改为1类,优于2类,能优先选取该路径

R4

[r4]ip ip-
[r4]ip ip-prefix chs per
[r4]ip ip-prefix chs permit 14.1.1.0 24
[r4]rou
[r4]route
[r4]route-policy hs per
[r4]route-policy hs permit node 10
Info: New Sequence of this List.
[r4-route-policy]if-
[r4-route-policy]if-match ip-
[r4-route-policy]if-match ip-prefix chs
[r4-route-policy]app
[r4-route-policy]apply cos
[r4-route-policy]apply cost
[r4-route-policy]apply cost-type type-1
[r4-route-policy]q
[r4]route-policy hs permit node 20
Info: New Sequence of this List.
[r4-route-policy]q
[r4]ospf 1
[r4-ospf-1]im
[r4-ospf-1]import-route rip 1 rou
[r4-ospf-1]import-route rip 1 route-policy hs
[r4-ospf-1]

在这里插入图片描述
查看R3选路
在这里插入图片描述
查看R1选路
在这里插入图片描述
实验完成
注:最重要的是思路清晰,识别最佳路径,然后根据加度量或改类型等等,让其选择最佳路径。

猜你喜欢

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