功能要求
路由设备实现用户输入http://mytest自动跳转到http://mytest.com
需求分析
需要实现自动跳转,首先需要确保域名可以ping通,这就需要路由做dns代理,将该请求给到路由器解析,然后再通过lighttpd的mod_redirect模块来实现域名重定向。
功能实现
dnsmasq
dnsmasq默认会使用/etc/resolv.conf中的nameserver来作为自己的上游dns服务器,你也可以自己指定dns服务器,用dnsmasq代替hosts文件,普通hosts文件配置很方便,但是不支持通配符,但dnsmasq是支持的,编辑dnsmasq.conf,添加:address=/*.mytest/192.168.8.1
domain
-s, --domain=<domain>[,<address range>[,local]]
Specifies DNS domains for the DHCP server. Domains may be be given unconditionally (without the IP range) or for limited IP ranges. This has two effects; firstly it causes the DHCP server to return the domain to any hosts which request it, and secondly it sets the domain which it is legal for DHCP-configured hosts to claim. The intention is to constrain hostnames so that an untrusted host on the LAN cannot adverti