How to change MTU size on Wifi/Ethernet

Hi, good evening. Im trying to change the mtu size of my 4G Hotspot connection. You will wonder, why this guy want to change the MTU.

Well long story, ive been discussing with my provider because the downloads were inconstant when using the hotspot in 4G. Curiously in the 3G protocol the connection is ok, it loads both down and up the files till the end… So later we’ve found that the problem is that the mtu definition on the antennas for 4G is below the standard 1500 while in 3G respects the standard value. Later ive changed the MTU definition on both my macs, the android and iOS remained in the 1500 (i think i will pass to the provider the duty to solve the case on both this devices…), also changed it in my RPI2 OSMC in the past after a lot of googling.

Now ive reinstalled the OSMC on the machine but i dont remember how to change the MTU. And im stucked on this. If you could help i would be very grateful.

Thank you, and congratulations for this lovely piece of software.

Hello, any idea about this subject???

Nope, not off hand.

OSMC uses connman for its network manager so I suggest you do a google search or check the connman documentation to see if there is a way to change the MTU.

WLAN or LAN nothing differences… every router i know use MTU 1500 for this and it’s all a LAN Interface.

The MTU it’s been used only on WAN… 1492 for PPPoA or 1500 for PPPoE…

I looked around but didn’t find a connman setting to change MTU in their documentation.

You can change it on the fly using sudo ifconfig wlan0 mtu 1200, where 1200 is obviously the MTU size you want. To confirm it worked, do an ifconfig wlan0 | grep -i mtu and look at the MTU number.

Doing the change this way though will not survive a reboot though, it’ll be reset back. If you wanted to make it permanent, execute the command sudo nano /etc/rc.local and add the following line BEFORE exit0:

ifconfig wlan0 mtu 1200

Save and exit using Ctrl+x, then y, then Enter.

NOTE: If you’re using a wired connection, change wlan0 to eth0.

This will not be reliable - the rc.local.service is configured to start after connman has started, but there is no guarantee that it will be run after the network interface is up, more often than not rc.local will run before the network goes up.

So I would not rely on this approach.

Yep as far as i know all the routers ive used have that same number (1500). Even on this Wireless Hotspot i havent found any issue related to MTU broken packages (which it seems to break the connection flow) while im using it in 3G protocols. But as soon its working on 4G it just fail if the machine connected use a MTU of 1500. Using value below 1328 makes this issue disappear.

Ive been doing the command sudo ifconfig eth0 mtu 1320 and it solves the issue temporarily. But you know its bad to have to execute this command everytime i reboot the machine. Need a permanent solution. I know that there is one change in the root that allows to change the mtu of a single connection permanently cause ive changed it before, but i cant remember how i have it done, sadly.

Thank you man. It works. Simple solution. Perfect!

Yes. sudo ifconfig wlan0 mtu 1200 is an easy way to do this.
An easy way to get this setting every time you (re)boot is to enter it into your, in my case,~/.bashrc file.