View previous topic :: View next topic |
Author |
Message |
loisl Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/8728771204390423a906d7.jpg)
Joined: 18 Apr 2004 Posts: 167 Location: Egelsbach
|
Posted: Tue Feb 23, 2010 8:49 pm Post subject: [SOLVED] How do prevent dhcpcd to overwrite /etc/resolf.conf |
|
|
Hai all,
i am using the last stable version of dhcpcd (net-misc/dhcpcd-4.0.15) and i am struggling to find a knob to prevent it from overwriting my /etc/resolf.conf.
I believe there was such a knob in the past. But today i do not find it any more.
What's happening is as follows: after getting a lease i setup an IPSec Tunnel with StrongSWAN and override my /etc/resolv.conf to use nameservers "behind" the IPSec Tunnel. After a few minutes the lease of my interface IP expires, dhcpcd gets it back again and overrides /etc/resolv.conf.
Just getting rid of DHCP Option 55 (Parameter Request List) does not solve the issue because I loose my default gw etc. as well.
Any Ideas are verry welcome.
Thanks,
Loisl
Last edited by loisl on Wed Feb 24, 2010 5:57 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Princess Nell l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/17556244943a013587581f.jpg)
Joined: 15 Apr 2005 Posts: 927
|
Posted: Tue Feb 23, 2010 8:58 pm Post subject: |
|
|
Try openresolv for resolv.conf management. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
loisl Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/8728771204390423a906d7.jpg)
Joined: 18 Apr 2004 Posts: 167 Location: Egelsbach
|
Posted: Tue Feb 23, 2010 10:42 pm Post subject: |
|
|
I just had a look on openresolv. I do not understand how to use it. How do I combine this with strongswan and /etc/conf.d/net?
On the other hand I tried to edit /etc/dhcpcd.conf. But when I put some nooptions for dns stuff into dhcpcd.conf, then "my" /etc/resolv.conf becomes overwritten by an empty file after the next dhcp renew ![Sad :(](images/smiles/icon_sad.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
krinn Watchman
![Watchman Watchman](/images/ranks/rank-G-2-watchman.gif)
![](images/avatars/gallery/Blade Runner/movie_blade_runner_howl.gif)
Joined: 02 May 2003 Posts: 7470
|
Posted: Wed Feb 24, 2010 12:14 am Post subject: |
|
|
Code: | -R
Prevents dhcpcd from replacing existing /etc/resolv.conf file. |
I don't know what dhcpcd version this man page is, but i suppose you can check the -R with the current you have. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Rexilion Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/13156532244b6fe587ac03b.jpg)
Joined: 17 Mar 2009 Posts: 1044
|
Posted: Wed Feb 24, 2010 3:20 am Post subject: |
|
|
My gentoo installed dhcpcd man-page mentions this:
-C, --nohook script
Don't run this hook script. Matches full name, or prefixed with
2 numbers optionally ending with .sh.
So to stop dhcpcd from touching your DNS or MTU settings you
would do:-
dhcpcd -C resolv.conf -C mtu eth0
That help? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
albright Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/524660825462570600c7fb.jpg)
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Wed Feb 24, 2010 3:43 am Post subject: |
|
|
you can also add a line like this to /etc/conf.d/net
Code: | dhcp_eth?=( "nodns" )
|
_________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
loisl Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/8728771204390423a906d7.jpg)
Joined: 18 Apr 2004 Posts: 167 Location: Egelsbach
|
Posted: Wed Feb 24, 2010 1:00 pm Post subject: |
|
|
krinn wrote: | Code: | -R
Prevents dhcpcd from replacing existing /etc/resolv.conf file. |
I don't know what dhcpcd version this man page is, but i suppose you can check the -R with the current you have. |
Unfortunatedly the -R option is gone ... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
loisl Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/8728771204390423a906d7.jpg)
Joined: 18 Apr 2004 Posts: 167 Location: Egelsbach
|
Posted: Wed Feb 24, 2010 1:02 pm Post subject: |
|
|
albright wrote: | you can also add a line like this to /etc/conf.d/net
Code: | dhcp_eth?=( "nodns" )
|
|
Unfortunatedly then dhcpcd does not work (when I look into my syslog, I can see my WiFi connects to the AP but dhcpcd does not retrieve an IP at all). |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
loisl Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/8728771204390423a906d7.jpg)
Joined: 18 Apr 2004 Posts: 167 Location: Egelsbach
|
Posted: Wed Feb 24, 2010 5:56 pm Post subject: |
|
|
Rexilion wrote: |
So to stop dhcpcd from touching your DNS or MTU settings you
would do:-
dhcpcd -C resolv.conf -C mtu eth0 |
This was the bringer. Many thanks for the tip. Yesterday I have had scanned the man page several times and I still overlooked this. Must have been blind
At the bottom line finally I have modified the original resolv.conf hook script to not overwrite /etc/resolv.conf in case of an scheduled IP renewal. This brings the most freedom to me since for the first time I now get the SP's dns data exactly one times.
Many thanks for pointing me in the correct direction |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
shallpion Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 29 Sep 2008 Posts: 331
|
Posted: Thu Feb 25, 2010 4:02 pm Post subject: |
|
|
loisl wrote: | albright wrote: | you can also add a line like this to /etc/conf.d/net
Code: | dhcp_eth?=( "nodns" )
|
|
Unfortunatedly then dhcpcd does not work (when I look into my syslog, I can see my WiFi connects to the AP but dhcpcd does not retrieve an IP at all). |
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?style=printable&part=4&chap=3
# Only needed if you have more than one DHCP module installed
modules=( "dhcpcd" )
config_eth0=( "dhcp" )
dhcpcd_eth0="-t 10" # Timeout after 10 seconds
dhcp_eth0="release nodns nontp nonis" # Only get an address |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
loisl Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/8728771204390423a906d7.jpg)
Joined: 18 Apr 2004 Posts: 167 Location: Egelsbach
|
Posted: Thu Feb 25, 2010 7:09 pm Post subject: |
|
|
shallpion wrote: | loisl wrote: | albright wrote: | you can also add a line like this to /etc/conf.d/net
Code: | dhcp_eth?=( "nodns" )
|
|
Unfortunatedly then dhcpcd does not work (when I look into my syslog, I can see my WiFi connects to the AP but dhcpcd does not retrieve an IP at all). |
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?style=printable&part=4&chap=3
# Only needed if you have more than one DHCP module installed
modules=( "dhcpcd" )
config_eth0=( "dhcp" )
dhcpcd_eth0="-t 10" # Timeout after 10 seconds
dhcp_eth0="release nodns nontp nonis" # Only get an address |
This was exactly what did not work (I had only the "nodns" flag set). Dhcpcd did not retrieve an IP address. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
jathlon Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 26 Sep 2006 Posts: 89 Location: Canada
|
Posted: Fri Feb 26, 2010 3:25 am Post subject: |
|
|
[quote="loisl"] shallpion wrote: | loisl wrote: | albright wrote: | you can also add a line like this to /etc/conf.d/net
Code: | dhcp_eth?=( "nodns" )
|
|
dhcp_eth0="release nodns nontp nonis" # Only get an address |
This was exactly what did not work (I had only the "nodns" flag set). Dhcpcd did not retrieve an IP address. |
I'm not really sure that this is the solution for your situation but notice the difference in syntax. Specifically =( "nodns" ) verses ="nodns"
Depending on what version your init scripts are one or the other might work. Try 'em both.
Hope something like that works for you.
j |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kosik n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 09 Nov 2007 Posts: 20 Location: 127.0.0.1
|
Posted: Thu Apr 10, 2014 8:12 pm Post subject: |
|
|
Was looking for this for ages ... now it popped up again while fiddling /etc/resolv.conf, solution works!
Thanks, dude! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|