Two IP addresses assigned to network

I created a Fedora 30 container on a CentOS 7 host. I’ve assigned it a static IP address in the config file:

Network configuration = veth = up = br0 = = = 00:16:3e:aa:61:34

When I run the container, eth0 has the correct IP address, but also has another IP address which appears to be assigned by DHCP:

lxc-info -n wiki

Name: wiki
PID: 22853

I can ping both IP addresses from other systems on the network.

How can I prevent the container from getting an IP address from DHCP?

Hi @eager

Because you are connecting your container to a bridge (br0), I am assuming that the network that br0 connects to has a DHCP service running on it. As such when the container starts up, any OS inside the container that is configure to configure the network interface via DHCP will get a dynamically assigned IP.

In addition to that, LXC will add any statically configure IPs to your interface, which is what you are seeing occur.

You have several options to stop the dynamically IPs being added to your container:

  1. Stop DHCP service on the br0 network (probably not a good idea if you have other hosts that rely on it).
  2. Modify the OS inside the container to not try to get an IP via DHCP
  3. Use a network mode like ipvlan that doesn’t support DHCP

Hope that helps :slight_smile: