如下图所示区域3没有直接和区域0相连,我们通过虚链路解决这个问题
Ip配置如下(本实验只用R1 R2 R3 R4)
在以上配置下R1的邻居
[RT1]display ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbor Brief Information
Area: 0.0.0.3
Router ID Address Pri Dead-Time Interface State
2.2.2.2 192.168.1.2 1 36 S0/2/0 Full/ -
在以上配置下R1的路由表
可以看到没有学习到其它区域的路由条目
[RT1]display ip routing-table
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost NextHop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.1.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.2.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.3.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.4.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.5.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.6.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.7.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.1 S0/2/0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.2/32 Direct 0 0 192.168.1.2 S0/2/0
虚链路需要在R2和R3两个ABR上做,配置如下
R2
[RT2-ospf-1-area-0.0.0.1]display ospf peer 看邻居的router ID
OSPF Process 1 with Router ID 2.2.2.2
Neighbor Brief Information
Area: 0.0.0.1
Router ID Address Pri Dead-Time Interface State
3.3.3.3 192.168.2.2 1 37 S0/2/2 Full/ -
Area: 0.0.0.3
Router ID Address Pri Dead-Time Interface State
1.1.1.1 192.168.1.1 1 38 S0/2/0 Full/ -
OSPF Process 1111 with Router ID 2.2.2.2
Neighbor Brief Information
[RT2-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3 对端ABR的router ID
R3
[RT3-ospf-1]ar
[RT3-ospf-1]area 1
[RT3-ospf-1-area-0.0.0.1]v
[RT3-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2
OK
R1的路由表
[RT1]display ip routing-table
Routing Tables: Public
Destinations : 19 Routes : 19
Destination/Mask Proto Pre Cost NextHop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.0.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.1.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.2.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.3.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.4.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.5.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.6.1/32 Direct 0 0 127.0.0.1 InLoop0
172.16.7.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.0/24 Direct 0 0 192.168.1.1 S0/2/0
192.168.1.1/32 Direct 0 0 127.0.0.1 InLoop0
192.168.1.2/32 Direct 0 0 192.168.1.2 S0/2/0
192.168.2.0/24 OSPF 10 3124 192.168.1.2 S0/2/0
192.168.6.0/24 OSPF 10 4686 192.168.1.2 S0/2/0
192.168.100.1/32 OSPF 10 4686 192.168.1.2 S0/2/0
192.168.101.1/32 OSPF 10 4686 192.168.1.2 S0/2/0
192.168.102.1/32 OSPF 10 4686 192.168.1.2 S0/2/0
192.168.103.1/32 OSPF 10 4686 192.168.1.2 S0/2/0
[RT1]
测试:
[RT1]ping -c 1 192.168.100.1
PING192.168.100.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.100.1: bytes=56 Sequence=1 ttl=253 time=10 ms
--- 192.168.100.1 ping statistics ---
1 packet(s) transmitted
1 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/10/10 ms
在R3下
[RT3]display ospf vlink
OSPF Process 1 with Router ID 3.3.3.3
Virtual Links
Virtual-link Neighbor-ID -> 2.2.2.2, Neighbor-State: Full
Interface: 192.168.2.2 (Serial0/2/0)
Cost: 1562 State: P-2-P Type: Virtual
Transit Area: 0.0.0.1
Timers: Hello 10, Dead 40, Retransmit 5, Transmit Delay 1