OSPF(开放式最短路径优先协议):是基于开放标准的链路状态路由选择协议。 OSPF运行的三张表: 邻居列表:列出每台路由器已经建立邻接关系的全部邻居路由器。 链路状态数据库:列出网络中其他路由器的信息,由此显示全网的网络拓扑。 路由表:列出通过SPF算法计算出的到达每个相连网络的最佳路径。 OSPF的度量值是cost(代价) 网络拓扑 Router1 F0/0<----> Router2 F0/0 Router1 F1/0<----> Router4 F1/0 Router2 F1/0<----> Router3 F1/0 Router3 F0/0<----> Router4 F0/0 VPCS V0/1<----> Router1 F2/0 VPCS V0/2<----> Router2 F2/0 VPCS V0/3<----> Router3 F2/0 VPCS V0/4<----> Router4 F2/0 步骤: 1、配置IP Router1 F2/0 192.168.1.1 f1/0 192.168.40.1 F0/0 192.168.10.2 pc1 192.168.1.2 Router2 F0/0 192.168.10.1 f2/0 192.168.2.1 F1/0 192.168.20.1 pc2 192.168.2.2 Router3 F1/0 192.168.20.2 f2/0 192.168.3.1 F0/0 192.168.30.1 pc3 192.168.3.2 Router4 F2/0 192.168.4.1 f0/0 192.168.30.2 F1/0 192.168.40.2 pc4 192.168.4.2 2、配置OSPF Router1配置 Router1 (config)#[url=]router ospf1[/url] Router1 (config-router)#[url=]router-id192.168.1.1[/url] Router1 (config-router)#network192.168.1.0 0.0.0.255 area 1 Router1 (config-router)#network192.168.10.0 0.0.0.255 area 1 Router1 (config-router)#network[url=] 192.168.40.00.0.0.255 area 1[/url] Router2配置 Router2(config)#routerospf 1 Router2(config-router)#router-id192.168.2.1 Router2(config-router)#network192.168.2.0 0.0.0.255 area 1 Router2(config-router)#network192.168.20.0 0.0.0.255 area 1 Router2(config-router)#network192.168.10.0 0.0.0.255 area 1 Router3配置 Router3(config)#routerospf 1 Router3(config-router)#router-id192.168.3.1 Router3(config-router)#network192.168.3.0 0.0.0.255 area 1 Router3(config-router)#network192.168.30.0 0.0.0.255 area 1 Router3(config-router)#network192.168.20.0 0.0.0.255 area 1 Router4配置 Router4(config)#routerospf 1 Router4(config-router)#router-id192.168.4.1 Router4(config-router)#network192.168.4.0 0.0.0.255 area 1 Router4(config-router)#network192.168.40.0 0.0.0.255 area 1 Router4(config-router)#network192.168.30.0 0.0.0.255 area 1 3、查看路由器路由表 Router2#show iproute 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 - OSPFexternal type 2 i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidatedefault, U - per-user static route o - ODR, P - periodic downloaded staticroute Gateway of lastresort is not set O 192.168.30.0/24 [110/2] via 192.168.20.2,00:04:43, FastEthernet1/0 C 192.168.10.0/24 is directly connected,FastEthernet0/0 O 192.168.40.0/24 [110/2] via 192.168.10.2,00:04:43, FastEthernet0/0 O 192.168.4.0/24 [110/3] via 192.168.20.2,00:04:43, FastEthernet1/0 [110/3] via 192.168.10.2,00:04:43, FastEthernet0/0 C 192.168.20.0/24 is directly connected,FastEthernet1/0 O 192.168.1.0/24 [110/2] via 192.168.10.2,00:04:43, FastEthernet0/0 C 192.168.2.0/24 is directly connected,FastEthernet2/0 O 192.168.3.0/24 [110/2] via 192.168.20.2,00:04:43, FastEthernet1/0 Router2#[url=]show ipospf neighbor[/url] Neighbor ID Pri State Dead Time Address Interface 192.168.3.1 1 FULL/BDR 00:00:37 192.168.20.2 FastEthernet1/0 4、pc之间物理连通 VPCS 4 >ping192.168.1.2 192.168.1.2icmp_seq=1 timeout 192.168.1.2icmp_seq=2 time=28.000 ms 192.168.1.2icmp_seq=3 time=15.000 ms 192.168.1.2icmp_seq=4 time=20.000 ms 192.168.1.2icmp_seq=5 time=30.000 ms VPCS 4 >ping192.168.2.2 192.168.2.2icmp_seq=1 timeout 192.168.2.2icmp_seq=2 time=70.000 ms 192.168.2.2icmp_seq=3 time=26.000 ms 192.168.2.2icmp_seq=4 time=37.000 ms 192.168.2.2icmp_seq=5 time=34.000 ms VPCS 4 >ping192.168.3.2 192.168.3.2icmp_seq=1 timeout 192.168.3.2icmp_seq=2 time=65.000 ms 192.168.3.2icmp_seq=3 time=30.000 ms 192.168.3.2icmp_seq=4 time=18.000 ms 192.168.3.2icmp_seq=5 time=26.000 ms
|