PC Ping vs. Cisco Ping

ping排錯功能的強大不在話下,下面着重對PC機上win系統的ping過程和cisco路由器上的ping的過程的差別進行研究。
首先在PC上,帶上-f參數,並指定源數據包大小,ping網關:
C:> ping 172.16.5.254 -l 1472 -f
Pinging 172.16.5.254 with 1472 bytes of data:
Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255
Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255
Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255
Reply from 172.16.5.254: bytes=1472 time=1ms TTL=255
Ping statistics for 172.16.5.254:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms
C:> ping 172.16.5.254 -l 1473 -f
Pinging 172.16.5.254 with 1473 bytes of data:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Ping statistics for 172.16.5.254:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
網卡的默認MTU是1500,經過設置DF位,咱們測試的結果是-l的值1472,而1500-20-8=1472正好是1472(記得否, ICMP包是直接封裝在IP包裏的,8個byte的ICMP包頭和20個byte的IP包頭),由 此能夠看出,在win xp/2k3環境下,ping進程對-l參數識別爲數據淨負荷,即,不包括IP包頭部分和ICMP包頭部分;

下面是在cisco路由器上的測試:
R6#sh int s1/1
Serial1/1 is up, line protocol is up 
  Hardware is M4T
  Internet address is 172.16.36.2/30
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 
-----------out put omit---------------------
R6# ping 192.168.100.3 size 1500  df-bit 
Type escape sequence to abort.
Sending 5, 1500-byte ICMP Echos to 192.168.100.3, timeout is 2 seconds:
Packet sent with the DF bit set
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/47/68 ms
R6# ping 192.168.100.3 size 1501  df-bit 
Type escape sequence to abort.
Sending 5, 1501-byte ICMP Echos to 192.168.100.3, timeout is 2 seconds:
Packet sent with the DF bit set
.....
顯然,cisco設備上的ping進程的-size參數表示的是MTU,包括了IP報頭和ICMP包頭。你發現了沒?
ping x.x.x.x size x df 命令是解決因爲網絡MTU引發的網絡故障的超必殺, 通過GRE隧道、PPPOE撥號、 MPLS ×××等多種網絡環境,都會產生大包不通,表現爲,某些網頁打不開、沒法下載大容量文件,均可以用這個命令來探測網絡通過各類環境下的單包最大數據淨負荷(最大三層信息),並經過修改MTU以實現網絡的暢通無阻
 原文地址 [url]http://hi.baidu.com/gotoccie/blog/item/fbb1af44c258d782b2b7dcbd.html[/url]
相關文章
相關標籤/搜索