Code: Select all
sudo -s<<NW
echo "nameserver 208.67.222.222" >>/etc/resolv.conf
echo nameserver 208.67.220.220" >>/etc/resolv.conf
nmcli networking off
nmcli networking on
NW
Code: Select all
sudo nmcli
The thing I noticed that, when I restart the networking service, DNS nameserver file resetted, in other words changes deleted.
But, when I did @Blaze's suggested ( in the link https://askubuntu.com/questions/2321/wh ... the-dns-ip by using GUI of network manager and changed DNS name servers) then, after "off & on" of "networking" service worked and changed DNS settings.
Therefore, I could not find a pure shell script solution to change DNS nameservers yet . If anybody know, please share with us