2 配置和查看 OSPF协议


(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:
 Gateway Distance Last Update
 192.168.1.1110 00:09:26
 192.168.1.6110 00:09:26
Distance: (default is 110)
R2#sh ip ospf neighbor
Neighbor IDPriStateDead TimeAddressInterface
192.168.1.61 FULL/ - 00:00:34192.168.1.6 Serial0
192.168.1.11 FULL/ - 00:00:36192.168.1.1 Serial1
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,1>ead 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

推荐阅读