Change Pihole listening port from 53 to 7502

Is there a way to change pihole from listing to dns port 53? I want to use my custom port 7502 instead.

I tried to use IPTABLES, but it did not work.

iptables -t nat -A PREROUTING -p tcp --dport 7502 -j REDIRECT --to-port 53
iptables -t nat -A PREROUTING -p udp --dport 7502 -j REDIRECT --to-port 53

Set the port option in /etc/dnsmasq.conf:


Why do you want to change the port? The client devices might not support listening on a port different than 53.

I made the change in dnsmasq.conf, but every time I put in a custom port, pihole dns service wont start up, status shows red circle. Put it back to 53, then it starts ok again. Wont take in custom port.

I want to do the opposite. I have it in 9053 and I want to pass it to 53

I dont have /etc/dnsmasq.conf on pi running pihole.

No worries, changing the ports will break everything anyways.