A little backstory:
I’m trying to recreate a libvirt NAT network but using a custom dnsmasq config. I know that in libvirt 5.6 they added the capability to directly pass options to dnsmasq (https://libvirt.org/formatnetwork.html#elementsNamespaces). Unfortunately due to some company policy my workstation is stuck on RHEL 7 with only libvirt 4.5. The whole reason I want to to this is to get PXE working for my VMs on booth bios and EFI. I’d really like to get this working on my workstation so I decided screw libvit I can do everything myself.
What I have done already and works:
I created a bridge with NetworkManager and called it pxebr and gave it the address 10.80.80.254/24.
Just to be sure I made a separate firewalld zone for it which looks like this:
pxebr (active)
target: default
icmp-block-inversion: no
interfaces: pxebr
sources:
services: dhcp dns mountd nfs rpc-bind tftp
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
I checked for ip forwarding in sysctl.conf which was already on so nothing to do there. To get NAT working I added a rich rule to the zone I have my external connections in rule family="ipv4" source address="10.80.80.0/24" masquerade
All of this worked fine and the VM I tested with had access to the internet.
To set up dnsmasq I roughly followed this guide and set up dnsmasq with systemd as it recomends here. I simply enabled dnsmasq@pxebr using the dnsmasq@ service file the guide recomends.
My dnsmasq.conf looks like this (i commented out PXE options for debugging):
strict-order
local=/pxebr/
domain=pxebr
expand-hosts
except-interface=lo
bind-dynamic
interface=pxebr
dhcp-range=10.80.80.101,10.80.80.250
dhcp-no-override
dhcp-authoritative
#enable-tftp
#tftp-root=/var/lib/tftpboot
#pxe-service=X86PC, "Boot BIOS PXE", grub/i386-pc/core.0
#pxe-service=BC_EFI, "Boot EFI-64 PXE", grub/x86_64-efi/core.efi
#pxe-service=X86-64_EFI, "Boot EFI-64 PXE", grub/x86_64-efi/core.efi
#pxe-service=IA32_EFI, "Boot EFI-32 PXE", grub/i386-efi/core.efi
#dhcp-boot=grub/i386-pc/core.0
dhcp-lease-max=150
dhcp-hostsfile=/var/lib/dnsmasq/pxebr/hostsfile
dhcp-leasefile=/var/lib/dnsmasq/pxebr/leases
pid-file=/run/pxebr-dnsmasq.pid
log-dhcp
Issue:
My VM simply doesn’t get an ip address. If i try tcpdump -i pxebr from the host the dhcp requests are being received. Dnsmasq is running and listening and DNS works fine if I manually set it. ss -tulpan gives the following for my process:
udp UNCONN 0 0 10.80.80.254:53 *:* users:(("dnsmasq",pid=23707,fd=6))
udp UNCONN 0 0 *%pxebr:67 *:* users:(("dnsmasq",pid=23707,fd=4))
udp UNCONN 0 0 [fe80::c811:45f5:46cd:9f3]%pxebr:53 [::]:* users:(("dnsmasq",pid=23707,fd=9))
tcp LISTEN 0 5 10.80.80.254:53 *:* users:(("dnsmasq",pid=23707,fd=7))
tcp LISTEN 0 5 [fe80::c811:45f5:46cd:9f3]%pxebr:53 [::]:* users:(("dnsmasq",pid=23707,fd=10))
Any amount of help is appreciated. Maybe I’m missing something obvious but to me everything seems like it should work. Any amount of google brought me to firewall or dnsmasq.conf issues both of which I believe to be correct. Thank you
UPDATE:
It definitely a firewall problem since if I stop firewalld dhcp works as expected. Unfortunately turning the firewall off is not an option because a.) It’s what is responsible for my NAT to work and b.) it’s really not a good idea. Interestingly moving the interface to the trusted zone doesn’t fix the problem.