因为域名污染和劫持问题,已经将域名服务本地化,但当使用DHCP方式链接WIFI,系统总是会自动修改/etc/resolv.conf文件修改DNS服务器地址。查文档,做实验发现简单方法。
- 1.** apt-get install resolvconf**
- 2.vi /etc/resolvconf/resolv.conf.d/base 内容如下: nameserver 127.0.0.1
- 3.systemctl restart resolvconf.service 之后/etc/resolv.conf文件内容自动修改为如下内容:
Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1 search DHCP HOST 说明: 停止resolvconf: systemctl stop resolvconf.service 默认开机运行resolvconf :systemctl enable resolvconf.service 默认开机关闭resolvconf :systemctl disable resolvconf.service