- Hahatay Network/
- β Technical Documentation/
- OpenWrt: Force Routers in the Network use a Local DNS Server/
OpenWrt: Force Routers in the Network use a Local DNS Server
·2 mins
Table of Contents
Note: This wiki page is very inspired on this oldish OpenWrt Forum post.
Long story short, we would like all the traffic from the community network to use our local DNS server and I would like to stop any clients from overriding the DNS with a custom one like Google’s (8.8.8.8).
Set Up WAN #
- Go to
Network>Interfaces>WAN. - Click
Edit. - Select the
Advanced Settingstab and uncheckUse DNS servers advertised by peer. - In the box below, enter the Local DNS Servers
192.168.10.4and192.168.10.5. - Click the
Savebutton.
Set Up LAN #
- Go to
Network>Interfaces>LAN - Under
DHCP Server, go toAdvanced Optionsand setDHCP-Optionsto6,192.168.10.4,192.168.10.5.- This advertises different DNS servers to clients. This is what the DHCP server will advertise as NameServer to the hosts (clients). If you don’t use it, the router itself will be advertised and will cache and forward the queries to the upstream NameServers.
- Click the
Savebutton.
Set Up DHCP & DNS #
- Go to
Network>DHCP and DNS. - Under
General Settingsselect theResolv and Hosts Filestab ensure theIgnore resolve fileis unchecked. - Click the
Savebutton.
Set Up Firewall #
- Go to
Network>Firewall - Under the
Port Forwardstab, clickAddand enterForce DNSunderNew port forwardsection - Set the
Protocol to TCP+UDP - Set
Source zonetoWAN** - Set
External portto53 - Set
Destination zonetolan** - Set
Internal portto53 - Click the
Addbutton - Once it’s added to the list open it back up by clicking the
Editbutton - Change the
Source zonefromwantolan - Click the ‘Save & Apply’ button
- ****** If you’re unable to set the exact zones simply select anything as you can change it in step 9
The firewall rule should look like the following:
Afterwards, save and apply all the changes. Finally, reboot the router by heading to System > Reboot