RFC1122 alapján az MTU definíciója valahogy így hangzik: maximális mérete a legnagyobb csomagnak (packet) ami átvihető a médián
Csomag méretébe márpedig a L3-as header is beletartozik, ahogy az az alábbi ábrán is látható:
A. Transmission on connected network: _______________________________________________ | LL hdr | IP hdr | (data) | |________|________|_____________________________| <---------- Frame ------------------------------> <----------Packet --------------------> Eredeti: http://www.faqs.org/rfcs/rfc1122.html#ixzz0fD7AGD7r
Tehát a hivatalos definició szerint az IP, ICMP, TCP, UDP header is beleszámít a csomag méretébe, ami az alábbi értékeket jelenti ping esetén:
IP: 20 byte
ICMP: 8 byte
Sajnos pingeléskor nem minden platform (IOS, Junos, Linux/Unix, Windows) gondolja így.
Linux/Unix és Juniper JunOS esetén (mivel a Junos FreeBSD-n alapul) a megadott méretre rájön a header (20+8 byte) mérete is. Vagyis ha az MTU 1500, akkor a maximális méret ezeken a rendszereken 1472 lehet (1500-28).
Cisco esetében a megadott méret a tényleges teljes L3-as csomag méretét jelenti. Vagyis amikor méretnek 1500-at adunk meg, akkor a teljes L3-as csomag mérete 1500 és payloadba csak 1472 bytenyi “adatot” fog tenni.
Cisco viselkedése logikusabbnak tünik, mivel igy nem kell figyelembe vennünk a header méretével járó extra byto-okat.
Tesztelésnél természetesen érdemes bekapcsolni a DF (Don’t fragment) bitet, hogy ne a fragmentáció miatt menjen át mégis a nagyobb csomag.
Windows
C:\>ping 10.10.10.1 -f -l 1500
Pinging 10.10.10.1 with 1500 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 10.10.10.1: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
C:\>ping 10.10.10.1 -f -l 1473
Pinging 10.10.10.1 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 10.10.10.1: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
C:\>ping 10.10.10.1 -f -l 1472
Pinging 10.10.10.1 with 1472 bytes of data:
Reply from 10.10.10.1: bytes=1472 time=22ms TTL=255 Reply from 10.10.10.1: bytes=1472 time=6ms TTL=255 Reply from 10.10.10.1: bytes=1472 time=3ms TTL=255 Reply from 10.10.10.1: bytes=1472 time=4ms TTL=255
Ping statistics for 10.10.10.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 3ms, Maximum = 22ms, Average = 9ms
Linux/Unix
ciscoworld:~# ping 10.10.10.1 -s 1472 -M do PING 10.10.10.1 (10.10.10.1) 1472(1500) bytes of data. 1480 bytes from 10.10.10.1: icmp_seq=1 ttl=255 time=2.88 ms
ciscoworld:~# ping 10.10.10.1 -s 1473 -M do PING 10.10.10.1 (10.10.10.1) 1473(1501) bytes of data. From 10.10.10.254 icmp_seq=1 Frag needed and DF set (mtu = 1500)
Juniper JunOS
[email protected]> ping 10.10.10.1 size 1500 do-not-fragment count 5 PING 10.10.10.1 (10.10.10.1): 1500 data bytes ping: sendto: Message too long ping: sendto: Message too long ping: sendto: Message too long ping: sendto: Message too long ping: sendto: Message too long — 10.10.10.1 ping statistics — 5 packets transmitted, 0 packets received, 100% packet loss
[email protected]> ping 10.10.10.1 size 1472 do-not-fragment count 5 PING 10.10.10.1 (10.10.10.1): 1472 data bytes 1480 bytes from 10.10.10.1: icmp_seq=0 ttl=255 time=21.156 ms 1480 bytes from 10.10.10.1: icmp_seq=1 ttl=255 time=21.221 ms 1480 bytes from 10.10.10.1: icmp_seq=2 ttl=255 time=21.252 ms 1480 bytes from 10.10.10.1: icmp_seq=3 ttl=255 time=21.222 ms 1480 bytes from 10.10.10.1: icmp_seq=4 ttl=255 time=21.923 ms
— 10.10.10.1 ping statistics — 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max/stddev = 21.156/21.355/21.923/0.286 ms
[email protected]> ping 10.10.10.1 size 1473 do-not-fragment count 5 PING 10.10.10.1 (10.10.10.1): 1473 data bytes ping: sendto: Message too long ping: sendto: Message too long ping: sendto: Message too long ping: sendto: Message too long ping: sendto: Message too long — 10.10.10.1 ping statistics — 5 packets transmitted, 0 packets received, 100% packet loss
Cisco IOS
R1#ping 10.10.10.1 size 1500 df-bit
Type escape sequence to abort. Sending 5, 1500-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: Packet sent with the DF bit set !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Router#ping 10.10.10.1 size 1501 df-bit
Type escape sequence to abort. Sending 5, 1501-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: Packet sent with the DF bit set ..... Success rate is 0 percent (0/5)
Cisco IOS XR
RP/0/2/CPU0:XR02#ping 10.10.10.1 size 1500 donnotfrag Tue Jan 26 12:41:12.121 CET Type escape sequence to abort. Sending 5, 1500-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
RP/0/2/CPU0:XR02#ping 10.10.10.1 size 1501 donnotfrag Tue Jan 26 12:44:41.977 CET Type escape sequence to abort. Sending 5, 1501-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: M.M.M Success rate is 0 percent (0/5)