通过下面的命令安装 dnsmasq:
1 |
sudo apt-get install -y dnsmasq |
启动dnsmasq服务:
1 |
sudo service dnsmasq start |
编辑 /etc/dnsmasq.conf
文件更改dnsmasq配置信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Dnsmasq.conf for raspberry pi # /etc/dnsmasq.conf # http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq.conf.example # Set up your local domain here domain=raspberry.local resolv-file=/etc/resolv.dnsmasq min-port=4096 server=8.8.8.8 server=8.8.4.4 # Max cache size dnsmasq can give us, and we want all of it! cache-size=10000 # Below are settings for dhcp. Comment them out if you dont want # dnsmasq to serve up dhcpd requests. # dhcp-range=192.168.0.100,192.168.0.149,255.255.255.0,1440m # dhcp-option=3,192.168.0.1 # dhcp-authoritative |
重启dnsmasq服务:
1 |
sudo service dnsmasq restart |
如需添加静态dns 指向,则在 /etc/dnsmasq.d/ 路径下新建立static.conf 文件,内容如下:
1 |
address=/dustit.me/127.0.0.1 |
完成后记得重启一下dnsmasq服务。