(1)首先在R3路由器上使用show ip route命令查看其IP路由表,可以看到有2条行首标注为"O"的路由项,它们就是由OSPF协议学习到的路由。这2条路由的目的网段分别为172.16.1.0/24和192.168.1.0/30,它们的下一跳点均为192.168.1.5(R2 S0接口)。
在第1个路由表项中有"[110/138]"字段,其中110是OSPF的缺省治理距离,138则是本条路由的Cost。Cost即费用,是OSPF中的度量值标准,路由器用Cost来比较到达同一目的网段的不同路径的耗费。低的Cost表示是好的路径,相反则是差的路径。
(2)接下来切换到R2路由器的控制台界面上,show ip route命令显示有2条OSPF路由,它们分别是通过192.168.1.1(R1 S1接口)到达172.16.1.0/24网段和通过192.168.1.6(R3 S0接口)到达172.16.3.0/24网段的路由项。
(3)在R2路由器上分别间172.16.1.1和172.16.3.1发出了ping测试,结果是成功的。
(4)在R1路由器上查看路由表,同样得到2条OSPF路由,分别指向目的网段172.16.3.0/24和192.168.1.4/30,其网关地址均为192.168.1.2(R2 S1接口)。
(5)为测试172.16.1.0/24网段到172.16.1.0/24网段的端到端连通性,我们使用了扩展的ping命令。测试结果是成功的,表明从R1的E0接口到R3的E0接口之间是在IP层是正常连通的。
(6)接下来的trace命令测试了从R1到R3的E0接口所经过的各个网关,它们依次是192.168.1.2和192.168.1.6。
第3部分:查看OSPF协议相关信息
下面使用有关命令查看OSPF协议的配置、邻居、接口和路由等信息。
监测清单11-2记录了所使用的命令和相应的结果。
监测清单11-2查看OSPF相关信息
R2#sh ip protocol
Routing Protocol is "ospf 100"
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Routing for Networks:
192.168.1.2/32
192,168.1.5/32
Routing Infottuation Sources:
GatewayDistanceLast Update
192.168.1.111000:09:26
192.168.1.611000:09:26
Distance: (default is 110)
R2#sh ip ospf neighbor
Neighbor IDPriStateDead TimeAddressInterface
192.168.1.61FULL/ -00:00:34192.168.1.6Serial0
192.168.1.11FULL/ -00:00:36192.168.1.1Serial1
R2#sh ip ospf neighbor detail
Neighbor
In the area 0 via interface Serial0
Neighbor priority is 1,State is FULL,6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options is 0x42
Dead timer-due in 00:00:38
Neighbor is up for 00:10:40
Index 2/2, 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
Neighbor 192.168.1.1,interface address 192.168.1.1
In the area 0 via interface Serial 1
Neighbor priority is 1,State is FULL, 6 state changes
DR is 0.0.0.0 BDR is 0.0.0.0
Options is 0x42
Dead timer due in 00:00:39
Neighbor is up- for 00:10:50
Index 1/1, 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
R2#sh ip ospf interface s0
Serial0 is up, line protocol is up
Internet Address 192.168.1.5/30, Arca0
Proems ID 100, Router ID 192.168.1.5,Network Type POINT_TO_POINT,Cost:64
Transmit Delay is 1 sec. State POINT_TO_POINT,
Timer ititervals configured Hello 10,1ead 40, Wait 40, Retransmit 5
Hello due in 00:00:00
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is-: 1,Adjacent neighbor count is 1
Adjacent with neighbor 192.168.1.6
Suppress hello for 0 neighbor(s)
R2#sh ip ospf database
OSPF Router with ID (192.168.1.5) (Process ID 100)
Router Link States(Area 0)
Link IDADV RouterAgeSeq#Checksum Link count
192.168.1.1192.168.1.18320x800000050xF6B83
192.168.1.5192.168,1.58200x800000060xF6B84
192.168.1.6192.168.1.68060x800000050xF6B83
R2#
Term_Server1
[Resuming connection 1 to r1 ... ]
R1#sh ip ospf neighbor
Neighbor IDPriStateDead TimeAddressInterface
192.168.1.51FULL/-00:00:36192.168.1.2Serial1
R1#
Term_Server3
[Resuming connection 3 to r3...]
R3#sh ip ospf neighbor
Neighbor IDPriStateDead TimeAddressInterface
192.168.1.51FULL/-00:00:35192.168.1.5Serial0
R3#sh ip route ospf
172.16.0.0/24 is subnetted,2 subnets
O172.16.1.0[110/138]via 192.168.1.5,00:12:12,Serial0
192.168.1.0/30 is subnetted,2 subnets
O192.168.1.0[110/128]via 192.168.1.5,00:12:12,Serial0
R3#sh ip route 172.16.1.0
Routing entry for 172.16.1./24
Known via"ospf 100",distance 110,metric 138,type intra area
Last update from 192.168.1.5 on Serial0,00:12:20 ago
Routing Descriptor Blocks:
* 192J68.1.5, from 192.168.1.1, 00:12:20 ago, via Serial0
Route metric is 138, traffic share count is 1
(1)在R2路由器上,使用show ip protocol命令,可以列出OSPF协议的主要配置信息。其中所路由的网络中列出的是接口地址"掩码为32位,这是和网络声明配置语句相对应的。
命令同时列出了2个路由信息源,它们是R1和R3路由器,相应的IP地址即为R1和R3的RouterID。
OSPF协议的缺省治理距离为110。
(2)show ip ospf neighbor命令列出了当前路由器的邻居,其中各项的含义如下:
NeighborID:邻居路由器的ID号;
Pri:即Priority,邻居路由器的优先级,缺省情况下是1;
State:邻居路由器的状态,"Full"表明形成的完全的邻接关系;
Dead Time:为终结时间,假如在此计数器计数到0之前,没有接收到由对应的邻居路由器发来的Hello包,则邻接关系将被清除;
Address:是邻居路由器的IP地址;
Interface:是与邻居路由器相连的本路由器的接口。
(3)使用show ip ospf neghbor detail命令列出了与R2路由器相邻的路由器的具体信息。
(4)show ip ospf interface命令可以列出相应接口的OSPF信息。以R2路由器S0接口为例,列出了以下重要信息:
OSPF进程ID为100;
RouterID为192.168.1.5;
OSPF网络类型为点到点;
此链路的Cost值为64;
Hello计时器为10秒;
终结计时器为40秒;
等待计时器为40秒;
与一个邻居路由器形成邻接关系,它的ID是192.168.1.6,即R3路由器。
(5)查看OSPF数据库的命令是show ip ospf database,此命令列出了3条链路信息,分别是由R1、R2和R3产生的。
(6)在R1和R3路由器上查看OSPF邻居信息,可以看到它们的邻居都是R2。
(7)使用show ip route ospf命令可以查看由OSPF协议所得到的路由项,便我们在众多路由项中找到想看的OSPF路由项。
(8)使用带有网段参数的show ip route命令可以查看相应的网段(如实验中的172.16.1.0)的具体信息,包括由什么协议获取、度量值、路由源及更新时间等信息。