KVM Port Forwarding Port 53 to Guest via NAT - Temporary failure in name resolution

Solution 1:

Your DNAT rules are too generic. They attempt to forward all DNS traffic to your VM, rather than just what should apply to, DNS traffic originating from outside. Thus when your guest DNS server sends its own DNS queries, they get redirected back to itself.

To fix the problem, also specify the interface on which incoming DNS traffic will arrive from the network, or alternately, the interface to exclude.

/sbin/iptables -t nat -I PREROUTING -i enp4s0 -p udp --dport 53 -j DNAT --to 192.168.122.5:53

or

/sbin/iptables -t nat -I PREROUTING \! -i virbr0 -p udp --dport 53 -j DNAT --to 192.168.122.5:53