实验 10 点到点链路 OSPF 配置

来源:互联网 发布:决策树算法例题 编辑:程序博客网 时间:2024/05/18 04:58

一.实验目的:
掌握点到点链路 OSPF 的配置方法。
二.实验要点:
配置点到点链路上的 OSPF,对运行中的 OSPF 进行诊断。
三.实验设备:
路由器 Cisco 2621 三台,带有网卡的工作站 PC 六台,控制台电缆一条,交叉双绞线若干。
四、实验环境
步骤中的实验情况
这里写图片描述
纠正一下,Router1的f0/0端口的地址为:20.0.0.1/24

将所有的主机配置好之后出现的情况
这里写图片描述

五. 实验步骤

Router1的配置Router>enableRouter#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#interface Serial0/0Router(config-if)#ip address 192.168.1.2 255.255.255.0Router(config-if)#clock rate 64000Router(config-if)#no shutdownRouter(config-if)#%LINK-5-CHANGED: Interface Serial0/0, changed state to upRouter(config-if)#exitRouter(config)#interface Serial0/1Router(config-if)#ip address 192.168.3.1 255.255.255.0Router(config-if)#clock rate 64000Router(config-if)#no shutdownRouter(config-if)#%LINK-5-CHANGED: Interface Serial0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
Router2的配置Router>enableRouter#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#interface Serial0/0Router(config-if)#ip address 192.168.2.2 255.255.255.0Router(config-if)#clock rate 64000This command applies only to DCE interfacesRouter(config-if)#no shutdownRouter(config-if)#%LINK-5-CHANGED: Interface Serial0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to upRouter(config-if)#exitRouter(config)#interface Serial0/1Router(config-if)#ip address 192.168.3.2 255.255.255.0Router(config-if)#clock rate 64000This command applies only to DCE interfacesRouter(config-if)#no shutdownRouter(config-if)#%LINK-5-CHANGED: Interface Serial0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
Router0的配置Router>enableRouter#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#interface Serial0/0Router(config-if)#ip address 192.168.1.1 255.255.255.0Router(config-if)#clock rate 64000This command applies only to DCE interfacesRouter(config-if)#no shutdownRouter(config-if)#Router(config-if)#exitRouter(config)#interface Serial0/1Router(config-if)#ip address 192.168.2.1 255.255.255.0Router(config-if)#clock rate 64000Router(config-if)#no shutdownRouter(config-if)#%LINK-5-CHANGED: Interface Serial0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up%LINK-5-CHANGED: Interface Serial0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to upRouter(config-if)#exitRouter(config)#router ospf 1Router(config-router)#network 192.168.1.0 0.0.0.255 area 0Router(config-router)#network 192.168.2.0 0.0.0.255 area 0Router(config-router)#exitRouter(config)#exitRouter#%SYS-5-CONFIG_I: Configured from console by consoleRouter#ping 192.168.1.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 msRouter#ping 192.168.3.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:.....Success rate is 0 percent (0/5)Router#ping 192.168.2.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/7 msRouter#ping 192.168.3.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds:.....Success rate is 0 percent (0/5)

当只在Router0上配置了OSPF,Router0无法ping通Router1的s0/1端口,Router0无法ping通Router2的s0/1端口。
当在Router1、 Router2的串行接口的端口配置了OSPF之后,Router0、Router1、Router2的各个串行接口的端口之间就可以相互ping通了。

Router1Router>enRouter#conf tEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#router ospf 1Router(config-router)#net 192.168.1.0 0.0.0.255 area 0Router(config-router)#net 192.168.3.0 0.0.0.255 area 0Router(config-router)#exitRouter2Router>enRouter#Router#conf tEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#router ospf 1Router(config-router)#net 192.168.2.0 0.0.0.255 area 0Router(config-router)#net 192.168.3.0 0.0.0.255 area 0Router(config)#exitRouter0Router>enRouter#ping 192.168.1.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/11 msRouter#ping 192.168.3.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/7 msRouter#ping 192.168.2.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/5/12 msRouter#ping 192.168.3.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/6/8 ms

Router0上面续加的配置,只有这样才能使连接路由器Router0的两个以太网端口的主机能够ping通这个OSPF域Area 0 的所有端口,其他的路由器连接的主机同理。

Router0上面续加的配置Router#Router#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.Router(config)#int f0/0Router(config-if)#ip ad 10.0.0.1 255.255.255.0Router(config-if)#no shRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#exitRouter(config)#int f0/1Router(config-if)#ip ad 1.1.1.1 255.255.255.0Router(config-if)#no shRouter(config-if)#%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(config-if)#exitRouter(config)#router ospf 1Router(config-router)#net 10.0.0.0 0.0.0.255 area 0Router(config-router)#net 1.1.1.0 0.0.0.255 area 0Router(config-router)#exit

PC0上面的ping的情况

