View previous topic :: View next topic |
Author |
Message |
n3bul4 Apprentice
Joined: 04 Nov 2003 Posts: 187
|
Posted: Thu Mar 13, 2014 4:32 am Post subject: dhcdpcd overwrites /etc/resolv.conf generated by openvpn |
|
|
Hey guys,
this is kinda annoying.
I configured openvpn to connect to my office.
Everything is working as expected and the server pushes DNS, DOMAIN etc to my openvpn client.
However every time openvpn generates the new /etc/resolv.conf file it is immediately overwritten by dhcpcd.
I verified that by doing a
Code: |
tail -f /etc/resolv.conf
|
I also tried with /sbin/resolvconf and installed it as I thought, that maybe then this behaviour will stop. Sadly with no avail.
Is there a way to prevent dhcpcd from overwriting the /etc/resolv.conf file?
Maybe it should be mentioned that I am using systemd and because of lack of init script for openvpn I issue the openvpn command manually like this:
Code: |
/usr/sbin/openvpn --up ./up.sh --script-security 3 --config rup.conf
|
I also would like to state that using "nodns" in /etc/conf.d/net is no option for me as I would like to have the functionality of dhcpcd to generate the resolv.conf file.
Any help would be appreciated.
Regards,
Alex |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Thu Mar 13, 2014 10:58 am Post subject: Re: dhcdpcd overwrites /etc/resolv.conf generated by openvpn |
|
|
n3bul4 wrote: | Is there a way to prevent dhcpcd from overwriting the /etc/resolv.conf file? |
Quote: | I also would like to state that using "nodns" in /etc/conf.d/net is no option for me as I would like to have the functionality of dhcpcd to generate the resolv.conf file. |
You want dhcpcd to do two contradictory things?
Either set it up yourself, and tell dhcpcd to leave it alone or let dhcpcd write it every time it starts. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
n3bul4 Apprentice
Joined: 04 Nov 2003 Posts: 187
|
Posted: Thu Mar 13, 2014 6:11 pm Post subject: |
|
|
Thanks for the replies, I will give the manpage of resolvconf a try.
@Anon-E-moose:
I think you misunderstood me. Of course I would like dhcpd to overwrite /etc/resolv.conf when starting.
But only when starting and not every time another process (like openvpn) is generating the file again.
Seems like there is some kind of watchdog process implemented that monitors file changes.
This is really annoying.
Regards,
Alex |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6098 Location: Dallas area
|
Posted: Thu Mar 13, 2014 6:18 pm Post subject: |
|
|
n3bul4 wrote: | Thanks for the replies, I will give the manpage of resolvconf a try.
@Anon-E-moose:
I think you misunderstood me. Of course I would like dhcpd to overwrite /etc/resolv.conf when starting.
But only when starting and not every time another process (like openvpn) is generating the file again.
Seems like there is some kind of watchdog process implemented that monitors file changes.
This is really annoying.
Regards,
Alex |
I didn't misunderstand, but AFAIK there is no way to have it write once then not rewrite it.
Well, other than letting it write the first time and then turn it off after it does it that once.
But there's no way to automatically tell it to do that.
I don't run dhcpcd as I went to static addys for my system, but even when I did, I turned off it writing resolv.conf.
It is relatively easy to create one, or look at what's there and modify it as you need.
Basically it's a list of nameservers (4 max) to check for dns resolving.
Good luck. _________________ PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3131
|
Posted: Thu Mar 13, 2014 8:20 pm Post subject: |
|
|
easy, fast and ugly hack is to define your dns servers and then run `chattr +i /etc/resolv.conf`
Also, afair dhcpcd can include dns servers from different file in resolv.conf. If you can make your vpn write it's info in different location it should do the trick.
On the other hand, why do you even bother? what's the difference who provides you with DNS data? |
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3922 Location: Hamburg
|
Posted: Thu Mar 13, 2014 8:26 pm Post subject: |
|
|
You might have a look into /lib/dhcpcd/dhcpcd-hooks/20-resolv.conf |
|
Back to top |
|
|
|