4

I'm running Ubuntu Server 12.04 LTS, and I want to override the MTU my cable company provides via DHCP. They provide an MTU of 576 and I want to use 1492. I can change it with ifconfig, but it won't persist across reboots. I tried to edit the file /etc/network/interfaces, but the setting gets ignored on the interface (the MTU setting works on the internal interface that uses a static IP address). How can I make the interface force an MTU of 1492 even when it is provided with an MTU via DHCP?

5
  • 1
    Are you sure it actually works when you make it larger? Does ping -s 1484 somewhere.com actually work? If so then you should tell your ISP to fix their broken DHCP server. It is supposed to tell you what the maximum size is that they will accept, and so if you try to send anything larger, it will just be ignored.
    – psusi
    Sep 28 '13 at 3:42
  • Yes I am sure it works. I can ping google with large packet sizes. At this step, I am more interested in having control over my network. I will be doing optimization later.
    – Edwin
    Sep 28 '13 at 14:52
  • What do you mean by "the internal interface that uses a static IP address"? Is this a pure command-line server or do you have a GUI desktop installed (with network-manager)? Sep 28 '13 at 15:34
  • Even with ping -M dont -s 1484? I forgot that without the -M dont the packet will just be fragmented to fit into a smaller mtu. tracepath will also discover the actual mtu.
    – psusi
    Sep 28 '13 at 17:59
  • Yes it works, and yep, this is Ubuntu Server with no GUI I'm working with. I'm using the server as a NAT router. "Internal" interface is connected to my LAN and the "External" interface, with settings provided by DHCP, is connected to the WAN. I shouldn't have mentioned my circumstance. It doesn't matter. I'm just asking how can I override the MTU provided by a DHCP server.
    – Edwin
    Sep 29 '13 at 22:15
6

Edit the interfaces file to set the mtu when the interface comes up:

$ sudo vi /etc/network/interfaces

Edit the file so it includes the post-up line:

iface eth0 inet dhcp
    . . .
    post-up /sbin/ifconfig eth0 mtu 1500
2

Remove the interface-mtu option from /etc/dhcp/dhclient.conf and it will set 1500 as standard. This is due to erroneous setting of 576 being received from the ISP DHCP server.

1
  • I think I tried that, but not sure. I'll try it out again when I get a chance.
    – Edwin
    Jan 13 '14 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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