Where does this conf resolve?

24 February 2011
The file /etc/resolv.conf is used by Linux systems to identify DNS servers used to resolve host names into IP addresses. On Mandriva (and other) systems, resolv.conf is actually a file generated by the program resolvconf. This leads to an interesting situation when you view the /etc/resolv.conf file because you are greeted with a strange warning:
# 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
This is curious because if you don't edit the listings in this file where should you edit them? Of course many distributions have a GUI for managing your network connections but if you're stuck at the command line you might have to go digging. I started searching by looking in the initialization scripts that occur at run level 3. This is the runlevel where networking is up and running but the GUI hasn't been started yet. You can find these scripts in /etc/rc3.d. Listing them though revealed that they were actually all symbolic links to the standard scripts in /etc/rc.d/init.d. A quick look in that directory showed that there was a script called, cryptically, resolvconf. The 'resolvconf' file actually just runs the resolvconf function, as demonstrated by the variable declaration in the beginning:
RUN_DIR=/etc/resolvconf/run
Looking in the directory /etc/resolvconf you find that 'run' contains an interesting file called 'interface'. Looking at this file you find the information you need:
[root@localhost interface]# pwd
/etc/resolvconf/run/interface
[root@localhost interface]# cat eth0
nameserver  10.0.0.2
search madirish.net
So if you're looking to edit your /etc/resolv.conf file you should actually edit the file /etc/resolvconf/run/interface/eth0. Once updated be sure to regenerate the files with:
[root@localhost interface]# resolvconf -u