使用Dnsmasq搭建本地dns服务器上网
导读 搭建一个属于自己的本地DNS服务器很有必要,利用Dnsmasq来搭建一个属于自己的本地DNS服务器,享受更干净无污染、更智能快速和没有广告干扰的DNS解析服务。 一、Dnsmasq安装 安装并启动Dnsmasq yum install -y dnsmasq service dnsmasq start 二、Dnsmasq配置 1、Dnsmasq的配置文件路径为:/etc/dnsmasq.conf # ll -d /etc/dnsmasq.conf -rw-r--r-- 1 root root 21237 Feb 23 00:17 /etc/dnsmasq.conf 2、编辑/etc/dnsmasq.conf resolv-file=/etc/resolv.dnsmasq.conf //dnsmasq 会从这个文件中寻找上游dns服务器 strict-order //去掉前面的# addn-hosts=/etc/dnsmasq.hosts //在这个目里面添加记录 listen-address=127.0.0.1,192.168.1.123 //监听地址 3、修改/etc/resolv.conf echo 'nameserver 127.0.0.1' > /etc/resolv.conf 4、创建resolv.dnsmasq.conf文件并添加上游dns服务器的地址 touch