I am trying to redirect all outbound DNS request(made from local) to a tunnel running on localhost listen for UDP on 127.0.0.1:5353.
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to 127.0.0.1:5353
Testing it with
nc -u -l -p 5353
nc -u 127.0.0.1 53
is fine, and udp session is working, but as I trying to test it with
nc -u 184.108.40.206 53
nc listening can receive the traffic, but reply it fail with
sent 2, rcvd 2 : Connection refused
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to 192.168.1.108:5353
can working correctly, and device running in the same wifi can receive and reply successfully.
I would like to thank you in advance for helping me.
Edit: DNS queries made with TCP are progressed separately, there is no need to consider it.