Making Android obey network MTU

Mrs B's phone ( Galaxy S2 ) runs Android 2.3.4 Gingerbread. Unfortunately, some picky servers on the Internet decline to respond to packets with 1500-byte MTUs, which is Android's default.

In usual inept Googlesque manner, the interface-mtu field in dhclient.conf has been commented-out, so Android will ignore any MTU provided to it in DHCP ( dhcp_option 26 ). And because that file in in /etc/, us mortal users who merely own the phone cannot edit the file to correct this stupidity. So the system blithely carries on with its 1500-byte MTU.

The workaround I found is to set the link MTU using an interface option in the IPv6 router advertisements. Assuming that you're using radvd and SLAC this is a one-line change in the radvd.conf on your network's router. For example here is my ( elided ) radvd.conf on a WRT54GL running OpenWRT:

interface br-lan {

       MaxRtrAdvInterval 60;        AdvLinkMTU 1492;  # this line does the trick        AdvSendAdvert on;        AdvManagedFlag off;        AdvOtherConfigFlag off;
       prefix 2001:0DB8:1:33::/64        {                AdvOnLink on;                AdvAutonomous on;                AdvRouterAddr on;        };


Since MTU has to be accepted by a client as part of the router advertisement spec, rather than being an option as it is in DHCP, those numpties at Google couldn't break it. So now the Galaxy S2 is happily running with 1492-byte packets and everything Just Works.