how to manage macvlan devices?



I couldn't get NetworkManager to work in a container to bring up (virtual) NICs with static ip.  My hypothesis is that NM can't apply an Ethernet connection to a macvlan device, and wonder if there are workarounds that I may try.

The setup is as follows:

- The host is Ubuntu 18.04.  A macvlan nic is provided to containers with the following profile

devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: eno1
    type: nic

- The LXD container runs CentOS 7 with NM 1.18.0.

- The "old-style" network scripts work, with the following configuration file:

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
_ONBOOT_=yes
TYPE=Ethernet
BOOTPROTO=none
IPV4_FAILURE_FATAL="no"
IPADDR=10.1.16.92
PREFIX=16
GATEWAY=10.1.0.1

- But NM won't work.

# nmcli device
DEVICE  TYPE      STATE      CONNECTION
lo      loopback  unmanaged  --        
eth0    macvlan   unmanaged  --        

# nmcli connection
NAME         UUID                                  TYPE      DEVICE
System eth0  5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03  ethernet  --    

# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
23: eth0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
    link/ether 00:16:3e:10:b3:80 brd ff:ff:ff:ff:ff:ff link-netnsid 0

# nmcli connection up 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).

I tried "nmcli dev set eth0 managed yes" but still couldn't bring the connection up.

The error message probably claims that eth0 is not a suitable device (due to its type is macvlan).  I found a post back from 2010 https://mail.gnome.org/archives/networkmanager-list/2010-March/msg00308.html asking if NM can be forced to trade a macvlan as an Ethernet device, which might be related?

Anyway, since the "old-style" network scrips are already removed from CentOS 8, I really wonder if NM can be used in a container with macvlan devices.  Any suggestions?

Thank you!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]