Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have some Ubuntu 14.04 machines running in an Amazon VPC. When they start, they have an MTU of 9001, but this appears to cause some problems when communicating with other servers which have an MTU of 1500. When I use ip link set dev eth0 mtu 1500 these problems go away.

The problem is I can't seem to hit upon the correct way to make this permanent.

/etc/network/interfaces.d/eth0.cfg looks like this

auto eth0
iface eth0 inet dhcp
pre-up /sbin/ip link set dev eth0 mtu 1500

I've also tried adding mtu 1500 to bottom of that stanza too.

If I reboot, the machine comes back up with an MTU of 1500.

So what's the correct way to do this?

share|improve this question
    
Have you done anything besides changing the MTU? I recently started experiencing connection problems on some of my machines with the same setup (14.04, VPC) but changing the MTU doesn't solve them. –  makhan Oct 21 at 8:52
    
Nevermind, changed MTU to 1400 and it worked. After a bit of experimentation set it to 1468 (highest that works). –  makhan Oct 21 at 9:25

2 Answers 2

up vote 1 down vote accepted

Ran Rubinstein got me on the right track with this ubuntu forum thread.

The MTU is being set by DHCP, but we can override that with some changes to /etc/dhcp/dhclient.conf - here's how mine looks

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();

#added these two lines before the request line
default interface-mtu 1500;
supercede interface-mtu 1500;

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.fqdn, dhcp6.sntp-servers;

Having added these lines, I rebooted the machine to double check, and it came up with an MTU of 1500

share|improve this answer

This discussion: http://ubuntuforums.org/showthread.php?t=1284176 implies that when you have 'auto eth0' the mtu is set by the dhcp server and cannot be overriden in eth0.cfg. They have some suggestions there, but I simply set the mtu in /etc/rc.local

Edit: This bug https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1317811 seems to cover this issue. To prevent the network errors, you need to also run the command:

sudo ethtool -K eth0 sg off

Or you will continue to have errors.

share|improve this answer
    
giving you an upvote as that link did resolve it for me. Setting in rc.local wouldn't work for me as I think the MTU is getting reset once the machine has been on a few hours. –  Paul Dixon Jul 1 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.