Can't set MTU on ethernet interface using example config

Bug #1791363 reported by Evgeniy Sudyr
34
This bug affects 4 people
Affects Status Importance Assigned to Milestone
netplan
Triaged
High
Unassigned

Bug Description

From https://github.com/CanonicalLtd/netplan/blob/master/doc/example-config it's not clear how to set mtu for ethernet physical NIC (Intel X710)

I used next config:

network:
  ethernets:
    ens1f0:
      mtu: 9000
      addresses:
        - 192.168.14.2/24
  version: 2

when running *netplan apply* I got no messages and I see that MTU was not changed when I checked with *ip link*

I did reboot and I see that netplan config was not applied (no IP address were set), I removed mtu and run *netplan apply* - it was applied.

I asked in IRC #netplan how to make it working and @cyphermox suggested to try match: macaddress to make it working.

I tried and it worked!

Working config:

network:
  ethernets:
    ens1f0:
      match:
        macaddress: ac:1f:6b:8a:xx:xx
      mtu: 9000
      addresses:
        - 192.168.14.2/24
  version: 2

I suggest:

1) Adjust examples and make bold note in documentation for setting MTU (e.g. say - set macaddress or it will not work);
2) Check why netplan apply was silently ignored config and not applied config when my first config above was in use after reboot. Maybe add error checking if mtu is set without match: macaddress.

Thanks to @cyphermox

Tags: mtu
Changed in netplan:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Daniel Axtens (daxtens) wrote :

Hi,

I'm sorry to hear that you too have hit this bug. It has got a lot of discussion on LP: #1724895. Normally I'd want to mark one as the duplicate of the other, but that bug has covered a lot of ground including cloud-init, so it's not super clear.

Perhaps we can use this to track the netplan-specific documentation issue and the parser error checking, and just focus on the weirdness with cloud-init in the other bug.

I will work on a docs fix - I think that's an important first step. I think parser error checking will be complicated because NetworkManager will set MTUs without a macaddress match (LP: #1769550), but I'll explore it as I have time.

Regards,
Daniel

Changed in netplan:
assignee: nobody → Daniel Axtens (daxtens)
Revision history for this message
Daniel Axtens (daxtens) wrote :

We do actually have a bolded note in the docs for this! But it isn't in the version in Bionic.

It reads:

     **Note:** This will not work reliably for devices matched by name
     only, due to interactions with device renaming in udev. Match
     devices by MAC when setting MTU.

Do you think that's sufficient?

I will still look into better validation, but it will take me a while to get to it.

Daniel Axtens (daxtens)
Changed in netplan:
assignee: Daniel Axtens (daxtens) → nobody
Revision history for this message
Jocelyn Pelletier (jpelletier) wrote :

@daxtens What if I want to force MTU to 1400 for all my cloned systems?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.