Ubuntu系统的ECS实例修改resolv.conf文件后,由于重启系统,自动还原之前的DNS配置信息。
Ubuntu系统中的/etc/resolv.conf
文件是一个软连接(Link),它指向的是/run/resolvconf/resolv.conf
文件。
如果需求重启不会自动还原,需要修改/run/resolvconf/resolv.conf
文件。执行vi /run/resolvconf/resolv.conf
命令,修改DNS配置,然后保存并退出即可。
# 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
options timeout:1 attempts:1 rotate
nameserver 223.5.5.5
nameserver 223.6.6.6