LXD 3.0.3 adding a managed network interface with dhcp

networking

#1

I have create a new network interface:

lxc network show lxdbr0
  config:
  ipv4.address: 10.27.158.1/24
  ipv4.dhcp: "true"
  ipv4.dhcp.ranges: 10.27.158.200-10.27.158.250
  ipv4.nat: "true"
  ipv4.routing: "true"
  ipv6.address: none
  ipv6.dhcp: "false"
description: ""
name: lxdbr0
type: bridge
used_by:
- /1.0/containers/nextcloud
managed: true
status: Created
locations:
- none

I have attached it to a container has shown. Next the container wouldn’t get an IP over DHCP. After searching around I noticed the container is using netplan. I so ended up editing nano /etc/netplan/50-cloud-init.yaml and adding eth0 with dhcp4: true.

Now I am wondering if it is the way to go or if that can/should be set from the host ?


(Stéphane Graber) #2

Containers should normally come with DHCPv4 pre-enabled so I’m unsure why you had to manually alter your container.

Could you show lxc config show --expanded NAME for that container?


#3

Weird enough I cannot reproduce it …