Wednesday, 18 August 2021

lxc container oracle/centos 8 not getting macvlan ip address


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!

  1. 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

  2. Next get into the container

lxc exec [container_name] bash

  1. Next install the old network-scripts package

dnf install network-scripts

  1. Next stop Network Manager

systemctl stop NetworkManager

  1. Now make sure it doesn’t start on container startup

systemctl disable NetworkManager

  1. Next enable the Network service (part of the network-scripts package)

systemctl enable network.service

  1. Exit out of the container

  2. 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.

  1. Test that the interface comes up

ifup eth0

No comments:

Post a Comment