Skip to main content
added 22 characters in body; edited title
Source Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k

LXC container Set up DHCP for LXC containers

I have several lxc containers that need network access. At the moment I am manually allocating them IP addresses in the releventrelevant config file as so:

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

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 

This works but does not scale and can conflict with my routers DHCP allocation. I try to use my router dhcp by leaving out the lxc.network.ipv4 lines (as described online elsewhere), and the container starts but dhcpcd reports no carrier. lxc-ls --fancy also does not show my container has an IP address. The bride is up and lxc.network.link set in the config file.

How can I use DHCP with my containers? Is it possible to use my routers DHCP, or do I need to run a server on my host? Some of my containers do need to be accessible from the outside, where as some only need to communicate to other containers/host.

I'm running arch linux, most of the help online seems ubuntu specific.

LXC container DHCP

I have several lxc containers that need network access. At the moment I am manually allocating them IP addresses in the relevent config file as so:

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

This works but does not scale and can conflict with my routers DHCP allocation. I try to use my router dhcp by leaving out the lxc.network.ipv4 lines (as described online elsewhere), and the container starts but dhcpcd reports no carrier. lxc-ls --fancy also does not show my container has an IP address. The bride is up and lxc.network.link set in the config file.

How can I use DHCP with my containers? Is it possible to use my routers DHCP, or do I need to run a server on my host? Some of my containers do need to be accessible from the outside, where as some only need to communicate to other containers/host.

I'm running arch linux, most of the help online seems ubuntu specific.

Set up DHCP for LXC containers

I have several lxc containers that need network access. At the moment I am manually allocating them IP addresses in the relevant config file as so:

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 

This works but does not scale and can conflict with my routers DHCP allocation. I try to use my router dhcp by leaving out the lxc.network.ipv4 lines (as described online elsewhere), and the container starts but dhcpcd reports no carrier. lxc-ls --fancy also does not show my container has an IP address. The bride is up and lxc.network.link set in the config file.

How can I use DHCP with my containers? Is it possible to use my routers DHCP, or do I need to run a server on my host? Some of my containers do need to be accessible from the outside, where as some only need to communicate to other containers/host.

I'm running arch linux, most of the help online seems ubuntu specific.

Source Link
keda
  • 82
  • 1
  • 8

LXC container DHCP

I have several lxc containers that need network access. At the moment I am manually allocating them IP addresses in the relevent config file as so:

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

This works but does not scale and can conflict with my routers DHCP allocation. I try to use my router dhcp by leaving out the lxc.network.ipv4 lines (as described online elsewhere), and the container starts but dhcpcd reports no carrier. lxc-ls --fancy also does not show my container has an IP address. The bride is up and lxc.network.link set in the config file.

How can I use DHCP with my containers? Is it possible to use my routers DHCP, or do I need to run a server on my host? Some of my containers do need to be accessible from the outside, where as some only need to communicate to other containers/host.

I'm running arch linux, most of the help online seems ubuntu specific.