wiki'd

by JoKeru

DF & MTU

By default ping in any Linux-based system is sent with Don’t Fragment (DF) bit set.
Here is what you get by default ping in Linux:
* Don’t fragment bit (in echo request) – set
* IP packet size – 84 bytes (20 bytes IP Header + 8 bytes ICMP Header + 56 data bytes)

[cc lang='bash']
# default
\$ ping 2.2.2.2 -c 1
PING 2.2.2.2 (2.2.2.2) 56(84) bytes of data.
64 bytes from 2.2.2.2: icmp_req=1 ttl=55 time=24.9 ms
\$ tcpdump -v -ni eth0 host 1.1.1.1 and icmp
22:11:33.106964 IP (tos 0x0, ttl 56, id 59410, offset 0, flags [DF], proto ICMP (1), length 84)
1.1.1.1 > 2.2.2.2: ICMP echo request, id 32123, seq 1, length 64
22:11:33.106973 IP (tos 0x0, ttl 64, id 2757, offset 0, flags [none], proto ICMP (1), length 84)
2.2.2.2 > 1.1.1.1: ICMP echo reply, id 32123, seq 1, length 64

# DF off, increased size
\$ ping 2.2.2.2 -c 1 -M dont -s 1000
PING 2.2.2.2 (2.2.2.2) 1000(1028) bytes of data.
1008 bytes from 2.2.2.2: icmp_req=1 ttl=55 time=7.48 ms
\$ tcpdump -v -ni eth0 host 1.1.1.1 and icmp
22:31:55.324892 IP (tos 0x0, ttl 56, id 59414, offset 0, flags [none], proto ICMP (1), length 1028)
1.1.1.1 > 2.2.2.2: ICMP echo request, id 32170, seq 1, length 1008
22:31:55.324903 IP (tos 0x0, ttl 64, id 2761, offset 0, flags [none], proto ICMP (1), length 1028)
2.2.2.2 > 1.1.1.1: ICMP echo reply, id 32170, seq 1, length 1008

# DF on, size exceeding MTU
\$ ping 2.2.2.2 -c 1 -M do -s 1500
PING 2.2.2.2 (2.2.2.2) 1500(1528) bytes of data.
From 1.1.1.1 icmp_seq=1 Frag needed and DF set (mtu = 1500)

# MTU issue along the path, only 1482 bytes allowed
\$ tracepath -n 213.147.119.190 -l 1483
1: 188.241.72.1 0.245ms
2: 176.223.63.165 1.792ms
3: no reply
4: no reply
5: no reply
\$ tracepath -n 213.147.119.190 -l 1482
1: 188.241.72.1 0.228ms
2: 176.223.63.165 1.307ms
3: 195.219.148.37 56.431ms
4: 195.219.156.129 27.112ms asymm 6
5: 195.219.50.41 27.205ms
[/cc]

Comments