OSPF单区域1 实验目的:
能够在单区域环境中配置OSPF路由协议。
2 网络拓扑
3 试验环境:
网络中计算机和路由器的IP地址已经如图配置完成。
4 试验要求
✓在Area0配置OSPF。
✓查看路由表。
✓检查OSPF协议的收敛速度。
5 基本配置步骤
5.1在Router2上
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.3 area 0
Router(config-router)#network 172.16.0.0 0.0.255.255 area 0
Router(config-router)#
OR
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.1 0.0.0.0 area 0
Router(config-router)#network 172.16.0.1 0.0.0.0 area 0
Router(config-router)#
5.2在Route0上
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.3 area 0
Router(config-router)#network 192.168.0.4 0.0.0.3 area 0
Router(config-router)#network 192.168.0.12 0.0.0.3 area 0
Router(config-router)#ex
5.3在Router1上
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.255 area 0
5.4在Router4上
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.255 area 0
Router(config-router)#network 172.18.0.0 0.0.255.255 area 0
5.5在Router3上
Router>en
Router#config t
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.255 area 0
Router(config-router)#network 172.17.0.0 0.0.255.255 area 0
Router(config-router)#
6 检查路由表
6.1在Router3上
Router#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
O 172.16.0.0/16 [110/1563] via 192.168.0.13, 00:01:15, Serial2/0
C 172.17.0.0/16 is directly connected, FastEthernet0/0
O 172.18.0.0/16 [110/782] via 192.168.0.17, 00:01:15, Serial3/0
192.168.0.0/30 is subnetted, 5 subnets
O 192.168.0.0 [110/1562] via 192.168.0.13, 00:01:15, Serial2/0
O 192.168.0.4 [110/1562] via 192.168.0.13, 00:01:15, Serial2/0
O 192.168.0.8 [110/1562] via 192.168.0.17, 00:01:15, Serial3/0
C 192.168.0.12 is directly connected, Serial2/0
C 192.168.0.16 is directly connected, Serial3/0
Router#
6.2查看OSPF邻居
Router#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface 192.168.0.13 1 FULL/- 00:00:39 192.168.0.13 Serial2/0 192.168.0.17 1 FULL/- 00:00:35 192.168.0.17 Serial3/0 Router#
6.3查看OSPF数据
Router#show ip ospf database
OSPF Router with ID (192.168.0.18) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.0.1 192.168.0.1 673 0x80000005 0x0082b6 3 192.168.0.9 192.168.0.9 317 0x80000004 0x004015 4 192.168.0.17 192.168.0.17 219 0x80000005 0x00dc82 5 192.168.0.13 192.168.0.13 214 0x80000006 0x00fbd0 6 192.168.0.18 192.168.0.18 200 0x80000005 0x0093be 5 7 测试OSPF收敛速度
7.1在PC0上
PC>tracert 172.17.0.2
Tracing route to 172.17.0.2 over a maximum of 30 hops:
1 6 ms 8 ms 7 ms 172.16.0.1
2 12 ms 11 ms 11 ms 192.168.0.2
3 13 ms 18 ms 15 ms 192.168.0.14
4 2
5 ms 28 ms 29 ms 172.17.0.2
Trace complete.
PC>
可以看到数据包是通过Router2→Router0→Router3
7.2在Router3上
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface serial 2/0
Router(config-if)#shutdown
7.3在PC0上
PC>tracert 172.17.0.2
Tracing route to 172.17.0.2 over a maximum of 30 hops:
1 9 ms 6 ms 7 ms 172.16.0.1
2 15 ms 11 ms 1
3 ms 192.168.0.2
3 1
4 ms 14 ms 16 ms 192.168.0.6
4 19 ms 22 ms 1
5 ms 192.168.0.10
5 2
6 ms 25 ms 29 ms 192.168.0.18
6 29 ms 30 ms 36 ms 172.17.0.2
Trace complete.
你可以看到数据包途径Router2→Router0→Router1→Router4→Router3。
收敛速度很快。