View previous topic :: View next topic |
Author |
Message |
yufw n00b
Joined: 11 Nov 2013 Posts: 57
|
Posted: Sun Jul 06, 2014 1:13 pm Post subject: prevent /etc/resolv.conf from overwritten by dhcpcd |
|
|
I use pptpclient to connect to VPN, since I have enabled the 'usepeerdns' option for pptpclient, when the ppp0 interface is on, it will copy /etc/ppp/resolv.conf to /etc/resolv.conf. However, every several hours or so, /etc/resolv.conf gets overwritten by dhcpcd.
I want to use the peer supplied DNS when I connect to VPN, so how to prevent /etc/resolv.conf from overwritten by dhcpcd? |
|
Back to top |
|
|
saivinoba n00b
Joined: 20 May 2014 Posts: 30
|
Posted: Sun Jul 06, 2014 4:38 pm Post subject: |
|
|
I don't know if I understand the problem but will disabling dhcpcd help? |
|
Back to top |
|
|
ulenrich Veteran
Joined: 10 Oct 2010 Posts: 1480
|
Posted: Sun Jul 06, 2014 5:46 pm Post subject: Re: prevent /etc/resolv.conf from overwritten by dhcpcd |
|
|
yufw wrote: | , /etc/resolv.conf gets overwritten by dhcpcd. | Create an /etc/resolv.conf.head with entries you want to keep staying! |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3134
|
Posted: Sun Jul 06, 2014 7:01 pm Post subject: |
|
|
If you're happy with completly static resolv.conf, you can `chattr +i /etc/resolv.conf`
I don't say this solution is perfect, but it's fast, generic, and contents of that file will not change, no matter what, until you remove this flag. |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Sun Jul 06, 2014 7:18 pm Post subject: |
|
|
yufw ....
simply configure dhcpcd to not run the resolv.conf 'hook'
/etc/dhcpcd.conf
or add the following to /etc/conf.d/net (openrc)
Code: | dhcpcd_ppp0="--nohook resolv.conf" |
or similarly via the cmdline ...
Code: | # dhcpcd --nohook resolv.conf <iface> |
see 'man dhcpcd' '-C, --nohook'
best ... khay |
|
Back to top |
|
|
yufw n00b
Joined: 11 Nov 2013 Posts: 57
|
Posted: Mon Jul 07, 2014 11:50 am Post subject: |
|
|
Thank you all for so many replies. I think I will take khay's advice because it is the most natural solution to me. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
|