For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > resolv.conf and dhcp clients

resolv.conf and dhcp clients

Created by dave. Last edited by dave, 8 years and 100 days ago. Viewed 2,900 times. #3
[diff] [history] [edit] [rdf]


I have an internet-facing linux system which uses DHCP for its internet interface. The DHCP client re-writes my /etc/resolv.conf, which prevents me from using the nameserver installed on it. I don't want to use the DHCP-provided nameservers, I want to use the local one.


Make your change to /etc/resolv.conf, then mark it as immutable:

# chattr +i /etc/resolv.conf
# lsattr /etc/resolv.conf
----i-------- /etc/resolv.conf

Kind of a hack, but it works.

RedHat users might enjoy Stop DHCP from changing resolv.conf instead.

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt