Gargoyle should give out specified DNS servers to users

Report wireless and/or network connectivity problems in this forum.

Moderator: Moderators

Post Reply
Waterspuwer
Posts: 36
Joined: Mon Nov 12, 2018 6:04 am

Gargoyle should give out specified DNS servers to users

Post by Waterspuwer »

At the moment the DHCP server is always returning the router's IP address as the DNS server to the clients. How can I change it so that the DNS servers are returned to the DHCP clients?

RomanHK
Posts: 794
Joined: Sat May 04, 2013 4:18 pm
Location: Czech Republik

Re: Gargoyle should give out specified DNS servers to users

Post by RomanHK »

You can do this manually.
If you want DNS for all clients, follow these steps:

Code: Select all

uci add_list dhcp.lan.dhcp_option="6,8.8.8.8,8.8.4.4"
uci commit dhcp
/etc/init.d/dnsmasq restart
More information here: https://openwrt.org/docs/guide-user/bas ... cp_options
Turris Omnia with OpenWrt 21.02 - Tested
Linksys WRT3200ACM with Gargoyle 1.13.x
TL-WR1043ND v2 with Gargoyle 1.10.0

http://gargoyle.romanhk.cz custom builds by gargoyle users

Waterspuwer
Posts: 36
Joined: Mon Nov 12, 2018 6:04 am

Re: Gargoyle should give out specified DNS servers to users

Post by Waterspuwer »

Thanks for the reply, that seems doable. Anything possible to read these values from Gargoyle web interface?
Would be nice if there was a setting in web interface somewhere to give out these servers to clients, this is what most routers do I've used in the past.

E:
A friend helped me with a script to place in init.d, this:
#!/bin/sh

START=10
STOP=15

start() {
v=$(uci get network.lan.dns)
d="6,${v}"
uci set dhcp.lan.dhcp_option="$d"
uci commit dhcp
/etc/init.d/dnsmasq restart
}

stop() {
echo 'done'
}
Restart router after you change the DNS through web interface.

I still think an option for this should exist in UI though, I've recently received a Raspberry Pi with PiHole and for stats I have no use in only seeing the router show up.

Eric3K
Posts: 3
Joined: Mon May 01, 2023 4:20 pm

Re: Gargoyle should give out specified DNS servers to users

Post by Eric3K »

If your home network is using a separate DNS server like Pi-hole, you should consider adjusting your router configuration so that the DNS server's address is only given to DHCP clients, and not used by the router itself. Why? Because if you enable a feature like Pi-hole's conditional forwarding, which allows the server to map IP addresses to names by looking them up in the router's DNS, any such queries that the router can't answer will be forwarded back to the DNS server, creating an infinite loop until the maximum number of queries per second is reached.

I found that devices which are capable of unicast DNS service discovery (e.g. Apple devices) would often check if the DNS had any services to advertise by issuing PTR queries for b._dns-sd._udp.0.1.168.192{dot}in-addr{dot}arpa, lb._dns-sd._udp.0.1.168.192{dot}in-addr{dot}arpa, or db._dns-sd._udp.0.1.168.192{dot}in-addr{dot}arpa (depending on the IP address range in use). Also, since I had a custom local domain set to "home" on both the router and Pi-hole's conditional forwarding, PTR queries for b._dns-sd._udp.home, lb._dns-sd._udp.home, and db._dns-sd._udp.home were also being issued and bouncing back and forth. But it's not just these automated queries that be problematic; something as simple as running

Code: Select all

host LocalDeviceName.home
issues A, AAAA, and MX record queries, the last of which causes yet another loop because the DHCP server doesn't specify that information.

The fix was to simply set the router to only use external DNS servers in Connection > Basic, then set the DHCP server to distribute the Pi-hole IP address instead.

Code: Select all

# clear the previous setting if necessary
uci delete dhcp.lan.dhcp_option
uci commit dhcp
# set which DNS server to assign DHCP clients
uci add_list dhcp.lan.dhcp_option="option:dns-server,192.168.1.254"
uci commit dhcp
/etc/init.d/dnsmasq restart

Post Reply