Redirect outbound traffic on port 53 to port 5300 with iptables
- by Zagorax
I'm running a local dns server on port 5300 to develop a software. I need my machine to use that dns but I wasn't able to tell /etc/resolv.conf to check on a different port. I searched a bit on google and I didn't find a solution.
I set 127.0.0.1 as nameserver on /etc/resolv.conf. Could you please tell me how can I redirect outbound traffic on port 53 to another port?
I tried the following but it didn't work:
iptable -t nat -A PREROUTING -p tcp --dport 53 -j DNAT --to 127.0.0.1:5300
iptable -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 127.0.0.1:5300