|
|
| 首页 | 技术文章 | 软件下载 | 博客 | 论坛 | 精品教程 | 黑客动画 | 视频资源 | 在线服务 | 黑客游戏 | | ||||
|
|
||||||||
|
||||||||
|
|||||
| 小命令大作用 通过Ping排除路由器故障 | |||||
作者:佚名 文章来源:网络 点击数: 更新时间:2007-6-12 ![]() |
|||||
|
在路由器上Ping返回符号的含义如下表所示: 符号 描述 ! 收到一个响应。 . 在等待时,网络服务器超时。 U 目标无法到达,受到错误的PDU。 Q 源消失(目标设备太忙)。 M 数据无法分割。 ? 包类型未知。 & 报的有效期过了。 在路由器上无法Ping通一个地址的原因有很多种,譬如线路故障,对方路由器的接口没有起来,路由器的路由表中没有该地址的路由信息等等都会造成网络无法Ping通。 实例一: 网络结构如(图1)示。 ![]() 图1 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 0 percent (0/5) 在Router1上无法Ping通Router4的接口,通过使用DEBUG命令来获得更多的信息,便于进一步的分析: Router1#debug ip packet IP packet debugging is on 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, Len 100, unroutable. 5d21h: IP: s=12.0.0.1 (local), d=34.0.0.4, Len 100, unroutable. …… Success rate is 0 percent (0/5) 我们看到 “unroutable”的消息,表明在Router1的路由表中不存在该地址的路由信息,Router1不知道该地址向何处转发,现增加一条缺省路由到Router1中: Router1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip route 0.0.0.0 0.0.0.0 Serial0/0 然后,再在Router1上使用Ping: 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: U.U.U Success rate is 0 percent (0/5) 6d03h: IP: s=12.0.0.1 (local), d=34.0.0.4 (Serial0/0), Len 100, sending 6d03h: ICMP type=8, code=0 6d03h: IP: s=12.0.0.2 (Serial0/0), d=12.0.0.1 (Serial0/0), Len 56, rcvd 3 6d03h: ICMP type=3, code=1 …… 再看看在Router2上收到了什么信息: Router2# 21:56:04: IP: s=12.0.0.1 (Serial1), d=34.0.0.4, Len 100, unroutable 21:56:04: ICMP type=8, code=0 21:56:04: IP: s=12.0.0.2 (local), d=12.0.0.1 (Serial1), Len 56, sending 21:56:04: ICMP type=3, code=1 …… 从上面的信息可以看出Router1已经能正确地发送包到Router2,但好象Router2并不知道如何转发地址34.0.0.4,所以Router2发送了“unreachable”的消息给Router1。因此分别给Router2和Router3加上动态路由协议RIP: Router2# router rip network 12.0.0.0 network 23.0.0.0 Router3# router rip network 23.0.0.0 network 34.0.0.0 然后,在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地址的特性,在实际使用当中更是能给我们在判断网络故障等方面带来很多的方便。 |
|||||
| 文章录入:IceRiver 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 用Dos命令加锁 防止病毒格式 网络攻击常用命令综述 用Syskey命令加强Windows200 用Dos命令进行加锁 防止病毒 巧用命令行 揪出ARP欺骗病毒 从命令行登陆QQ(QQ密码算法 双剑合一 用Pathping命令诊断 CourierIMAP XMAILDIR变量远 Delphi命令行参数 带注释手动注入脚本命令总结 |
网友评论:(只显示最新5条。评论内容只代表网友观点,与本站立场无关!) |
| 关于我们 - 版权声明 - 帮助(?) - 广告服务 - 联系我们 - 友情链接 - 用户注册 - | Powered by ICE RIVER - STUDIO |
| » CnXHacker.CoM | © CopyRight 2002-2006, CnXHacker.CoM™, Inc. All Rights Reserved. |