Statically/permanently setting your search domains in Redhat Linux using DHCP

So you go into /etc/resolv.conf and set your search domains. You're happy that you no longer have to type in the full domain for your favorite server anymore when ssh'ing to in, and you come back to your computer a day later and find that they've been wiped out. Arg! Apprently DHCP knows what's better for you than you do.

Here's how to fix this annoyance. On Redhat Linux systems, there is a file called /etc/sysconfig/network-scripts/ifcfg-eth0. Substitute your interface (eth1, eth2 etc) to reflect the interface that gets
configured dynamically. This contains the configuration information that tells your computer to configure this interface using DHCP. There is an undocumented option that can be used in here to set the search domains upon renewal of a DHCP lease. The option is new_domain_name. Use it in lowercase. I don't think uppercase works. For example, your file could look similar to this:



DEVICE=eth0

ONBOOT=yes

BOOTPROTO=dhcp
new_domain_name="domain1.com domain2.com linuxwhore.com"


Just restart your network service (/etc/init.d/network restart) and,
Tada! Now your search domains will remain there for ever and ever.

HEY THERE! Best as I can tell, this is the only solution out on Google. Do me a favor and let me know if this helped you at all. Send me an email at resolvdomains@john.holmstadt.com
. I'd really like to hear from you! Furthermore, feel free to link to this page to improve its ranking.