VM do not get IP from udhcpd in LXC

francoisd

Renowned Member
Sep 10, 2009
59
6
73
Hi,

VM dot not receive IP from DHCP server running in LXC.

No FW, no iptables, no ebtables, all policies on ACCEPT, (both in LXC & Proxmox VE host).

The DHCP server gets the requests, but the VM seems not to receive them.

The only specificity: they are both in the same tagged VLAN 66. Vlan (un)tagging is made by Proxmox VE for both servers, on top of the default Linux bridge. But I guess this has nothing to do with the problem.

Logs from the DHCP server running on a haproxy LXC:

Code:
root@haproxy:~# tail /var/log/syslog -n 10
Jan  6 11:42:55 haproxy udhcpd[126]: found static lease: 4b42a8c0
Jan 6 11:42:55 haproxy udhcpd[126]: sending ACK to 192.168.66.75
Jan 6 11:43:27 haproxy udhcpd[126]: found static lease: 4b42a8c0
Jan 6 11:43:27 haproxy udhcpd[126]: sending OFFER of 192.168.66.75
Jan 6 11:43:27 haproxy udhcpd[126]: found static lease: 4b42a8c0
Jan 6 11:43:27 haproxy udhcpd[126]: sending ACK to 192.168.66.75
Jan 6 11:43:59 haproxy udhcpd[126]: found static lease: 4b42a8c0
Jan 6 11:43:59 haproxy udhcpd[126]: sending OFFER of 192.168.66.75
Jan 6 11:43:59 haproxy udhcpd[126]: found static lease: 4b42a8c0
Jan 6 11:43:59 haproxy udhcpd[126]: sending ACK to 192.168.66.75

# And yes, there's a static lease for the VM:
root@haproxy:~# grep 192.168.66.75 /etc/udhcpd.conf
static_lease B2:84:3E:84:C9:33 192.168.66.75 # bootstrap
root@haproxy:~#



Do you have any idea ?
 
I have the same issue on the latest version. I use OPNsense for DHCP and the LXC container ( Debian 12 and Ubuntu 24.04 ) is using the exact same network settings as a VM where it DOES work on.
I can even ping the LAN gateway from the container but DHCP just doesn´t complete. If I move the PfSense VM to the same pve host as the container, it does work.

I had a similar issue with the VM before I got the VLAN settings right, so perhaps is has to do with VLAN and LXC combination ? tried installing vlan package and different clients, same issue. I get DHCP from a non-vlan port too.

Snippet of the Debian CT:
Oct 11 23:56:56 giteact ifup[7672]: udhcpc: started, v1.35.0
Oct 11 23:56:56 giteact ifup[7672]: udhcpc: broadcasting discover
Oct 11 23:56:59 giteact ifup[7672]: udhcpc: broadcasting discover
Oct 11 23:57:02 giteact ifup[7672]: udhcpc: broadcasting discover
Oct 11 23:57:05 giteact ifup[7677]: /etc/udhcpc/default.script: Lease failed:
Oct 11 23:57:05 giteact ifup[7672]: udhcpc: no lease, failing
Oct 11 23:57:05 giteact ifup[7660]: ifup: failed to bring up eth1

With dhcpcd:

root@giteact ~# dhcpcd eth1
dhcpcd-9.4.1 starting
DUID 00:04:03:00:02:00:04:00:05:00:00:06:00:07:00:08:00:09
eth1: IAID 11:d4:ca:ae
eth1: soliciting a DHCP lease
eth1: soliciting an IPv6 router
eth1: probing for an IPv4LL address
eth1: using IPv4LL address 169.254.223.96
eth1: adding route to 169.254.0.0/16
eth1: adding default route
forked to background, child pid 7754

any help is appreciated
 
finally found a way.
Indeed a vlan issue it seems.
So this fixed it for me:

https://wiki.debian.org/LXC/VlanNetworking

In my case , snippet from /etc/network/interfaces:
allow-hotplug eth1
auto eth1
iface eth1 inet dhcp

iface eth1.111 inet manual

auto br0.111
iface br0.111 inet manual
bridge_ports eth1.111
bridge_fd 0
bridge_maxwait 0

then dhcpcd eth1 and the route is added and all works.