Setting a custom MTU on a network device

581 views
Skip to first unread message

Charlie Moad

unread,
Apr 1, 2016, 10:13:22 AM4/1/16
to CoreOS Dev
Using the stable release, I'm unable to get the main network device to accept a custom MTU setting in the cloud config. DHCP seems to always take precedence.

I've tried:
    - name: 00-eth0.network
      runtime: true
      content: |
        [Match]
        Name=eth0
        [Link]
        MTUBytes=1387


And more complex:
    - name: 00-eth0.network
      runtime: true
      content: |
        [Match]
        Name=eth0
        [Network]
        DHCP=ipv4
        [DHCP]
        UseMTU=false
        UseDomains=true
        [Link]
        MTUBytes=1387

Any advise would be greatly appreciated.

Alex Crawford

unread,
Apr 1, 2016, 11:21:19 AM4/1/16
to coreo...@googlegroups.com
On 04/01, Charlie Moad wrote:
> Using the stable release, I'm unable to get the main network device to
> accept a custom MTU setting in the cloud config. DHCP seems to always take
> precedence.

Do these network settings take effect after a reboot? Since coreos-cloudinit
writes those units _after_ the network has started, they don't actually take
effect. You could test this by rebooting the machine (the network configs will
be present on disk early enough to take effect) and checking to see if the
settings were applied. If that is the issue, I would suggest using Ignition [1]
if possible (it is not yet supported on all of our platforms). Ignition runs
before systemd and networkd, so it is able to write the configs early enough.

-Alex

[1]: https://coreos.com/ignition/
signature.asc

Charlie Moad

unread,
Apr 1, 2016, 1:53:47 PM4/1/16
to coreo...@googlegroups.com
Rebooting did not change the MTU either. We run a mix of AWS and GCE with a majority of the CoreOS machines on GCE, so I don't believe Ignition is an option. I tried restarting systemd-networkd as well. Any other ideas on how to restart networking without having to restart the machine or just get the MTU to take in general?

For context, we're fighting packet loss over a VPN using IPSec. The recommended fix to us was reducing the MTU on the respective machines. 
--
Charlie Moad | Director of Production Operations

www.geofeedia.com (o) 317.661.4897
(c) 317.366.8687
geofeedia.com
______________________________________

55 Monument Circle, Suite 600, Indianapolis, IN 46204

LinkedIn

Learn More...

Brandon Philips

unread,
Apr 10, 2016, 9:31:44 PM4/10/16
to coreo...@googlegroups.com
Charlie-

You need to disable UseMTU in the DHCP configuration for networkd https://www.freedesktop.org/software/systemd/man/systemd.network.html#UseMTU=

Cheers,

Brandon

Charlie Moad

unread,
Apr 11, 2016, 9:44:04 AM4/11/16
to CoreOS Dev
Hey Brandon,

I don't know if you saw the "more complex" config in my original post, but I tried overriding that without success. Do you see anything wrong with my attempt there?

For reference as well, I have a workaround using the following unit in the cloud config:

    - name: custom-mtu.service
      command: start
      content: |
        [Unit]
        Requires=ens4v1.network
        [Service]
        Type=oneshot
        RemainAfterExit=yes
        ExecStart=/usr/bin/ip link set dev ens4v1 mtu 1387

Where "ens4v1" is the device. This is "eth0" on AWS.

Brandon Philips

unread,
Apr 11, 2016, 7:49:01 PM4/11/16
to CoreOS Dev
Charlie-

The example you have that doesn't work has a "match" of eth0 and the custom-mtu thing you have uses ens4v1. Seems like you need to fix the network file to use ens4v1.

Brandon

Charlie Moad

unread,
Apr 11, 2016, 8:02:58 PM4/11/16
to coreo...@googlegroups.com
I believe the example I posted was from my local testing using corectl on OSX. In addition to corectl and GCE I also tried on AWS, which uses eth0 as well.

Brandon Philips

unread,
Apr 13, 2016, 1:36:43 PM4/13/16
to coreo...@googlegroups.com
Hrm, the best I can suggest is generating some networkd logs as a next step: https://coreos.com/os/docs/latest/network-config-with-networkd.html#debugging-networkd


Reply all
Reply to author
Forward
0 new messages