I'm trying to redirect traffic on my DNS server. I have bind listening on port 5300 (UDP) instead of 53. I've got it working from the internal network but seem to have problem on redirecting localhost traffic. I've tried changing both PREROUTING and OUTPUT chains in the nat table but it doesn't seem to help.
iptables -A PREROUTING -t nat -p udp -i lo --dport domain -j REDIRECT --to-ports 5300
and
iptables -A OUTPUT -t nat -p udp -d localhost --dport domain -j REDIRECT --to-ports 5300
Anyone have luck doing this? What am I missing?
Thanks, Ben