You are not logged in.
Pages: 1
Hey, I have several LXC containers that need network access.
At the moment I am manually assigning the IPs in the the relevant config file and everything works:
lxc.network.type = veth
lxc.network.flags = up
lxc.network.name = eth0
lxc.network.link = br0
lxc.network.ipv4 = 192.168.1.6/24
lxc.network.ipv4.gateway = 192.168.1.1
However I would like for my LXC containers to be allocated IPs using DHCP, preferably from my router, but from a DHCP server on the host if necessary.
I tried using gateway=auto and leaving out the ipv4 address, which according to some sources allows the container to establish a link (presumably with dhcpcd), but dhcpcd within the container reports no carrier.
How can I automatically allocate IP address to my lxc containers? Some of them run services that need to be accessible from the internet if that makes any difference.
Thanks
Edit:
My bridge is created using ip as described on the Network Bridge wiki
e.g.
ip link add br0 type bridge
ip link set enp3s0 master br0
Last edited by clanger (2016-06-03 23:13:46)
Offline
Hey clanger,
You don't need to use bridges that way simply do the following.
Open your /etc/network/interfaces file and do the following.
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast BROADCAST
gateway 192.168.1.1
auto eth0:1
iface eth0:1 inet dhcpc
netmask 255.255.255.0
This will allow you to allocate more ip's to network interfaces by linking them together.
Offline
A little extra info, broadcast BROADCAST=Your broadcast ip
Offline
Pages: 1