Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
As root open your /sbin/dhclient-script with your favourite text editor and try to find out a line like
/sbin/dhcpcd -d -t 10 (10 is the timeout, it might be something else like 15, 60 or whatever)
and edit to
/sbin/dhcpcd -d -R -t 10
This prevent your /etc/resolv.conf to be rewritten.
Set up /etc/resolv.conf according to your needs
Hope this helps
ciao
As root open your /sbin/dhclient-script with your favourite text editor and try to find out a line like
/sbin/dhcpcd -d -t 10 (10 is the timeout, it might be something else like 15, 60 or whatever)
and edit to
/sbin/dhcpcd -d -R -t 10
This prevent your /etc/resolv.conf to be rewritten.
Set up /etc/resolv.conf according to your needs
Hope this helps
ciao
The problem with that method is that the next update to dhclient will break the change. That's why user interfaces are documented.
My system uses isc.org dhcpcd and is working perfectly well with such method.
dhcpcd man pages reports
"-R Prevents dhcpcd from replacing existing <etcDir>/resolv.conf file."
So unless we are talking of different programs or a patched version it should work.
Ciao
My system uses isc.org dhcpcd and is working perfectly well with such method.
dhcpcd man pages reports
"-R Prevents dhcpcd from replacing existing <etcDir>/resolv.conf file."
So unless we are talking of different programs or a patched version it should work.
Ciao
There's no question that it will work. However since modifying that script is not a documented user interface, when the script is updated by the next maintenance to it you will need to reapply your change. Using a documented interface (as explained in the man page) will continue to work correctly even when the script is updated by maintenance.
If you never apply maintenance, or your distribution rarely releases any, then you will have no problem. However, if you are using a distribution that keeps its software close to upstream, you will find yourself performing frequent rework.
@ macemoneta
I understand your point of view, but I guess it is beyond the discussion focus..
Anyway, from this perspective you are absolutely right
Ciao
Actually. . . ive been looking on /sbin/dhclient-script and cannot find the line you are talking about. I have used the find command and cannot locate the line "sbin/dhcpcd -d -t X". Is there an easier way to stop the dhcp server overwritting the /etc/resolv.conf file.
On my FC systems the easiest way I found was just to switch to static addresses. On my home box(when I was going straight to the cable modem) I could still do this by using DHCP first and get the ip address, then apply that address to the static setup. Once every couple of months(at most) I would have to go through and do it again, as my isp did forced ip changes. Once I got a router it became a non-issue.
Solution, i mistakably had my /etc/sysconfig/network-scripts/ifcfg-eth0 file set to BOOTPROTO=dhcp. I changed it to static and the file /et/resolv.conf is no longer overwritten on boot.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.