I am trying to debug my own DHCP server (for PXE), and I want QEMU to net boot from it. For that, it needs to send DHCPDISCOVER
packet to 255.255.255.255
that should reach host network where DHCP server is listening (it listens on 0.0.0.0
, and get back the reply.
Right now host DHCP server doesn't get any packets from QEMU. QEMU is started with standard user mode network (SLIRP).
qemu-system-x86_64
I read that SLIRP network is NAT that allows port forwarding. But I don't see how to forward DNS packets to host and back there. Is that at all possible to do with SLIRP?
Because there are no answers, I answer to myself. It is not possible to use host DHCP server with QEMU user mode networking and here is why. My QEMU version is 2.11.1 in case it will be fixed in the future.
DHCPDISCOVER
packets areUDP
and QEMU user mode networking (SLiRP) is NAT server that doesn't pass UDP packets anywhere. Instead it handles them internally. I wish I could be wrong, so feel free to correct me if current QEMU's udp.c behaves differently.