udara@udara-home:~$ cat /etc/resolv.confAssume a scenario where I need to use a different DNS.. Eg: -google dns- 8.8.8.8
# 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 127.0.1.1
I can achieve this by modifying above resolv.conf, but that change won't persists after Ubuntu box restart, networking restart or my router restart.
How to persist my change,
Open /etc/network/interfaces using your favorite text editor, in my case it's vi :)
sudo vi /etc/network/interfacesUpdate /etc/network/interfaces according to your preference. You can append dns-nameservers 8.8.8.8 to the end.
Eg:-
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
dns-nameservers 8.8.8.8
Note:- I tried different alternatives like update resolv.conf using a bash script during server restart, adding immutable characteristic to resolv.conf using chattr tool. But above is the only viable solution I can recommend to someone.
No comments:
Post a Comment