|
|
2#

楼主 |
发表于 2007-10-8 16:01:21
|
只看该作者

然后,在Router1上Ping Router4的接口:
Router1#Ping 34.0.0.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 34.0.0.4, timeout is 2 seconds:
5d21h: IP: s=12.0.0.1 (local), d=34.0.0.4 (Serial0/0), Len 100, sending.
5d21h: IP: s=12.0.0.1 (local), d=34.0.0.4 (Serial0/0), Len 100, sending.
……
Success rate is 0 percent (0/5)
现在情况看起来好点,Router1能发包到Router4,只是收不到任何从Router4返回的信息。看来Router4上也有问题:
Router4#
6d23h: IP: s=12.0.0.1 (Serial0/0), d=34.0.0.4 (Serial0/0), Len 100, rcvd 3
6d23h: IP: s=34.0.0.4 (local), d=12.0.0.1, Len 100, unroutable
……
Router4收到了ICMP的包,但由于没有到12.0.0.1的路由信息,因此无法响应12.0.0.1所发过来的包。在Router4上增加一条缺省路由:
Router4(config)#ip route 0.0.0.0 0.0.0.0 Serial0/0
这样问题得到了解决:
Router1#Ping 34.0.0.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 34.0.0.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/35/36 ms
实例 二:
网络结构如(图2)示:
![]()
图2
Router1上增加了一个LAN的接口:
Router1(config)#interface e0/1
Router1(config-if)#ip address
Router1(config-if)#ip address 20.0.0.1 255.255.255.0
结果LAN上的一台PC机能Ping通Router1,但却无法Ping通Router2,而在Router1上却能Ping通Router2。
Router1#Ping 12.0.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/7/9 ms
Router1#
5d23h: IP: s=12.0.0.1 (local), d=12.0.0.2 (Serial0/0), Len 100, sending
5d23h: IP: s=12.0.0.2 (Serial0/0), d=12.0.0.1 (Serial0/0), Len 100, rcvd 3
在路由器上使用普通Ping时,其源IP地址为路由器上Ping包所出去的接口IP地址,在路由器上能通过使用扩展的Ping命令来更改缺省的源IP地址。现在在router1上通过使用扩展的Ping命令来模拟从LAN上发包到Router2:
Router1#Ping
Protocol [ip]:
Target IP address: 12.0.0.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 20.0.0.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:
5d23h: IP: s=20.0.0.1 (local), d=12.0.0.2 (Serial0/0), Len 100, sending.
……
Success rate is 0 percent (0/5)
从上面的信息看,当源IP地址为20.0.0.1的时候, Router1能发包到Router2,只是无法收到Router2的响应包。解决的办法很简单,只有在Router2上增加一条路由到20.0.0.0就可以了。Ping成功的基本原则就是被Ping设备也必须知道如何发送回包到发起Ping的源地址。从Router1能Ping通Router2是因为默认下是把包出口的接口的IP地址作为源地址。但由于原先Router2并不知道新的LAN,所以当源地址为新的LAN的时候,就不知道如何发送回包到新的LAN。
从以上两个实例中可以看出来,在Debug命令的帮助下,我们也能通过Ping命令来发现和解决网络中的一些比较复杂的故障,而并不只是把它简单的作为测试网络是否通的工具而已。特别是路由器中的扩展的Ping命令所具有的可以任意设定源IP地址的特性,在实际使用当中更是能给我们在判断网络故障等方面带来很多的方便。 |
|