Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dhcdpcd overwrites /etc/resolv.conf generated by openvpn
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
n3bul4
Apprentice
Apprentice


Joined: 04 Nov 2003
Posts: 187

PostPosted: Thu Mar 13, 2014 4:32 am    Post subject: dhcdpcd overwrites /etc/resolv.conf generated by openvpn Reply with quote

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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Mar 13, 2014 10:52 am    Post subject: Reply with quote

dhcpcd will always use resolvconf when available.
OpenVPN should do as well.

I suggest you look at the resolvconf (or resolvconf.conf) man page and find out how to set it up to your liking.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Thu Mar 13, 2014 10:58 am    Post subject: Re: dhcdpcd overwrites /etc/resolv.conf generated by openvpn Reply with quote

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
View user's profile Send private message
n3bul4
Apprentice
Apprentice


Joined: 04 Nov 2003
Posts: 187

PostPosted: Thu Mar 13, 2014 6:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6097
Location: Dallas area

PostPosted: Thu Mar 13, 2014 6:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Thu Mar 13, 2014 8:20 pm    Post subject: Reply with quote

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
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3922
Location: Hamburg

PostPosted: Thu Mar 13, 2014 8:26 pm    Post subject: Reply with quote

You might have a look into /lib/dhcpcd/dhcpcd-hooks/20-resolv.conf
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum