用虚链路让非骨干区域跨越非骨干区域实验
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/fb34e32fc2783cee2f082eac6e4dc1c6.png)
R1
undo ter
undo terminal mo
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]user-int
[R1]user-interface co
[R1]user-interface console 0
[R1-ui-console0]idle-t
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]quit
(配置接口地址)
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[R1-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int loop0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]quit
(进入ospf,宣告自己的网段)
[R1]ospf 1 ro
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]net
[R1-ospf-1-area-0.0.0.1]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]net
[R1-ospf-1-area-0.0.0.1]network 10.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]quit
[R1-ospf-1]quit
(因为我把R2的routerID宣告在area2中,所以就算R1和R2直连,R1也看不到R2的信息)
[R1]dis
[R1]display ip ro
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet
0/0/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 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
(这里已经配置好虚链路,其他路由器的信息都能看到)
[R1]dis
[R1]display ip ro
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.2/32 OSPF 10 1 D 10.1.1.2 GigabitEthernet
0/0/0
3.3.3.3/32 OSPF 10 2 D 10.1.1.2 GigabitEthernet
0/0/0
4.4.4.4/32 OSPF 10 3 D 10.1.1.2 GigabitEthernet
0/0/0
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet
0/0/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
14.1.1.0/24 OSPF 10 3 D 10.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
172.16.1.0/24 OSPF 10 2 D 10.1.1.2 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
R2
Huawei>undo ter
undo terminal mo
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]user-int
[R2]user-interface co
[R2]user-interface console 0
[R2-ui-console0]idle-t
[R2-ui-console0]idle-timeout 0 0
[R2-ui-console0]quit
(配置接口地址)
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.1.1.2 24
[R2-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 172.16.1.2 24
[R2-GigabitEthernet0/0/1]undo shut
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]int loop0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]quit
(看看直连的路由器通不通)
[R2]ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
— 10.1.1.1 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/30/70 ms
[R2]ping 172.16.1.3
PING 172.16.1.3: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.3: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 172.16.1.3: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 172.16.1.3: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 172.16.1.3: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 172.16.1.3: bytes=56 Sequence=5 ttl=255 time=30 ms
— 172.16.1.3 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/30/70 ms
(进入ospf,宣告自己的网段)
[R2]ospf 1 ro
[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 10.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]area 2
[R2-ospf-1-area-0.0.0.2]net
[R2-ospf-1-area-0.0.0.2]network 172.16.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.2]net
[R2-ospf-1-area-0.0.0.2]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.2]quit
(因为R2所占两个区域,分别为area1和area2,area2又和骨干区域area0连接,所以R2可以看到其他路由的信息)
[R2-ospf-1]dis
[R2-ospf-1]display ip ro
[R2-ospf-1]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 1 D 10.1.1.1 GigabitEthernet
0/0/0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.3/32 OSPF 10 1 D 172.16.1.3 GigabitEthernet
0/0/1
4.4.4.4/32 OSPF 10 2 D 172.16.1.3 GigabitEthernet
0/0/1
10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet
0/0/0
10.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
14.1.1.0/24 OSPF 10 2 D 172.16.1.3 GigabitEthernet
0/0/1
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
172.16.1.0/24 Direct 0 0 D 172.16.1.2 GigabitEthernet
0/0/1
172.16.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
172.16.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
(因为R2所处area1和area2,又因为area2和area0相连,所以选择R2架设虚链路)
[R2-ospf-1]area 2
[R2-ospf-1-area-0.0.0.2]vlink-peer 3.3.3.3
[R2-ospf-1-area-0.0.0.2]
R3
undo ter
undo terminal mo
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]user-int
[R3]user-interface co
[R3]user-interface console 0
[R3-ui-console0]idle-t
[R3-ui-console0]idle-timeout 0 0
[R3-ui-console0]quit
(配置接口地址)
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.1.3 24
[R3-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 14.1.1.3 24
[R3-GigabitEthernet0/0/1]undo shut
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R3-GigabitEthernet0/0/1]int loop0
[R3-LoopBack0]ip add 3.3.3.3 32
[R3-LoopBack0]quit
(检查看直连的通不通)
[R3]ping 14.1.1.4
PING 14.1.1.4: 56 data bytes, press CTRL_C to break
Reply from 14.1.1.4: bytes=56 Sequence=1 ttl=255 time=70 ms
Reply from 14.1.1.4: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 14.1.1.4: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 14.1.1.4: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 14.1.1.4: bytes=56 Sequence=5 ttl=255 time=20 ms
— 14.1.1.4 ping statistics —
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/32/70 ms
(宣告自己的网段)
[R3]ospf 1 ro
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]net
[R3-ospf-1-area-0.0.0.2]network 172.16.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.2]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]net
[R3-ospf-1-area-0.0.0.0]network 14.1.1.0 0.0.0.255
[R-ospf-1-area-0.0.0.0]quit
(因为R3所在area2区域和骨干区域,R4所在area0区域,R1所在area1区域,没有和骨干区域相连,所以R3能看到除了R1路由器的信息)
[R3-ospf-1]dis
[R3-ospf-1]display ip ro
[R3-ospf-1]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 OSPF 10 1 D 172.16.1.2 GigabitEthernet
0/0/0
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
4.4.4.4/32 OSPF 10 1 D 14.1.1.4 GigabitEthernet
0/0/1
14.1.1.0/24 Direct 0 0 D 14.1.1.3 GigabitEthernet
0/0/1
14.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
14.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
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
172.16.1.0/24 Direct 0 0 D 172.16.1.3 GigabitEthernet
0/0/0
172.16.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
172.16.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
(这里就是需要架设虚链路了,跨area2区域,连接area1和area0,因为R3是area0和area2共同拥有的,所以在R3架设)
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]vlink-peer 2.2.2.2
[R3-ospf-1-area-0.0.0.2]quit
R4
undo ter
undo terminal mo
undo terminal monitor
Info: Current terminal monitor is off.
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname
[Huawei]sysname R4
[R4]user-int
[R4]user-interface co
[R4]user-interface console 0
[R4-ui-console0]idle-t
[R4-ui-console0]idle-timeout 0 0
[R4-ui-console0]quit
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 14.1.1.4 24
[R4-GigabitEthernet0/0/0]undo shut
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R4-GigabitEthernet0/0/0]int loop0
[R4-LoopBack0]ip add 4.4.4.4 32
[R4-LoopBack0]quit
[R4]ospf 1 ro
[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]net
[R4-ospf-1-area-0.0.0.0]network 14.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]quit
(因为架设虚链路,所以全网互通了,所以可以看到其他所有路由器)
[R4-ospf-1]display IP RO
[R4-ospf-1]display IP routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 3 D 14.1.1.3 GigabitEthernet
0/0/0
2.2.2.2/32 OSPF 10 2 D 14.1.1.3 GigabitEthernet
0/0/0
3.3.3.3/32 OSPF 10 1 D 14.1.1.3 GigabitEthernet
0/0/0
4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.1.0/24 OSPF 10 3 D 14.1.1.3 GigabitEthernet
0/0/0
14.1.1.0/24 Direct 0 0 D 14.1.1.4 GigabitEthernet
0/0/0
14.1.1.4/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
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
172.16.1.0/24 OSPF 10 2 D 14.1.1.3 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R4-ospf-1]