1

I want to have a flat configuration where the host and guest all have their own static addresses on the network. For some unknown reason however, the container is assigned 2 addresses, 192.168.0.110 and 192.168.0.201. I'm only interested in having one, 192.168.0.201.

The host's network configuration:

# Host /etc/network/interfaces
auto lxcbr0
iface lxcbr0 inet static
    bridge_ports p4p1
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0
    address 192.168.0.200
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1

The guest's configuration inside the host:

lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:08:b6:78
lxc.network.ipv4 = 192.168.0.201/24

The guest's network configuration:

auto eth0
iface eth0 inet dhcp

When I start the container and use lxc-ls -f I get:

NAME  STATE    IPV4                          IPV6                                    AUTOSTART  
----------------------------------------------------------------------------------------------
name  RUNNING  192.168.0.110, 192.168.0.201  2607:fa48:6de9:f3a0:216:3eff:fe08:b678  YES    
3

The reason is that you explicitly asked for two IP addresses.

First, you asked the host to configure a static IP address for the container, which is active as the container starts. Then you asked the container to request a second IP address with DHCP.

You should remove those two lines from /etc/network/interfaces if you don't want the second IP address.

  • When I remove those lines and reboot, I can't connect to the internet anymore. – SBSTP Feb 3 '15 at 16:27
  • It was a resolv.conf issue, not an IP address issue. You were right. – SBSTP Mar 18 '15 at 22:31
-3

if you have a DHCP sever on that network, you will get two IP address, one from the lxc's dhcp server and the second one from your network DHCP

  • This is not true. If there are two (conflicting) DHCP servers in a segment, the faster one to answer will "win" the assignment of the address. – Sven Mar 18 '15 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.