Skip to main content

Consul Notes

Last Updated: November 1st, 2021

Consul DNS Routing Setup

To set up Consul to respond to forwarded DNS requests run the following commands to redirect port 53 to 8600.

iptables -t nat -A OUTPUT -d localhost -p udp -m udp --dport 53 -j REDIRECT --to-ports 8600
iptables -t nat -A OUTPUT -d localhost -p tcp -m tcp --dport 53 -j REDIRECT --to-ports 8600
iptables -t nat -A PREROUTING -p udp -m udp --dport 53 -j REDIRECT --to-ports 8600
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 53 -j REDIRECT --to-ports 8600

If you have a Windows DNS environment you can set up to forward to consul. Use consul as the DNS Domain and enter your consul server IPs.

dns-forward

You can then add CNAME records in your domain and point it at a consul service.

dns-forward

PS> nslookup adguard
Server: sequoia.techstormpc.net
Address: 10.0.0.2

Name: adguard.service.consul
Address: 10.0.10.130
Aliases: adguard.techstormpc.net