You are not logged in.

#1 2010-10-04 18:22:25

dudell
Member
Registered: 2009-09-05
Posts: 8

dhcpcd overrides resolv.conf from vpnc

As soon dhcpcd renews the lease the resolv.conf from the vpnc gets overridden. At the moment my workaround is to copy periodically the resolv.conf.
Is there a proper solution? Have I missed a configuration parameter?

The dhcpcd is startet in this way:

dhcpcd -b -q -t 0 wlan0

Offline

#2 2010-10-04 18:27:24

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: dhcpcd overrides resolv.conf from vpnc

dhcpcd -C resolv.conf $OTHER_OPTIONS

If you use /etc/rc.d/network to start the network (and thus dhcpcd) you can edit  /etc/conf.d/dhcpcd

Offline

#3 2010-10-28 09:28:14

dudell
Member
Registered: 2009-09-05
Posts: 8

Re: dhcpcd overrides resolv.conf from vpnc

The problem still exist.
I use hand made script to set up the wireless (fn+ wirelesskey). If I use the vpn then I start also the dhcpcd by hand without the resolv.conf hook.
I have also tried with openresolv. But it has also not worked all the time.

I have two usecases:
1. I connect to a wireless. Then dhcpcd should write the according resolv.conf when obtaining the ip.
2. I connect to a wireless and connect then into a vpn with vpnc (the wireless is from a hotspot provider). To connect to the vpn I need the DNS server of the hotspot provider. This means dhcpcd must write first a resolv.conf. Then connecting to the vpn, vpnc will override the resolv.conf. And now dhcpcd should not override the settings of the vpnc. It should be only allowed to write the resolv.conf by the tool on the top of this stack.

Offline

#4 2010-10-28 14:41:00

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: dhcpcd overrides resolv.conf from vpnc

dhcpcd run the hooks available in /usr/lib/dhcpcd/dhcpcd-hooks in alphabetical order. These hooks are scripts that configure the networks according environment variables given bu dhcpcd.

Let's have at the last lines of the /usr/lib/dhcpcd/dhcpcd-hooks/20-resolv.conf hook:

case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)    add_resolv_conf;;
PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)    remove_resolv_conf;;
esac

I would try to change that by:

case "$reason" in
BOUND)    add_resolv_conf;;
esac

This is untested. Anyway the solution is to hack the resolv.conf hook. See man dhcpcd and man dhcpcd-run-hooks

Offline

#5 2010-11-29 19:19:28

centenary
Member
Registered: 2010-11-27
Posts: 4

Re: dhcpcd overrides resolv.conf from vpnc

I just solved this issue and I wanted to share my solution in case anyone else runs into this problem.  Hopefully there isn't a rule against replying to month-old threads =P

How to make dhcpcd and vpnc work together:
1) Install openresolv.  This package provides resolvconf, which helps coordinate modifications to /etc/resolv.conf.  With resolvconf, dhcpcd and vpnc will no longer overwrite each other's changes to /etc/resolv.conf
2) Modify /etc/vpnc/vpnc-script to look for resolvconf at /usr/sbin/resolvconf instead of /sbin/resolvconf
3) Do not modify /usr/lib/dhcpcd/dhcpcd-hooks/20-resolv.conf.  This hook will work with resolvconf without any modifications

Hopefully this will be helpful to someone smile

Last edited by centenary (2010-11-29 19:20:45)

Offline

Board footer

Powered by FluxBB