I wanted to use the DHCPServer built-in of systemd-networkd to serve IPv4 addresses to my libvirt virtual clients and physical clients over the wire.
It seems the DHCPServer is not started:
- no trace of DHCPServer in Journal
- virtual clients cannot get IP leases
How can I troubleshoot my DHCPServer issue?
ps. When I manually assign IP address to my vm clients, they can access Internet without issues.
Hi @SampsonF, first you need to verify that you configured the DHCP server properly:
- In the Match section, is Name set to the right device, so the virtual bridge?
- Is Virtualization set properly?
- In the Network section, is the DHCP server activated?
- Forwarding and masqerading need to be activated most likely as well.
You can also post the configuration here, maybe a second pair of eyes helps.
Thanks for the hints.
My network is like this:
- Physcal level, a trunk port from my switch to enp1s0.
- WAN vlan2 is untagged, IPv4 and IPv6 DHCP from ISP
- vlan11 is tagged, a virtual vlan interface enp1s0.11@enp1s0 is created
- a bridge interface to vlan11, sdbr11, is created
- In libvirt, via virt-manager, I removed the built-in virtual networks.
- when creating VMs, I manually enter bridge interface name sdbr11
- I want VM clients be routed to my lab internal network. And only masquerade when accessing Internet.
In VM, DHCP cannot get offer.
After manually assign 192.168.22.123/24, gw 192.168.22.2, dns 188.8.131.52, access to Internet is OK.
Connect a physical machine to my switch, with vlan11 untagged, and manual IP assignment. That machine can ping VM clients and access to Internet also. (That machine also cannot get DHCP offers)
In Journal, I do not see any DHCPServer log messages.
How should I proceed?
I further testing systemd-networkd’s DHCPServer in hostapd
Same, there is no DHCP offer received by Wifi clients.
Wifi clients can access Internet using manual IP address assignment.
How to verify:
DHCPServer on a particular interface is running of not?
What kind of firewalld policy is needed to allow DHCP offers to work once DHCPServer is running?
I assume that the error is somewhere in the Match section, that the matches don’t add up. But the best is to do debugging now:
- First, make sure that your firewall actually allows traffic on the DHCP port /67 + 68 UDP).
- If that doesn’t help, enable debugging. After that, journald should provide you more information and maybe a hint to what the problem is.
Thank you for the pointer regarding debugging systemd-networkd. I will see what I can find in debug log enabled.
Personally, I think there is no [Match] issues in my .net* files. As when I manually assign IP address in remote machines (real and virtual), the network communication is OK.
Yes, I will try with firewall disabled in my host, once I find DHCPServer is running.