Linux tip, Fedora tip / howto: resolv.conf gets overwritten, slow name lookups

 
back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

resolv.conf gets overwritten, slow name lookups

I have my desktop set up to get an IP from my router using DHCP. Apparently /sbin/dhclient-script overwrites my /etc/resolv.conf (the first line says "; generated by /sbin/dhclient-script"), and, even though I had nothing listed for the DNS search path in the appropriate entry of system-config-network, dhclient-script still puts the line:
search lan
in my /etc/resolv.conf. I am not sure if this affects the time to do a name lookup (if you do know, send me a note!).

To prevent resolv.conf from being overwritten, edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 (assuming this is for a wired network on your first/single network interface), and make sure the line with PEERDNS says:
PEERDNS=no
You can now put up to three nameserver entries in resolv.conf yourself.

Alternatively, you can fire up system-config-network, select eth0, click Edit → General, and make sure the option "Automatically obtain DNS information" is unchecked.

Another note: if system-config-network fails to run with some kind of "An unhandled exception has occurred" error, you're probably not running haldaemon: start it using:
/etc/init.d/haldaemon start
then run system-config-network again.


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.