拓扑为工大瑞普ccnp实验lab17,描述如下:
R1(S1/1)--R2(S1/0),cost=10;R1(S1/2)-framerelay-R4(S1/2),cost=2
R2(S1/1)--R3(S1/0),cost=2,R2(F0/0)--R4(F0/0),cost=2
R3(S1/1)--R4(S1/0),cost=5
R1的F0/0口连接网络192.168.1.0/24,cost=1
R1#show run
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
!
interface Serial1/1
description DCE,OSPF area 0,connected to R2's S1/0,ip 172.16.255.2/30
ip address 172.16.255.1 255.255.255.252
ip ospf cost 10
clock rate 9600
!
interface Serial1/2
description FrameRelay,OSPF area 0,connected to R4's S1/2,ip 172.16.255.14/30
ip address 172.16.255.13 255.255.255.252
encapsulation frame-relay
ip ospf network broadcast
ip ospf cost 2
!
router ospf 100
router-id 1.1.1.1
network 172.16.255.0 0.0.0.3 area 0
network 172.16.255.12 0.0.0.3 area 0
network 192.168.1.0 0.0.0.255 area 2
!
////////////////////
R2#show run
interface FastEthernet0/0
description OSPF area 1,connected to Network 172.16.255.16/30
ip address 172.16.255.17 255.255.255.252
ip ospf cost 2
!
interface Serial1/0
description DTE,OSPF area 0,connected to R1's S1/1,ip 172.16.255.1/30
ip address 172.16.255.2 255.255.255.252
ip ospf cost 10
!
interface Serial1/1
description DCE,OSPF area 1,connected to R3's S1/0,ip 172.16.255.6/30
ip address 172.16.255.5 255.255.255.252
ip ospf cost 2
clock rate 9600
!
router ospf 100
router-id 2.2.2.2
network 172.16.255.0 0.0.0.3 area 0
network 172.16.255.4 0.0.0.3 area 1
network 172.16.255.16 0.0.0.3 area 1
!
////////////////////
R3#show run
interface Serial1/0
description DTE,OSPF area 1,connected to R2's S1/1,ip 172.16.255.5/30
ip address 172.16.255.6 255.255.255.252
ip ospf cost 2
!
interface Serial1/1
description DCE,OSPF area 1,connected to R4's S1/0,ip 172.16.255.10/30
ip address 172.16.255.9 255.255.255.252
ip ospf cost 5
clock rate 9600
!
router ospf 100
router-id 3.3.3.3
network 172.16.255.4 0.0.0.3 area 1
network 172.16.255.8 0.0.0.3 area 1
!
////////////////////
R4#show run
interface FastEthernet0/0
description OSPF area 1,connected to Network 172.16.255.16/30
ip address 172.16.255.18 255.255.255.252
ip ospf cost 2
!
interface Serial1/0
description DTE,OSPF area 1,connected to R3's S1/1,ip 172.16.255.9/30
ip address 172.16.255.10 255.255.255.252
ip ospf cost 5
!
interface Serial1/2
description FrameRelay,OSPF area 0,connected to R1's S1/2,ip 172.16.255.13/30
ip address 172.16.255.14 255.255.255.252
encapsulation frame-relay
ip ospf network broadcast
ip ospf cost 2
!
router ospf 100
router-id 4.4.4.4
network 172.16.255.8 0.0.0.3 area 1
network 172.16.255.12 0.0.0.3 area 0
network 172.16.255.16 0.0.0.3 area 1
!
R3#traceroute 192.168.1.1
更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/Network/lyjs/
1 172.16.255.5 24 msec 68 msec 12 msec
2 172.16.255.1 20 msec * 20 msec
R3#show ip route
172.16.0.0/30 is subnetted, 5 subnets
O IA 172.16.255.0 [110/12] via 172.16.255.5, 00:00:07, Serial1/0
C 172.16.255.4 is directly connected, Serial1/0
C 172.16.255.8 is directly connected, Serial1/1
O IA 172.16.255.12 [110/6] via 172.16.255.5, 00:00:07, Serial1/0
O 172.16.255.16 [110/4] via 172.16.255.5, 00:00:07, Serial1/0
O IA 192.168.1.0/24 [110/7] via 172.16.255.5, 00:00:07, Serial1/0
从R3到达192.168.1.0/24,最少的cost为R3-R2-R4-R1=7,可实际路由为R3-R2-R1=13。为何出现这样的情况?
首先查看R3的ospf database:
R3#show ip ospf data
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 673 0x80000005 0x003C97 3
3.3.3.3 3.3.3.3 615 0x80000003 0x005569 4
4.4.4.4 4.4.4.4 628 0x80000005 0x00951E 3
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
172.16.255.17 2.2.2.2 673 0x80000002 0x002C22