centos+dnsmasq打造DNS缓存服务器加速上网
安装centos部分
查看是否有ip
ip addr show
修改inet的配置
vi /etc/sysconfig/network-scripts/ifcfg-ens192
查看ient的配置发现网卡没有打开,按下键盘 i 键后修改,将no改为yes。修改完成按下 esc 键,然后输入 :wq 保存退出。
输入指令 service network restart 重新启动网络服务
安装
yum -y install dnsmasq
配置
vi /etc/dnsmasq.conf
添加
resolv-file=/etc/resolv.dnsmasq.conf
listen-address=192.168.1.4,127.0.0.1
strict-order
cache-size=10240
编辑resolv.dnsmasq.conf
vi /etc/resolv.dnsmasq.conf
写入
nameserver 114.114.114.114
nameserver 8.8.8.8
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
重启
systemctl restart dnsmasq
设置为开机自启动
systemctl enable dnsmasq
启动 dnsmasq 服务
systemctl start dnsmasq
重启
reboot
安装dig
yum install bind-utils
测试
dig 网址