需求
OSPF的区域配置原则:ospf采用二层组成的分层结构,所有区域都与主干区域(区域0)
直接相连,且区域0必须是连续的。在area34与骨干区域area0相分割下,使R4的路由器学习到骨干区域的路由。
配置
R1
interface Loopback0
ip address 1.1.1.1 255.255.255.0
interface Serial1/0
ip address 12.1.1.1 255.255.255.0
serial restart-delay 0
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 12.1.1.1 0.0.0.0 area 0
R2
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 23.1.1.1 255.255.255.0
serial restart-delay 0
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
area 23 virtual-link 3.3.3.3
network 2.2.2.2 0.0.0.0 area 0
network 12.1.1.2 0.0.0.0 area 0
network 23.1.1.1 0.0.0.0 area 23
R3
interface Loopback0
ip address 3.3.3.3 255.255.255.0
interface Serial1/0
ip address 23.1.1.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
ip address 34.1.1.1 255.255.255.0
serial restart-delay 0
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
area 23 virtual-link 2.2.2.2
network 3.3.3.3 0.0.0.0 area 23
network 23.1.1.2 0.0.0.0 area 23
network 34.1.1.1 0.0.0.0 area 34
R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
interface Serial1/0
ip address 34.1.1.2 255.255.255.0
serial restart-delay 0
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
network 4.4.4.4 0.0.0.0 area 34
network 34.1.1.2 0.0.0.0 area 34
验证配置
R1#show ip route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 12.1.1.2, 00:04:57, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/129] via 12.1.1.2, 00:03:47, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/128] via 12.1.1.2, 00:04:52, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R4#show ip route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
从R1和R4的路由表中可以看到都没有对方的路由。
配置virtual-link
R2:area 23 virtual-link 3.3.3.3
R3:area 23 vitrual-link 2.2.2.2
检查ospf虚链路的运行情况
R2#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 3.3.3.3 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 23, via interface Serial1/1, Cost of using 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:07
Adjacency State FULL (Hello suppressed)
Index 2/3, retransmission queue length 0, number of retransmission 1
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 1, maximum is 1
Last retransmission scan time is 0 msec, maximum is 0 msec
检查R1和R4的路由表
R1
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.1.1.0 [110/192] via 12.1.1.2, 00:03:21, Serial1/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 12.1.1.2, 00:03:21, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/129] via 12.1.1.2, 00:03:21, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/193] via 12.1.1.2, 00:03:21, Serial1/0
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/128] via 12.1.1.2, 00:03:21, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R4
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/193] via 34.1.1.1, 00:04:57, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/129] via 34.1.1.1, 00:04:57, Serial1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/65] via 34.1.1.1, 00:05:12, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.1.1.0 [110/128] via 34.1.1.1, 00:05:12, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/192] via 34.1.1.1, 00:05:03, Serial1/0
总结:ospf网络中,当区域0是不连续的(被分成两部分)或普通区域未能与骨干区域直接相连时,都可以使用虚链路暂时将区域0重新连接起来或通过一个非末节的中转区域将普通区域和骨干区域连接起来,以修复网络故障。OSPF虚链路功能用于提供临时连接或备用连接而不是一种主要的主干设计功能。
??上面路由表中的为什么各个路由器的Id的Ip地址非直连的都是以32位的显示在路由表中??