Change Pihole listening port from 53 to 7502

#1

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

#2

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

port=7502

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

#3

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.

#4

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