Ubuntu – setup mtu automatically after system reboot


I have issues with slow internet and by changing mtu works fine for me.

I use Ubuntu 9.10 64bit system.

I have dynamic ip address setup

All the time after system bootup, I need to do the following command to make mtu setting take effect.

sudo ifconfig eth0 mtu 1492

Are there any way I can set it up using startup program.

As you know, sudo prompt me root password.

Best Answer

If you need to adjust your MTU permanently, do the following:

sudo vim /etc/network/interfaces

If you are using a static address then find the interface you need and simply add the MTU line:

iface eth0 inet static
mtu 1492

If you are using DHCP addresses then you need to set this before the interface comes up, by adding this line:

iface eth0 inet dhcp
pre-up /sbin/ifconfig $IFACE mtu 1492

Then release and renew (or up and down) the interface:

sudo ifdown eth0
sudo ifup eth0

(from UbuntuForums)