彻底解决debian重启后DNS配置丢失的问题

1.安装resolvconf

apt-get install resolvconf

2.启动该服务

service resolvconf start    //启动服务
sevice resolvconf status   //查看服务状态

3.编辑/etc/resolvconf/resolv.conf.d/目录下的head文件

vim etc/resolvconf/resolv.conf.d/head
nameserver 8.8.8.8      //配置DNS服务器地址
resolvconf -u
service networking restart    //重启网络服务

4.查看/etc/resolv.conf配置,里面就会有你刚刚设置的DNS

cat /etc/resolv.conf

至此DNS配置已永久生效,重启网络或者重启服务器该配置都不会丢失。

tag(s): VPS
show comments · back · home
Edit with markdown