Hey guys, I have an Ubuntu VM running on a RHEL 9 host, and I am seeing weird behavior that I don’t know enough about DHCP in order to track down some more. So when my host machine’s firewalld is running, the VM is unable to receive a DHCP lease from it (using the default NAT network provided by libvirt). Here is the relevant Firewalld zone:
sudo firewall-cmd --zone libvirt --list-all
libvirt (active)
target: ACCEPT
icmp-block-inversion: no
interfaces: virbr0 virbr1
sources: 192.168.100.0/28 192.168.122.0/28
services: dhcp dhcpv6 dns postgresql tftp
ports:
protocols: icmp ipv6-icmp
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule priority="32767" reject
And the output from this dhclient test is the result of me beginning the test when the firewall is up, and subsequently stoppling the firewalld service on the host. It got the lease immediately after the firewall went down:
linuxdragon@build-runner-vm:~$ sudo dhclient -v -r enp7s0 && sudo dhclient -v enp7s0
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp7s0/52:54:00:53:88:4a
Sending on LPF/enp7s0/52:54:00:53:88:4a
Sending on Socket/fallback
DHCPRELEASE of 192.168.122.52 on enp7s0 to 192.168.122.1 port 67 (xid=0x4207101b)
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp7s0/52:54:00:53:88:4a
Sending on LPF/enp7s0/52:54:00:53:88:4a
Sending on Socket/fallback
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 3 (xid=0x22241a21)
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 8 (xid=0x22241a21)
^[[CDHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 8 (xid=0x22241a21)
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 14 (xid=0x22241a21)
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 20 (xid=0x22241a21)
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 15 (xid=0x22241a21)
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 14 (xid=0x22241a21)
DHCPDISCOVER on enp7s0 to 255.255.255.255 port 67 interval 20 (xid=0x22241a21)
DHCPOFFER of 192.168.122.52 from 192.168.122.1
DHCPREQUEST for 192.168.122.52 on enp7s0 to 255.255.255.255 port 67 (xid=0x211a2422)
DHCPACK of 192.168.122.52 from 192.168.122.1 (xid=0x22241a21)
bound to 192.168.122.52 -- renewal in 1682 seconds.
I’ve also done an additional test once before wherein I ran the DHCP client command on the VM while the host firewall is running. Simultaneously, I used tcpdump on the host to capture UDP packets on port 67. So the Host is at least seeing the DHCP request from the VM when the firewall is up.
P.S. I could easily solve this issue by putting this VM on a bridge to my LAN; but that’s a lot of work, and this VM doesn’t need that. Plus, I only have a limited number of physical network connections left on my PFSense box without additional hardware.