Change DNS server in Ubuntu
The default DNS server list was reset automatically after network restarting.
chenyang@chenyang-pc:~$ cat /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 20.10.1.5
nameserver 20.10.1.6
nameserver 127.0.1.1
search ufsoft.com.cn
This config file is generated by resolvconf
using template files in /etc/resolvconf/resolv.conf.d/
chenyang@chenyang-pc:~$ cat /etc/resolvconf/resolv.conf.d/head
# 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
Modify head
to
chenyang@chenyang-pc:~$ cat /etc/resolvconf/resolv.conf.d/head
# 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 192.168.8.57
nameserver 192.168.8.119
Regenerate /etc/resolv.conf
file
sudo resolvconf -u
Then the latest config is
chenyang@chenyang-pc:~$ cat /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 192.168.8.57
nameserver 192.168.8.119
nameserver 20.10.1.5
nameserver 20.10.1.6
nameserver 127.0.1.1
search ufsoft.com.cn
refs
- http://askubuntu.com/questions/130452/how-do-i-add-a-dns-server-via-resolv-conf