
实验过程: 第一步 配置R1的接口与OSPF R1(config)#int s2/1 R1(config-if)#ip add 12.0.0.1 255.255.255.0 R1(config-if)#no sh R1(config-if)#router ospf 64 R1(config-router)#net 12.0.0.0 0.0.0.255 area 0 R1(config-router)# ^Z
第二步 配置R2的接口与OSPF R2(config)#int s2/1 R2(config-if)#ip add 12.0.0.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int s2/2 R2(config-if)#ip add 23.0.0.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#router ospf 64 R2(config-router)#net 12.0.0.0 0.0.0.255 area 0 R2(config-router)#net 23.0.0.0 0.0.0.255 area 0 R2(config-router)# ^Z
第三步 配置R3接口与OSPF R3(config)#int s2/1 R3(config-if)#ip add 23.0.0.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#int s2/2 R3(config-if)#ip add 34.0.0.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#router ospf 64 R3(config-router)#net 23.0.0.3 0.0.0.0 area 0 R3(config-router)#net 34.0.0.3 0.0.0.0 area 0 R3(config-router)# ^Z
第四步 配置R4接口与OSPF R4(config)#int s2/1 R4(config-if)#ip add 34.0.0.4 255.255.255.0 R4(config-if)#no sh R4(config-if)#int s2/2 R4(config-if)#ip add 45.0.0.4 255.255.255.0 R4(config-if)#no sh R4(config-if)#router ospf 64 R4(config-router)#net 0.0.0.0 0.0.0.0 area 0 R4(config-router)# ^Z
第五步 配置R5接口与OSPF R5(config)#int s2/2 R5(config-if)#ip add 45.0.0.5 255.255.255.0 R5(config-if)#no sh R5(config-if)#router ospf 64 R5(config-router)#net 45.0.0.5 0.0.0.0 area 0 R5(config-router)# ^Z
第六步 在R1上检查OSPF的运行情况 R1#show ip ospf interface // 查看OSPF接口 Serial2/1 is up, line protocol is up Internet Address 12.0.0.1/24, Area 0 // 接口S2/1在OSPF区域0下 Process ID 64, Router ID 12.0.0.1, Network Type POINT_TO_POINT, Cost: 64 // OSPF在Serial接口上的Cost默认为64,网络类型为Pont_to_Point Transmit Delay is 1 sec, State POINT_TO_POINT // 在Cisco上,默认为1秒,即已接收到的LSA老化时间速度 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 // 在Cisco上,默认的Hello包时间间隔为10秒,死亡间隔时间为40秒,等待时间为40秒,重传时间为5秒 oob-resync timeout 40 Hello due in 00:00:08 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 1/1, 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 23.0.0.2 Suppress hello for 0 neighbor(s) R1#show ip ospf neighbor // 查看OSPF的邻居 Neighbor ID Pri State Dead Time Address Interface 23.0.0.2 0 FULL/ - 00:00:35 12.0.0.2 Serial2/1
R1#show ip ospf neighbor detail // 查看OSPF的邻居详细情况 Neighbor 23.0.0.2, interface address 12.0.0.2 In the area 0 via interface Serial2/1 Neighbor priority is 0, State is FULL, 6 state changes DR is 0.0.0.0 BDR is 0.0.0.0 // 在点到点接口中,没有选举DR/BDR Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:32 Neighbor is up for 00:12:46 Index 1/1, 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
R1#show ip protocols // 查看协议运行情况 Routing Protocol is "ospf 64" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 12.0.0.1 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 12.0.0.0 0.0.0.255 area 0 Reference bandwidth unit is 100 mbps Routing Information Sources: Gateway Distance Last Update 12.0.0.1 110 00:13:29 23.0.0.2 110 00:12:20 34.0.0.3 110 00:11:19 45.0.0.4 110 00:10:20 Distance: (default is 110)
R1#show ip ospf statistics // 查看R1的OSPF状态 OSPF Router with ID (12.0.0.1) (Process ID 64)
Area 0: SPF algorithm executed 12 times // 在Area 0中SPF算法已经计算了12次 Summary OSPF SPF statistic
SPF calculation time // 下面显示了处理各种类型的LSA所花费的时间 Delta T Intra D-Intra Summ D-Summ Ext D-Ext Total Reason 00:13:58 0 0 0 0 0 0 0 R, 00:13:29 0 0 0 0 0 0 0 R, 00:13:19 0 0 0 0 0 0 0 R, 00:12:48 0 0 0 0 4 0 4 R, 00:12:23 0 0 0 0 0 0 0 R, 00:11:48 0 4 0 0 0 0 4 R, 00:11:32 4 0 0 0 0 0 4 R, 00:11:22 0 4 0 0 0 0 4 R, 00:10:48 4 0 0 0 0 0 4 R, 00:05:05 4 0 0 0 0 0 4 R, // Reason是记录引起SPF运算的原因 N → Type 2 Networks LSA发生改变 R → Type 1 Router LSA发生改变 SA → ASBR LSA发生改变 SN → Summary Networks(SN)LSA发生改变 X → Type 7外部类型7 LSA发生改变
R1#show ip ospf // 查看OSPF运行情况 Routing Process "ospf 64" with ID 12.0.0.1 // OSPF的进程号是64,OSPF的Router ID是12.0.0.1 Start time: 00:01:47.792, Time elapsed: 00:15:16.752 Supports only single TOS(TOS0) routes Supports opaque LSA Supports Link-local Signaling (LLS) Supports area transit capability Router is not originating router-LSAs with maximum metric Initial SPF schedule delay 5000 msecs // SPF算法启动的时延,可以使用timer throttle spf进行设置 Minimum hold time between two consecutive SPFs 10000 msecs // 在连续的SPF计算之间最小hold time,可以使用timer throttle spf进行配置 Maximum wait time between two consecutive SPFs 10000 msecs // 在连续的SPF计算之间最大的等待时间,可以使用timer throttle spf进行配置 Incremental-SPF disabled Minimum LSA interval 5 secs // 最小的LSA间隔时间为5秒 Minimum LSA arrival 1000 msecs LSA group pacing timer 240 secs Interface flood pacing timer 33 msecs Retransmission pacing timer 66 msecs Number of external LSA 0. Checksum Sum 0x000000 Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Number of areas transit capable is 0 External flood list length 0 IETF NSF helper support enabled Cisco NSF helper support enabled Area BACKBONE(0) Number of interfaces in this area is 1 Area has no authentication SPF algorithm last executed 00:05:37.784 ago SPF algorithm executed 12 times Area ranges are Number of LSA 5. Checksum Sum 0x0204EC Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0
第七步 检查OSPF路由表 R1#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets O 34.0.0.0 [110/192] via 12.0.0.2, 00:12:32, Serial2/1 23.0.0.0/24 is subnetted, 1 subnets O 23.0.0.0 [110/128] via 12.0.0.2, 00:13:33, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets C 12.0.0.0 is directly connected, Serial2/1 45.0.0.0/24 is subnetted, 1 subnets O 45.0.0.0 [110/256] via 12.0.0.2, 00:11:33, Serial2/1
第八步 在R1上查看OSPF数据库 R1#show ip ospf database
OSPF Router with ID (12.0.0.1) (Process ID 64)
Router Link States (Area 0) // 在R1的OSPF数据库中只有Router Link类型的LSA Link ID ADV Router Age Seq# Checksum Link count 12.0.0.1 12.0.0.1 888 0x80000004 0x005401 2 23.0.0.2 23.0.0.2 824 0x80000004 0x00A6AD 4 34.0.0.3 34.0.0.3 774 0x80000003 0x0052A4 4 45.0.0.4 45.0.0.4 387 0x80000004 0x00ACF5 4 45.0.0.5 45.0.0.5 389 0x80000001 0x000AA5 2
R1#show ip ospf database database-summary // 查看R1的OSPF数据库的统计信息 OSPF Router with ID (12.0.0.1) (Process ID 64)
Area 0 database summary LSA Type Count Delete Maxage Router 5 0 0 // 在R1的Area 0有Router类型的LSA共5个 Network 0 0 0 Summary Net 0 0 0 Summary ASBR 0 0 0 Type-7 Ext 0 0 0 Prefixes redistributed in Type-7 0 Opaque Link 0 0 0 Opaque Area 0 0 0 Subtotal 5 0 0
Process 64 database summary LSA Type Count Delete Maxage Router 5 0 0 Network 0 0 0 Summary Net 0 0 0 Summary ASBR 0 0 0 Type-7 Ext 0 0 0 Opaque Link 0 0 0 Opaque Area 0 0 0 Type-5 Ext 0 0 0 Prefixes redistributed in Type-5 0 Opaque AS 0 0 0 Non-self 4 Total 5 0 0
R1#show ip ospf database router 12.0.0.1 // 查看OSPF数据库中关于12.0.0.1的详细信息 OSPF Router with ID (12.0.0.1) (Process ID 64)
Router Link States (Area 0)
LS age: 950 // 老化时间,总是从0开始 Options: (No TOS-capability, DC) LS Type: Router Links // 这是一个Router LSA Link State ID: 12.0.0.1 // R1的Router ID Advertising Router: 12.0.0.1 LS Seq Number: 80000004 Checksum: 0x5401 Length: 48 Number of Links: 2
Link connected to: another Router (point-to-point) // 注明连接到另一台路由器的网络类型为Point_to_Point (Link ID) Neighboring Router ID: 23.0.0.2 // 邻居的Router ID,即R2的Router ID 12.0.0.2 (Link Data) Router Interface address: 12.0.0.1 // 本路由器的接口地址,即R1的12.0.0.1 Number of TOS metrics: 0 TOS 0 Metrics: 64 // 到达这个接口的Cost为64 Link connected to: a Stub Network (Link ID) Network/subnet number: 12.0.0.0 // IP网络号 (Link Data) Network Mask: 255.255.255.0 // 接口的掩码 Number of TOS metrics: 0 TOS 0 Metrics: 64
R1#show ip ospf database router 23.0.0.2 // 查看R2的12.0.0.2 OSPF数据库信息 OSPF Router with ID (12.0.0.1) (Process ID 64)
Router Link States (Area 0)
LS age: 949 Options: (No TOS-capability, DC) LS Type: Router Links // 这是一个1型的Router LSA Link State ID: 23.0.0.2 // R2的Router ID Advertising Router: 23.0.0.2 LS Seq Number: 80000004 Checksum: 0xA6AD Length: 72 Number of Links: 4
Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 34.0.0.3 (Link Data) Router Interface address: 23.0.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 64
Link connected to: a Stub Network (Link ID) Network/subnet number: 23.0.0.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 64
Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 12.0.0.1 (Link Data) Router Interface address: 12.0.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 64
Link connected to: a Stub Network (Link ID) Network/subnet number: 12.0.0.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 64
第九步 查看其他路由器路由的学习情况 R2#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets O 34.0.0.0 [110/128] via 23.0.0.3, 00:15:40, Serial2/2 23.0.0.0/24 is subnetted, 1 subnets C 23.0.0.0 is directly connected, Serial2/2 12.0.0.0/24 is subnetted, 1 subnets C 12.0.0.0 is directly connected, Serial2/1 45.0.0.0/24 is subnetted, 1 subnets O 45.0.0.0 [110/192] via 23.0.0.3, 00:14:40, Serial2/2
R3#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets C 34.0.0.0 is directly connected, Serial2/2 23.0.0.0/24 is subnetted, 1 subnets C 23.0.0.0 is directly connected, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets O 12.0.0.0 [110/128] via 23.0.0.2, 00:16:20, Serial2/1 45.0.0.0/24 is subnetted, 1 subnets O 45.0.0.0 [110/128] via 34.0.0.4, 00:14:45, Serial2/2
R4#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets C 34.0.0.0 is directly connected, Serial2/1 23.0.0.0/24 is subnetted, 1 subnets O 23.0.0.0 [110/128] via 34.0.0.3, 00:15:29, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets O 12.0.0.0 [110/192] via 34.0.0.3, 00:15:29, Serial2/1 45.0.0.0/24 is subnetted, 1 subnets C 45.0.0.0 is directly connected, Serial2/2
R5#show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets O 34.0.0.0 [110/128] via 45.0.0.4, 00:09:27, Serial2/2 23.0.0.0/24 is subnetted, 1 subnets O 23.0.0.0 [110/192] via 45.0.0.4, 00:09:27, Serial2/2 12.0.0.0/24 is subnetted, 1 subnets O 12.0.0.0 [110/256] via 45.0.0.4, 00:09:27, Serial2/2 45.0.0.0/24 is subnetted, 1 subnets C 45.0.0.0 is directly connected, Serial2/2 R5#
注:HelloInterval、RouterDeadInterval、WaitTimer和RxmtInterval的区别 1. HelloInterval 在接口上传送两个Hello包之间的周期性间隔时间,此时间在从接口发送的hello数据包中通告,广播型网络缺省为10s,非广播型网络缺省为30s,可以用ip ospf tello-interval命令更改。
2. RouterDeadInterval 指宣告邻居路由器无效前,本地路由器从与一个接口相连的网络侦听到来自于邻居路由器的一个Hello数据包所经历的时间,缺省为HelloInterval的4倍,可以用ip ospf dead-interval命令更改
3. Wait Timer 开始选取DR和BDR之前,路由器等待邻居路由器的Hello数据包通告DR和BDR的时长。等待计时器的时间长度就是RouterDeadInterval的时间
4. RxmtInterval 在没有得到确认情况下,路由器重传OSPF数据包要等待的时间长度,通过retransmit表示,可以用ip ospf retransmit-interval命令更改
|