I'm trying to forward port 53 from the host to one of my KVM virtual machine guests on the virtbr0 interface (which uses NAT).
The guest VM is going to run a customized DNS server. However, after port forwarding port 53, DNS will not resolve in the guest. I just keep getting the error of
Temporary failure in name resolution
If I delete my iptables rule from the host, DNS resolves again in the guest VM. What needs to be done to get DNS to work in the guest while allowing port 53 to be forwarded from the host to the guest?
IP tables rules I'm using in a hook script:
/sbin/iptables -I FORWARD -o virbr0 -d 192.168.122.5 -j ACCEPT /sbin/iptables -t nat -I PREROUTING -p tcp --dport 53 -j DNAT --to 192.168.122.5:53 /sbin/iptables -t nat -I PREROUTING -p udp --dport 53 -j DNAT --to 192.168.122.5:53
Anyone know? Other ports forwarded in this same manner appear to work as expected. DNS won't though, and I don't know why. I have port 53 forwarded on my home network router, and I don't have this issue. Maybe it's a KVM bug? I'm running CentOS 8 with the latest versions of qemu and kvm.