Skip to content

Instantly share code, notes, and snippets.

@nad2000
Last active November 3, 2015 03:16
Show Gist options
  • Save nad2000/d131df4485658afedcf3 to your computer and use it in GitHub Desktop.
Save nad2000/d131df4485658afedcf3 to your computer and use it in GitHub Desktop.
# since Ubuntu still cannot find proper MTU with MTU=automatic. it gets set too low and causes connection problems.
# Hear is how to find MTU used on the current net by your AP:
# 1. Set up high (unrealistic) value, eg, 2000:
sudo ifconfig wlan0 mtu 2000
# 2. Ping a few times a well know host (suppressing fragmentation - Don't Fragment (DF)) with
# different packet sizes starting with.
# Either "any device along the path whose MTU is smaller than the packet will drop it, and send back an
# Internet Control Message Protocol (ICMP) Fragmentation Needed (Type 3, Code 4) message containing its MTU". Then you
# can use the given MTU. Or it fails and you need to reduce packet size till it gets through. Subtrackt 28 from the
# packet size and use it as your MTU.
ping -M do -s 1473 www.google.com
#> PING www.google.com (119.224.142.53) 1473(1501) bytes of data.
#> From NF4V.Home (192.168.20.1) icmp_seq=1 Frag needed and DF set (mtu = 1500)
#> ping: local error: Message too long, mtu=1500
# MTU=1500
# More reading:
# https://en.wikipedia.org/wiki/Path_MTU_Discovery
# http://muzso.hu/2009/05/17/how-to-determine-the-proper-mtu-size-with-icmp-pings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment