This has been beating us up here as well. Today, I found an answer. It may not be /the/ answer, but it does work. The problem is with CentOS 8 and the complete replacement of network-scripts with NetworkManager scripts. I know that there have been others searching for an answer to this in vain, so I’m offering up what I’ve found. Do with it what you may!
-
Create a centos8 container using the defaults (i.e., don’t apply macvlan to them on the build) so have it use the bridge interface, which is the default
-
Next get into the container
lxc exec [container_name] bash
- Next install the old network-scripts package
dnf install network-scripts
- Next stop Network Manager
systemctl stop NetworkManager
- Now make sure it doesn’t start on container startup
systemctl disable NetworkManager
- Next enable the Network service (part of the network-scripts package)
systemctl enable network.service
-
Exit out of the container
-
Now apply (or assign) your macvlan template to the container
lxc profile apply [container_name] default,macvlan
- Get into the container and modify the interface vi /etc/sysconfig/network-scripts/ifcfg-eth0
and set the interface with the IP or dhcp, depending on your setup. Save the configuration and get out.
- Test that the interface comes up
ifup eth0
which is where you will see the scripts complaining about using a deprecated procedure.
- assuming the interface comes up with an IP address, exit out of the container, stop it and start it again, and as long as it comes back up with the IP, you are golden.
That’s it. I’m hoping that this will help someone else not go down the rabbit holes that I have had to do to get this information, test it and apply it. Good Luck!
Steve