Is /etc/resolv.conf useless in Ubuntu 12.04 LTS ? I say so, because when I configured the /etc/resolv.conf file and rebooted the VM, all the settings were overwritten.
piyush@co109044:~$ cat /etc/resolvconf/resolv.conf.d/tail
search romelab.it.ibm.com ibm.com
nameserver 9.168.127.100
namserver 9.168.96.100
piyush@co109044:~$ 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
search romelab.it.ibm.com ibm.com
nameserver 9.168.127.100
namserver 9.168.96.100
piyush@co109044:~$ reboot
Last login: Mon Mar 31 08:48:50 2014 from 9.77.94.202
piyush@co109044:~$ 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
After rebooting the VM, all the settings of /etc/resolv.conf were overwritten.search romelab.it.ibm.com ibm.com
nameserver 9.168.127.100
namserver 9.168.96.100
piyush@co109044:~$ 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
search romelab.it.ibm.com ibm.com
nameserver 9.168.127.100
namserver 9.168.96.100
piyush@co109044:~$ reboot
Last login: Mon Mar 31 08:48:50 2014 from 9.77.94.202
piyush@co109044:~$ 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
After reading the release notes of Ubuntu, figured out that "resolvconf is now used to manage /etc/resolv.conf on all Ubuntu systems". What's that ??? I suggest reading the man page for resolvconf.
resolvconf is a set of script and hooks managing DNS resolution. The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf or the system is rebooted. As a thumb rule, if you are using static IP configuration for your Ubuntu system, add all your network related entries to the file /etc/network/interfaces
piyush@co109044:~$ man resolvconf
piyush@co109044:~$ vi /etc/network/interfaces
piyush@co109044:~$ sudo vi /etc/network/interfaces
[sudo] password for piyush:
piyush@co109044:~$ cat /etc/network/interfaces
auto eth0
iface eth0 inet static
address 9.168.109.44
netmask 255.255.255.0
gateway 9.168.109.254
dns-nameservers 9.168.127.100 9.168.96.100
dns-search romelab.it.ibm.com ibm.com
auto lo
iface lo inet loopback
piyush@co109044:~$ ping google.com
ping: unknown host google.com
piyush@co109044:~$ sudo ifdown eth0;sudo ifup eth0
ssh stop/waiting
ssh start/running, process 1999
piyush@co109044:~$ ping google.com
PING google.com (173.194.41.167) 56(84) bytes of data
piyush@co109044:~$ 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 9.168.127.100
nameserver 9.168.96.100
search romelab.it.ibm.com ibm.com
As you can see the entries from the /etc/network/interfaces were automatically added to the /etc/resov.conf file. Notice that the /etc/resolv.conf is a softlink to /run/resolvconf/resolv.confpiyush@co109044:~$ vi /etc/network/interfaces
piyush@co109044:~$ sudo vi /etc/network/interfaces
[sudo] password for piyush:
piyush@co109044:~$ cat /etc/network/interfaces
auto eth0
iface eth0 inet static
address 9.168.109.44
netmask 255.255.255.0
gateway 9.168.109.254
dns-nameservers 9.168.127.100 9.168.96.100
dns-search romelab.it.ibm.com ibm.com
auto lo
iface lo inet loopback
piyush@co109044:~$ ping google.com
ping: unknown host google.com
piyush@co109044:~$ sudo ifdown eth0;sudo ifup eth0
ssh stop/waiting
ssh start/running, process 1999
piyush@co109044:~$ ping google.com
PING google.com (173.194.41.167) 56(84) bytes of data
piyush@co109044:~$ 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 9.168.127.100
nameserver 9.168.96.100
search romelab.it.ibm.com ibm.com
So if you make, /etc/resolv.conf as a regular file then resolvconf will be disabled (not recommended).
Resolvconf has a /etc/resolvconf/resolv.conf.d/ directory that can contain "base", "head", "original" and "tail" files. All in resolv.conf format.
- tail: Any entry in /etc/resolvconf/resolv.conf.d/tail is appended at the end of the resulting resolv.conf. If the tail file is missing then create it.
- base: Used when no other data can be found.
- original: Just a backup of your resolv.conf at the time of resolvconf installation
0 comments:
Post a Comment