About
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.
Adjust router configuration
- Go to
Administration -> System - Enable:
Enable JFFS custom scripts and configsconfig option - Enable:
Enable SSHconfig option - Go to
AiProtection -> DNS Filtering(Parental Controls -> DNSFilteron older models) - Disable:
Enable DNS-based Filtering
Adjust DHCP Server Options
- Go to
LAN -> DHCP Server DNS Server 1should contain your router’s IP address- If
Advertise routers IP in addition to user specified DNSis 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 DNSto prevent your private DNS resolution requests from being passed to the Internet.
Connect to your router
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)
Edit dnsmasq config options
- Create configuration file for dnsmasq:
touch /jffs/configs/dnsmasq.conf.add - Edit configuration file:
vi /jffs/configs/dnsmasq.conf.add.– for typing pressI, to quit typing pressESC, to delete line pressESCand then writeddand pressENTER - Add configuration for resolving domain names into
dnsmasq.conf.add- Resolve one domain to IP, Explanation: resolves
test.comdomain to ip127.0.0.1or::1when 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
ESCand write:wqand hitENTER
- Resolve one domain to IP, Explanation: resolves
Last steps
- Reboot rooter with
rebootcommand in ssh or through web interface. (Rebooting is not strictly necessary; restarting thednsmasqservice is sufficient:service restart_dnsmasq) - Go to
Administration -> Systemand disableEnable SSHconfig option
More
From: https://github.com/RMerl/asuswrt-merlin/wiki/Custom-domains-with-dnsmasq
退出登录?