Note only DHCP configuration exhibits this particular issue. The cause
is that when "dhcp4" is set to "yes" in the /etc/netplan/*.yaml config
file, netplan would generate a temporary per-interface yaml file under
/run/netplan, which matches interface using MAC address. While I don't
see this specific MAC matching when using static IP configuration.

vsbalakr@ubuntu-18:~$ cat /run/netplan/ens3.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      match:
        macaddress: "ba:fb:9f:12:2f:02"
      set-name: ens3
      dhcp4: true
      dhcp-identifier: mac
      critical: true
vsbalakr@ubuntu-18:~$ cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: yes
      gateway4: 10.211.8.1
      nameservers:
              addresses: [10.211.11.1,10.209.76.197]

Which in turn gets systemd-networkd to generate these config files, also
using MAC address to match interface:

vsbalakr@ubuntu-18:~$ cat /run/systemd/network/10-netplan-ens3.link
[Match]
MACAddress=ba:fb:9f:12:2f:02
OriginalName=ens3

[Link]
Name=ens3
WakeOnLan=off
vsbalakr@ubuntu-18:~$ cat /run/systemd/network/10-netplan-ens3.network
[Match]
MACAddress=ba:fb:9f:12:2f:02
Name=ens3

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
Gateway=10.211.8.1
DNS=10.211.11.1
DNS=10.209.76.197

[DHCP]
UseMTU=true
RouteMetric=100
ClientIdentifier=mac
CriticalConnection=true

Why DHCP config needs to match MAC while static config doesn't? Is it
possible not to match by MAC for DHCP, unless users explicitly ask for
it?

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1820929

Title:
  netplan should consider adding more udev attribute for exact matching
  of failover 3-netdev interfaces

Status in netplan:
  Triaged
Status in netplan.io package in Ubuntu:
  Triaged
Status in systemd package in Ubuntu:
  Incomplete

Bug description:
  This bug is a follow-up to

  https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1815268

  after applying the 0001-net_failover-delay-taking-over-primary-device-
  to-acc.patch attached in that bug, the VF interface "eth0" is renamed
  to "rename4" instead of "ens4". Log is showing that attempt to rename
  "eth0" to "ens3" failed because of conflict with existing name, so
  that's why it ends up with rename4.

  vsbalakr@ubuntu-18:~$ uname -a
  Linux ubuntu-18 4.15.0-1009-oracle #11+lp1815268 SMP Tue Mar 12 15:20:15 UTC 
2019 x86_64 x86_64 x86_64 GNU/Linux
  vsbalakr@ubuntu-18:~$ ip l 
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode 
DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 
00:00:00:00:00:00 
  2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
mode DEFAULT group default qlen 1000 link/ether ba:fb:9f:12:2f:02 brd 
ff:ff:ff:ff:ff:ff 
  3: ens3nsby: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 
master ens3 state UP mode DEFAULT group default qlen 1000 link/ether 
ba:fb:9f:12:2f:02 brd ff:ff:ff:ff:ff:ff 
  4: rename4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master ens3 
state UP mode DEFAULT group default qlen 1000 link/ether ba:fb:9f:12:2f:02 brd 
ff:ff:ff:ff:ff:ff

  vsbalakr@ubuntu-18:~$ egrep -i '(rename4|busy)' /var/log/syslog
  ...
  Mar 18 11:01:52 ubuntu-18 NetworkManager[1294]: <info> [1552932112.9591] 
device (rename4): carrier: link connected
  Mar 18 11:01:52 ubuntu-18 NetworkManager[1294]: <info> [1552932112.9591] 
device (rename4): enslaved to non-master-type device ens3; ignoring
  Mar 18 11:01:53 ubuntu-18 systemd-udevd[2463]: error changing net interface 
name 'eth0' to 'ens3': Device or resource busy
  Mar 18 11:01:53 ubuntu-18 systemd-udevd[2463]: could not rename interface '4' 
from 'eth0' to 'ens3': Device or resource busy

  Within VM there's netplan config as below:

  vsbalakr@ubuntu-18:~$ cat /etc/netplan/01-netcfg.yaml
  # This file describes the network interfaces available on your system
  # For more information, see netplan(5).
  network:
    version: 2
    renderer: networkd
    ethernets:
      ens3:
        dhcp4: yes
        gateway4: 10.211.8.1
        nameservers:
                addresses: [10.211.11.1,10.209.76.197]

  By running udevadm test, we can see the conflicting ens3 name comes
  from netplan's /run/udev/rules.d/99-netplan-ens3.rules

  vsbalakr@ubuntu-18:~$ cat /run/udev/rules.d/99-netplan-ens3.rules
  SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="ba:fb:9f:12:2f:02", NAME="ens3"

  vsbalakr@ubuntu-18:/lib/udev/rules.d$ udevadm test --action="add" 
/sys/class/net/eth0
  calling: test
  version 237
  This program is for debugging only, it does not run any program
  specified by a RUN key. It may show incorrect results, because
  some values may be different, or not available at a simulation run.

  Load module index
  Parsed configuration file /lib/systemd/network/99-default.link
  Parsed configuration file /run/systemd/network/10-netplan-ens3.link
  Created link configuration context.
  Reading rules file: /lib/udev/rules.d/01-md-raid-creating.rules
  ..
  Reading rules file: /lib/udev/rules.d/99-vmware-scsi-udev.rules
  rules contain 393216 bytes tokens (32768 * 12 bytes), 38638 bytes strings
  25317 strings (216160 bytes), 21957 de-duplicated (180883 bytes), 3361 trie 
nodes used
  RUN '/lib/open-iscsi/net-interface-handler start' 
/lib/udev/rules.d/70-iscsi-network-interface.rules:2
  IMPORT builtin 'net_id' /lib/udev/rules.d/75-net-description.rules:6
  IMPORT builtin 'hwdb' /lib/udev/rules.d/75-net-description.rules:12
  RUN 'ifupdown-hotplug' /lib/udev/rules.d/80-ifupdown.rules:5
  IMPORT builtin 'path_id' /lib/udev/rules.d/80-net-setup-link.rules:5
  IMPORT builtin 'net_setup_link' /lib/udev/rules.d/80-net-setup-link.rules:9
  Config file /lib/systemd/network/99-default.link applies to device eth0
  link_config: autonegotiation is unset or enabled, the speed and duplex are 
not writable.
  link_config: could not set ethtool features for eth0
  Could not set offload features of eth0: Operation not permitted
  NAME 'ens4' /lib/udev/rules.d/80-net-setup-link.rules:11
  NAME 'ens3' /run/udev/rules.d/99-netplan-ens3.rules:1
  RUN '/lib/systemd/systemd-sysctl --prefix=/net/ipv4/conf/$name 
--prefix=/net/ipv4/neigh/$name --prefix=/net/ipv6/conf/$name 
--prefix=/net/ipv6/neigh/$name' /lib/udev/rules.d/99-systemd.rules:60
  error changing net interface name 'eth0' to 'ens3': Operation not permitted
  could not rename interface '4' from 'eth0' to 'ens3': Operation not permitted
  ACTION=add
  DEVPATH=/devices/pci0000:00/0000:00:04.0/net/eth0
  ID_BUS=pci
  ID_MM_CANDIDATE=1
  ID_MODEL_FROM_DATABASE=Ethernet Connection X552 Virtual Function
  ID_MODEL_ID=0x15a8
  ID_NET_DRIVER=ixgbevf
  ID_NET_LINK_FILE=/lib/systemd/network/99-default.link
  ID_NET_NAME=ens4
  ID_NET_NAME_MAC=enxbafb9f122f02
  ID_NET_NAME_PATH=enp0s4
  ID_NET_NAME_SLOT=ens4
  ID_PATH=pci-0000:00:04.0
  ID_PATH_TAG=pci-0000_00_04_0
  ID_PCI_CLASS_FROM_DATABASE=Network controller
  ID_PCI_SUBCLASS_FROM_DATABASE=Ethernet controller
  ID_VENDOR_FROM_DATABASE=Intel Corporation
  ID_VENDOR_ID=0x8086
  IFINDEX=4
  INTERFACE=eth0
  SUBSYSTEM=net
  SYSTEMD_ALIAS=/sys/subsystem/net/devices/ens3
  TAGS=:systemd:
  USEC_INITIALIZED=202183958
  run: '/lib/open-iscsi/net-interface-handler start'
  run: 'ifupdown-hotplug'
  run: '/lib/systemd/systemd-sysctl --prefix=/net/ipv4/conf/ens3 
--prefix=/net/ipv4/neigh/ens3 --prefix=/net/ipv6/conf/ens3 
--prefix=/net/ipv6/neigh/ens3'
  Unload module index
  Unloaded link configuration context.

  So with regard to failover 3-netdev model, MAC address is not
  sufficient to serve as the key to identify individual interface.
  Unfortunately driver attribute is not sufficient either, the failover
  master and standy slave share the same driver under virtio_net. There
  should be other new attribute to introduce in order to correctly
  identify the interface belonging to 3-netdev.

To manage notifications about this bug go to:
https://bugs.launchpad.net/netplan/+bug/1820929/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to