-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Custom domains with dnsmasq
With dnsmasq you are able to create custom domains within your network or route existing domains to different ip's. It's very handy when you want to create home web which will have web links to your NAS storage, printer and other clever things within your household. This can be also used to block access to domains by routing them to different ip address, so you can block advertising within some applications.
- Go to
Administration -> System
- Enable:
Enable JFFS custom scripts and configs
config option - Enable:
Enable SSH config option
- Go to
AiProtection -> DNS Filtering
(Parental Controls -> DNSFilter
on older models) - Disable:
Enable DNS-based Filtering
- Go to
LAN -> DHCP Server
-
DNS Server 1
should contain your router's IP address - If
Advertise routers IP in addition to user specified DNS
is enabled all custom DNS address will be appended to the address list given to the clients when they lease an IP address. So if you want to be able to resolve names without specifying the routers address as the name server to do the resolution then make sure this setting is turned off. - Turn off
Forward local domain queries to upstream DNS
to prevent your private DNS resolution requests from being passed to the Internet.
Connect to your router through SSH (you can use PUTTY on windows). Default IP address is 192.168.1.1
, use credentials as in web interface. (How to use putty)
-
Create configuration file for dnsmasq:
touch /jffs/configs/dnsmasq.conf.add
-
Edit configuration file:
vi /jffs/configs/dnsmasq.conf.add
.- for typing press
I
, to quit typing pressESC
, to delete line pressESC
and then writedd
and pressENTER
-
Add configuration for resolving domain names into
dnsmasq.conf.add
-
Resolve one domain to IP, Explanation: resolves
test.com
domain to ip127.0.0.1
or::1
when on ipv6address=/test.com/127.0.0.1 address=/test.com/::1
-
Resolve more domains to same IP, Explanation: resolves listed domains to ip
127.0.0.1
(you can write more)address=/test1.com/test2.com/127.0.0.1
-
To save and quit editor quit typing with
ESC
and write:wq
and hitENTER
-
- Reboot rooter with
reboot
command in ssh or through web interface. (Rebooting is not strictly necessary; restarting thednsmasq
service is sufficient:service restart_dnsmasq
) - Go to
Administration -> System
and disableEnable SSH config option