Ubuntu修改DNS重启丢失问题

Ubuntu 15.04直接修改/etc/resolv.conf,添加DNS重启后配置丢失。

正确方法:

  1. #vim /etc/network/interfaces,文件最后添加“dns-nameservers  223.5.5.5”

    重启systemctl restart networking.service,测试OK

  2. #vim /etc/resolvconf/resolv.conf.d/base(文件默认为空)

    nameserver  223.5.5.5

    nameserver  223.6.6.6

    #resolvconf -u  (更新改动至resolv.conf)

    #more /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 223.5.5.5

    nameserver 223.6.6.6

    不需要重启网卡/系统,测试OK,重启系统后OK。

相关推荐