实验
拓扑图:
R1配置
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 14.1.1.1 24
Sep 25 2022 22:28:26-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]
[R1-GigabitEthernet0/0/0]q
[R1]rip 1
[R1-rip-1]ver 2
[R1-rip-1]ne
[R1-rip-1]network 14.0.0.0
[R1-rip-1]q
[R1]int l0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]q
[R1]rip 1
[R1-rip-1]ver 2
[R1-rip-1]network 1.0.0.0
R2的配置
[Huawei]sys R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 24.1.1.1 24
Sep 25 2022 22:39:07-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 l0
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0]q
[R2]ospf 1 router-id 1.1.1.1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 24.1.1.1 0.0.0.0
R3的配置:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 34.1.1.1 24
[R3-GigabitEthernet0/0/0]
Sep 25 2022 22:43:26-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 l0
[R3-LoopBack0]ip add 3.3.3.3 24
[R3-LoopBack0]q
[R3]ospf 2 router-id 3.3.3.3
[R3-ospf-2]area 0
[R3-ospf-2-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-2-area-0.0.0.0]network 34.1.1.1 0.0.0.0
R4的配置:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int l0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 14.1.1.2 24
Sep 25 2022 22:47:33-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]q
[R4]rip 1
[R4-rip-1]ver 2
[R4-rip-1]network 14.0.0.0
[R4-rip-1]q
[R4]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip add 34.1.1.2 24
Sep 25 2022 22:48:33-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R4-GigabitEthernet0/0/2]q
[R4]ospf 2
[R4-ospf-2]area 0
[R4-ospf-2-area-0.0.0.0]network 34.1.1.2 0.0.0.0
[R4]ospf 1
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]net
[R4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[R4]display ospf peer brief
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 1.1.1.1 Full
----------------------------------------------------------------------------
OSPF Process 2 with Router ID 4.4.4.4
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/2 3.3.3.3 Full
----------------------------------------------------------------------------
测试连通性:
[R4]ping 14.1.1.1
PING 14.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 14.1.1.1: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 14.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 14.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 14.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 14.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 14.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/60 ms
[R4]ping 24.1.1.1
PING 24.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 24.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 24.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 24.1.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 24.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 24.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 24.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/24/30 ms
[R4]ping 34.1.1.1
PING 34.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 34.1.1.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 34.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 34.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 34.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 34.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
查看R4的路由表
[R4]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 19 Routes : 19
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 RIP 100 1 D 14.1.1.1 GigabitEthernet
0/0/0
2.2.2.2/32 OSPF 10 1 D 24.1.1.1 GigabitEthernet
0/0/1
3.3.3.3/32 OSPF 10 1 D 34.1.1.1 GigabitEthernet
ospf 重发布到rip中
[R4]rip 1 R
[R4-rip-1]import-route ospf 1
查看R1的路由表:
R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.2/32 RIP 100 1 D 14.1.1.2 GigabitEthernet
0/0/0
14.1.1.0/24 Direct 0 0 D 14.1.1.1 GigabitEthernet
0/0/0
14.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
14.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
24.1.1.0/24 RIP 100 1 D 14.1.1.2 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R4-rip-1]import-route ospf 1 cost 2 可修改默认种子度量 默认为0
两张图看懂重发布
五号设备可以学到一的路由,凸显重发布的全部。