I have recently started to setup LXC containers again, however every container I am making is not being assigned an IPv4 address.
This was happening on Arch Linux and yesterday I decided to switch to Parrot OS as my daily driver, however the same issue is occurring.
/etc/default/lxc-net:
USE_LXC_BRIDGE="false"
LXC_BRIDGE="incusbr0"
LXC_ADDR="10.87.187.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.87.187.2/24"
LXC_DHCP_RANGE="10.87.187.2,10.87.187.254"
LXC_DHCP_MAX="252"
/etc/lxc/default.conf:
lxc.net.0.type = veth
lxc.net.0.link = incusbr0
lxc.net.0.flags = up
lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
I have tried running:
ufw allow in on incusbr0
ufw route allow in on incusbr0
And the same for lxcbr0 but still no IPv4 is assigned.
I also found another post saying to try adding a static IP so I did the following in the container:
ip addr add 10.87.187.2/24 dev eth0
This worked to get an IP assigned but trying to ping the host did not work and resulted in “Destination Unreachable”.
Output of “lsof -i:53” on host:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
dnsmasq 42922 incus 6u IPv4 1924485 0t0 UDP 10.87.187.1:domain
dnsmasq 42922 incus 7u IPv4 1924486 0t0 TCP 10.87.187.1:domain (LISTEN)
Output of “dhclient -v eth0” on the guest:
Internet Systems Consortium DHCP Client 4.4.2b1
Copyright 2004-2019 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0/00:16:3e:07:9f:c5
Sending on LPF/eth0/00:16:3e:07:9f:c5
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x6807e312)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 20 (xid=0x6807e312)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11 (xid=0x6807e312)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14 (xid=0x6807e312)
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8 (xid=0x6807e312)
No DHCPOFFERS received.
No working leases in persistent database - sleeping.