Packet Tracer PC Command Line 1.0PC>ping 192.168.1.1Pinging 192.168.1.1 with 32 bytes of data:Reply from 192.168.1.1: bytes=32 time=0ms TTL=255Reply from 192.168.1.1: bytes=32 time=0ms TTL=255Reply from 192.168.1.1: bytes=32 time=0ms TTL=255Reply from 192.168.1.1: bytes=32 time=0ms TTL=255Ping statistics for 192.168.1.1:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:    Minimum = 0ms, Maximum = 0ms, Average = 0msPC>ping 192.168.1.2Pinging 192.168.1.2 with 32 bytes of data:Reply from 192.168.1.2: bytes=32 time=6ms TTL=254Reply from 192.168.1.2: bytes=32 time=4ms TTL=254Reply from 192.168.1.2: bytes=32 time=1ms TTL=254Reply from 192.168.1.2: bytes=32 time=1ms TTL=254Ping statistics for 192.168.1.2:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:    Minimum = 1ms, Maximum = 6ms, Average = 3msPC>ping 192.168.3.1Pinging 192.168.3.1 with 32 bytes of data:Reply from 192.168.3.1: bytes=32 time=2ms TTL=254Reply from 192.168.3.1: bytes=32 time=3ms TTL=254Reply from 192.168.3.1: bytes=32 time=1ms TTL=254Reply from 192.168.3.1: bytes=32 time=3ms TTL=254Ping statistics for 192.168.3.1:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:    Minimum = 1ms, Maximum = 3ms, Average = 2msPC>ping 192.168.2.1Pinging 192.168.2.1 with 32 bytes of data:Reply from 192.168.2.1: bytes=32 time=1ms TTL=255Reply from 192.168.2.1: bytes=32 time=0ms TTL=255Reply from 192.168.2.1: bytes=32 time=0ms TTL=255Reply from 192.168.2.1: bytes=32 time=0ms TTL=255Ping statistics for 192.168.2.1:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:    Minimum = 0ms, Maximum = 1ms, Average = 0msPC>ping 192.168.2.2Pinging 192.168.2.2 with 32 bytes of data:Reply from 192.168.2.2: bytes=32 time=1ms TTL=254Reply from 192.168.2.2: bytes=32 time=1ms TTL=254Reply from 192.168.2.2: bytes=32 time=1ms TTL=254Reply from 192.168.2.2: bytes=32 time=8ms TTL=254Ping statistics for 192.168.2.2:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:    Minimum = 1ms, Maximum = 8ms, Average = 2msPC>ping 192.168.3.2Pinging 192.168.3.2 with 32 bytes of data:Reply from 192.168.3.2: bytes=32 time=3ms TTL=254Reply from 192.168.3.2: bytes=32 time=10ms TTL=254Reply from 192.168.3.2: bytes=32 time=2ms TTL=254Reply from 192.168.3.2: bytes=32 time=1ms TTL=254Ping statistics for 192.168.3.2:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:Minimum = 1ms, Maximum = 10ms, Average = 4msPC>ping 1.1.1.2Pinging 1.1.1.2 with 32 bytes of data:Request timed out.Reply from 1.1.1.2: bytes=32 time=0ms TTL=127Reply from 1.1.1.2: bytes=32 time=0ms TTL=127Reply from 1.1.1.2: bytes=32 time=0ms TTL=127Ping statistics for 1.1.1.2:    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),Approximate round trip times in milli-seconds:    Minimum = 0ms, Maximum = 0ms, Average = 0ms

查看Route0中命令对 OSPF 的运行进行诊断,观察诊断输出

Route0Router>enRouter#show ip routeCodes: 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 routeGateway of last resort is not set     1.0.0.0/24 is subnetted, 1 subnetsC       1.1.1.0 is directly connected, FastEthernet0/1     10.0.0.0/24 is subnetted, 1 subnetsC       10.0.0.0 is directly connected, FastEthernet0/0C    192.168.1.0/24 is directly connected, Serial0/0C    192.168.2.0/24 is directly connected, Serial0/1O    192.168.3.0/24 [110/128] via 192.168.1.2, 00:23:22, Serial0/0                    [110/128] via 192.168.2.2, 00:23:22, Serial0/1Router#show ip protocolRouting Protocol is "ospf 1"  Outgoing update filter list for all interfaces is not set   Incoming update filter list for all interfaces is not set   Router ID 192.168.2.1  Number of areas in this router is 1. 1 normal 0 stub 0 nssa  Maximum path: 4  Routing for Networks:    192.168.1.0 0.0.0.255 area 0    192.168.2.0 0.0.0.255 area 0    10.0.0.0 0.0.0.255 area 0    1.1.1.0 0.0.0.255 area 0  Routing Information Sources:      Gateway         Distance      Last Update     192.168.2.1          110      00:13:30    192.168.3.1          110      00:23:54    192.168.3.2          110      00:23:54  Distance: (default is 110)Router#show ip ospf neighbor Neighbor ID     Pri   State           Dead Time   Address         Interface192.168.3.1       0   FULL/  -        00:00:34    192.168.1.2     Serial0/0192.168.3.2       0   FULL/  -        00:00:30    192.168.2.2     Serial0/1

具体步骤
(1)按 上图所示 连接各路由器。
(2)按 上图所示 配置各路由器的各个接口 IP 地址等参数。
(3)配置路由器 Router0 、Router1 和 Router2 上的 OSPF 协议(假设三个路由器都处于区域 0,
除了各路由器的 loopback0 接口所在网络外,其他网络均要求可路由)。
在 Router0 上的配置如下:
Router0(config)#router ospf 1
Router0(config-router)#net 192.168.1.0 0.0.0.255 area 0
Router0(config-router)#net 192.168.2.0 0.0.0.255 area 0
(4)测试各网络之间的连通性。
在路由器 0 上是否能 ping 通路由器 1、路由器 2 的各个接口。
(5)利用下面的命令对 OSPF 的运行进行诊断,观察诊断输出。
1.log-adjacency-changes
2.show ip protocol
3.show ip route
4.show ip ospf neighbor
5.show ip ospf neighbor detail
6.show ip ospf database
7.show ip ospf interface
8.show ip ospf flood-list
9.show ip ospf process-id
10.debug ip ospf hello
11.debug ip ospf adj
12.debug ip ospf events
13.debug ip ospf flood
14.debug ip ospf packet
15.debug ip ospf spf

1 0
原创粉丝点击