免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3646 | 回复: 1
打印 上一主题 下一主题

[原创]MTU的一个笔记 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-07 15:36 |只看该作者 |倒序浏览
#虽然说的的对象是对MTU,但实际讲的是ICMP报文,IP数据报,PPP数据帧的首部作加减计算\r\n#所有协议格式均参照《TCP/IP 详解》\r\n#菜鸟学习笔记,叙述有很多问题,望指正\r\n\r\n1.虚拟网关的检测\r\n\r\n[root@www ~]# netstat -in\r\nKernel Interface table\r\nIface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVRFlg\r\neth0       1500   0     1113      0      0      0      844      0      0      0BMRU\r\nlo        16436   0     2205      0      0      0     2205      0      0      0LRU\r\n#netstat -in 获取网卡(eth0)的MTU -- 1500\r\n#lo是 环回IP 的代号\r\n\r\n[root@www ~]# ping -c 4 -M do -s 1500 192.168.137.1\r\nPING 192.168.137.1 (192.168.137.1) 1500(1528) bytes of data.\r\nFrom 192.168.137.128 icmp_seq=0 Frag needed and DF set (mtu = 1500)\r\nFrom 192.168.137.128 icmp_seq=0 Frag needed and DF set (mtu = 1500)\r\nFrom 192.168.137.128 icmp_seq=0 Frag needed and DF set (mtu = 1500)\r\nFrom 192.168.137.128 icmp_seq=0 Frag needed and DF set (mtu = 1500)\r\n\r\n--- 192.168.137.1 ping statistics ---\r\n0 packets transmitted, 0 received, +4 errors\r\n#192.168.137.1 该虚拟机的网关\r\n#ping -s 命令发送出的IP数据报都是在IP首部设置不分片(DF)标志比特(包含的是ICMP报文)\r\n#反馈的信息是1500字节无法被发送\r\n#减去IP首部20字节和ICMP首部8字节得到1472进行测试\r\n\r\n[root@www ~]# ping -c 4 -M do -s 1472 192.168.137.1\r\nPING 192.168.137.1 (192.168.137.1) 1472(1500) bytes of data.\r\n1480 bytes from 192.168.137.1: icmp_seq=0 ttl=128 time=3.12 ms\r\n1480 bytes from 192.168.137.1: icmp_seq=1 ttl=128 time=1.00 ms\r\n1480 bytes from 192.168.137.1: icmp_seq=2 ttl=128 time=0.524 ms\r\n1480 bytes from 192.168.137.1: icmp_seq=3 ttl=128 time=0.621 ms\r\n\r\n--- 192.168.137.1 ping statistics ---\r\n4 packets transmitted, 4 received, 0% packet loss, time 3011ms\r\nrtt min/avg/max/mdev = 0.524/1.318/3.120/1.056 ms, pipe 2\r\n\r\n# :)\r\n#超过1472字节的都无法发送\r\n\r\n2.PPP设备的检测\r\n\r\n[root@www ~]# traceroute [url]www.baidu.com[/url]\r\ntraceroute: Warning: [url]www.baidu.com[/url] has multiple addresses; using 220.181.37.4\r\ntraceroute to [url]www.a.shifen.com[/url] (220.181.37.4), 30 hops max, 38 byte packets\r\n1  www (192.168.137.2)  2.101 ms  2.008 ms  2.349 ms\r\n2  * * *\r\n3  * * *\r\n#汗!虚拟机上测试出问题了,只检测到虚拟网关\r\n#我换在Windows2003测试下\r\n\r\nC:\\>tracert [url]www.baidu.com[/url]\r\n\r\nTracing route to [url]www.a.shifen.com[/url] [220.181.37.4]\r\nover a maximum of 30 hops:\r\n\r\n 1    23 ms    17 ms    16 ms  1.42.4.122.broad.jn.sd.dynamic.163data.com.cn [1\r\n22.4.42.1]\r\n 2    16 ms    15 ms    15 ms  222.173.1.145\r\n 3    18 ms    18 ms    18 ms  222.173.1.253\r\n 4    18 ms    19 ms    27 ms  222.173.1.77\r\n 5    17 ms    17 ms    16 ms  222.173.1.13\r\n 6    17 ms    18 ms    21 ms  219.146.19.1\r\n 7    32 ms    32 ms    42 ms  202.97.39.5\r\n 8    55 ms    55 ms    54 ms  202.97.34.45\r\n 9    54 ms    54 ms    56 ms  202.97.37.10\r\n10    55 ms    54 ms    58 ms  220.181.16.149\r\n11    63 ms    64 ms    70 ms  220.181.16.14\r\n12    56 ms    56 ms    56 ms  220.181.17.94\r\n13    55 ms    54 ms    55 ms  220.181.37.4\r\n\r\nTrace complete.\r\n#我们只截取拨号设备出去后的第一个目标地址122.4.42.1\r\n\r\nC:\\>ping -f -l 1472 122.4.42.1\r\n\r\nPinging 122.4.42.1 with 1472 bytes of data:\r\n\r\nRequest timed out.\r\nRequest timed out.\r\nRequest timed out.\r\nRequest timed out.\r\n\r\nPing statistics for 122.4.42.1:\r\n   Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)\r\n#-f命令 发送在IP首部设置不分片(DF)标志比特的包含ICMP报文的IP数据报\r\n# :( 失败!\r\n#再减去PPP首部的8个字节进行测试\r\n\r\nC:\\>ping -f -l 1464 122.4.42.1\r\n\r\nPinging 122.4.42.1 with 1464 bytes of data:\r\n\r\nReply from 122.4.42.1: bytes=1464 time=43ms TTL=255\r\nReply from 122.4.42.1: bytes=1464 time=49ms TTL=255\r\nReply from 122.4.42.1: bytes=1464 time=41ms TTL=255\r\nReply from 122.4.42.1: bytes=1464 time=46ms TTL=255\r\n\r\nPing statistics for 122.4.42.1:\r\n   Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),\r\nApproximate round trip times in milli-seconds:\r\n   Minimum = 41ms, Maximum = 49ms, Average = 44ms\r\n#:)\r\n#1464以上都无法发送!\r\n#over.

论坛徽章:
0
2 [报告]
发表于 2007-09-11 11:02 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP