R1配置
Router(config)#hostname r1
r1(config)#interface loopback 0
r1(config-if)#ip address 1.1.1.1 255.255.255.0
r1(config)#interface serial 2/1
r1(config-if)#ip address 12.0.0.1 255.255.255.0
r1(config-if)#no shutdown
r1(config)#router ospf 10
r1(config-router)#network 12.0.0.1 0.0.0.0 area 0
R2配置
Router(config)#hostname r2
r2(config)#interface loopback 0
r2(config-if)#ip address 2.2.2.2 255.255.255.0
r2(config)#interface serial 2/1
r2(config-if)#ip address 12.0.0.2 255.255.255.0
r2(config-if)#no shutdown
r2(config)#interface serial 2/2
r2(config-if)#ip address 23.0.0.1 255.255.255.0
r2(config-if)#no shutdown
r2(config)#router ospf 10
r2(config-router)#network 12.0.0.2 0.0.0.0 area 0
r2(config-router)#network 23.0.0.1 0.0.0.0 area 10
R3配置
Router(config)#hostname r3
r3(config)#interface loopback 0
r3(config-if)#ip address 3.3.3.3 255.255.255.0
r3(config)#interface serial 2/1
r3(config-if)#ip address 23.0.0.2 255.255.255.0
r3(config-if)#no shutdown
r3(config)#interface serial 2/2
r3(config-if)#ip address 34.0.0.1 255.255.255.0
r3(config-if)#no shutdown
r3(config)#router ospf 10
r3(config-router)#network 23.0.0.2 0.0.0.0 area 10
r3(config-router)#network 34.0.0.1 0.0.0.0 area 10
R4配置
Router(config)#hostname r4
r4(config)#interface loopback 0
r4(config-if)#ip address 4.4.4.4 255.255.255.0
r4(config)#interface serial 2/1
r4(config-if)#ip address 34.0.0.2 255.255.255.0
r4(config-if)#no shutdown
r4(config)#interface serial 2/2
r4(config-if)#ip address 45.0.0.1 255.255.255.0
r4(config-if)#no shutdown
r4(config)#router ospf 10
r4(config-router)#network 34.0.0.2 0.0.0.0 area 10
r4(config-router)#network 45.0.0.1 0.0.0.0 area 0
R5配置
Router(config)#hostname r5
r5(config)# interface loopback 0
r5(config-if)#ip address 5.5.5.5 255.255.255.0
r5(config)#interface serial 2/2
r5(config-if)#ip address 45.0.0.2 255.255.255.0
r5(config-if)#no shutdown
r5(config)#router ospf 10
r5(config-router)#network 45.0.0.2 0.0.0.0 area 0
在R2和R4上配置虚链路
r2(config)#router ospf 10
r2(config-router)#area 10 virtual-link 4.4.4.4
r4(config)#router ospf 10
r4(config-router)#area 10 virtual-link 2.2.2.2
R4上显示链路信息
r4#show ip ospf virtual-links
Virtual Link OSPF_VL2 to router 2.2.2.2 is up
Run as demand circuit
DoNotAge LSA allowed.
Transit area 10, via interface Serial2/1, Cost of using 128
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:09
Adjacency State FULL (Hello suppressed)
Index 2/3, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
R5pingR1测试
r5#ping 12.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 108/196/272 ms