Custom DNS Entry

Hello, I'm very new in here.
I just wanted to know how can I resolve an IP address internally before it goes and ask the dns server.
Ex: someone typed and get redirected to
I tried editing etc/hosts file but it is not working.
N.B: I'm not using GUI.

In /etc/config/dhcp

config domain
	option name ''
	option ip ''

Or with UCI

uci add dhcp domain
uci set dhcp.@domain[-1].name=""
uci set dhcp.@domain[-1].ip=""
uci commit dhcp
/etc/init.d/dnsmasq restart



On a linux system there are two files, which determine the behaviour of the resolver:

  1. /etc/host.conf (old way)
  2. /etc/nsswitch.conf (new way)

/etc/host.conf contains the following line:

order hosts,bind

/etc/nsswitch.conf contains the following line:

hosts: files dns

You can give it a try.

1 Like

There's another method which is better suited to block domains and subdomains.

If the issue persists, make sure to disable DoH in the browser and set up DNS hijacking.

See also parental controls for alternatives.

1 Like

Can you please tell me in details? Actually I'm new to the firmware.

There are no further details, just ssh to the router and on the cmdline type the following commands:

echo "order hosts,bind" >> /etc/host.conf
echo "hosts: files dns" >> /etc/nsswitch.conf


man host.conf


man nsswitch.conf

are your friends.