RFC4821 proposes a mechanism to detect ICMP black holes and tries to adjust the path MTU in a smart way rather than performing DF set pings etc.
On Linux implementation of this mechanism is pretty straightforward and on recent distributions it comes built into the OS by default.
First check to see if probing is already enabled. To do this run:
cat /proc/sys/net/ipv4/tcp_mtu_probing
Value:
If on your machine it's disabled (value 0) or the file does not exist you can enable it by running the following:
echo 1 > /proc/sys/net/ipv4/tcp_mtu_probing
First check the current Base MSS Size with:
cat /proc/sys/net/ipv4/tcp_base_mss
If the value is anything other than 1024 then run the following:
echo 1024 > /proc/sys/net/ipv4/tcp_base_mss
This setting increases the starting MSS used in MTU discovery from default 512 bytes to 1024 as suggested by RFC4821.
All set! MTU probing should now be enabled and the optimal MTU value should be automatically used by the OS.