Matching by MAC address corrects the MTU issue on both Ubuntu 17.10 and Ubuntu 18.04.
I noticed one side effect though - this happened on fresh Ubuntu 17.10 and Ubuntu 18.04 installs. After adding the "match: ... macaddress: ..." parts to the YAML file, running "netplan apply" caused the "ens7" device to be renamed to "eth0". I'm not sure if this is related to my VM configuration, or if it's a bug in netplan. After rebooting, the "ens7" device name was used and the MTU was set properly. Details follow.
3: ens7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 5a:00:01:7d:18:9a brd ff:ff:ff:ff:ff:ff
...
After running "netplan apply":
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc fq_codel state UP group default qlen 1000
link/ether 5a:00:01:7d:18:9a brd ff:ff:ff:ff:ff:ff
inet 10.1.96.4/20 brd 10.1.111.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5800:1ff:fe7d:189a/64 scope link
valid_lft forever preferred_lft forever
Dmesg shows:
[ 585.985711] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 586.812306] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Journalctl shows:
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: ens3: Gained IPv6LL
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: Enumeration completed
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: ens3: Link is not managed by us
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: lo: Link is not managed by us
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: eth0: IPv6 successfully enabled
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: lo: Link is not managed by us
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: ens3: DHCPv4 address 45.77.216.215/23 via 45.77.216.1 unit='dbus-org.freedesktop.hostname1.service' requested by ':1.9' (uid=100 pid=925 comm="/lib/systemd/systemd-networkd " label="unconfined")
May 09 23:03:44 ubuntu1804 systemd-networkd[925]: ens3: Configured
May 09 23:03:45 ubuntu1804 systemd-networkd[925]: eth0: Gained carrier
May 09 23:03:47 ubuntu1804 systemd-networkd[925]: eth0: Gained IPv6LL
May 09 23:03:47 ubuntu1804 systemd-networkd[925]: eth0: Configured
Matching by MAC address corrects the MTU issue on both Ubuntu 17.10 and Ubuntu 18.04.
I noticed one side effect though - this happened on fresh Ubuntu 17.10 and Ubuntu 18.04 installs. After adding the "match: ... macaddress: ..." parts to the YAML file, running "netplan apply" caused the "ens7" device to be renamed to "eth0". I'm not sure if this is related to my VM configuration, or if it's a bug in netplan. After rebooting, the "ens7" device name was used and the MTU was set properly. Details follow.
----
My "/etc/netplan/ 10-ens7. yaml" contains:
network:
version: 2
renderer: networkd
ethernets:
ens7:
match:
macaddress: 5a:00:01:7d:18:9a
mtu: 1450
dhcp4: no
addresses: [10.1.96.4/20]
Before running "netplan apply":
3: ens7: <BROADCAST, MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 5a:00:01:7d:18:9a brd ff:ff:ff:ff:ff:ff
...
After running "netplan apply":
4: eth0: <BROADCAST, MULTICAST, UP,LOWER_ UP> mtu 1450 qdisc fq_codel state UP group default qlen 1000 1ff:fe7d: 189a/64 scope link
link/ether 5a:00:01:7d:18:9a brd ff:ff:ff:ff:ff:ff
inet 10.1.96.4/20 brd 10.1.111.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5800:
valid_lft forever preferred_lft forever
Dmesg shows:
[ 585.985711] IPv6: ADDRCONF( NETDEV_ UP): eth0: link is not ready NETDEV_ CHANGE) : eth0: link becomes ready
[ 586.812306] IPv6: ADDRCONF(
Journalctl shows:
May 09 23:03:44 ubuntu1804 systemd- networkd[ 925]: ens3: Gained IPv6LL networkd[ 925]: Enumeration completed networkd[ 925]: ens3: Link is not managed by us networkd[ 925]: lo: Link is not managed by us networkd[ 925]: eth0: IPv6 successfully enabled networkd[ 925]: lo: Link is not managed by us networkd[ 925]: ens3: DHCPv4 address 45.77.216.215/23 via 45.77.216.1 unit='dbus- org.freedesktop .hostname1. service' requested by ':1.9' (uid=100 pid=925 comm="/ lib/systemd/ systemd- networkd " label="unconfined") networkd[ 925]: ens3: Configured networkd[ 925]: eth0: Gained carrier networkd[ 925]: eth0: Gained IPv6LL networkd[ 925]: eth0: Configured
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:44 ubuntu1804 systemd-
May 09 23:03:45 ubuntu1804 systemd-
May 09 23:03:47 ubuntu1804 systemd-
May 09 23:03:47 ubuntu1804 systemd-