dhcpcd-discuss

Re: preserving l2tp

Niv Wiser

Wed Jan 05 16:14:39 2011

Thanks for providing the feedback,
I posted the bug: https://bugs.gentoo.org/show_bug.cgi?id=350606

and this response:

Comment #2 From Rafał Mużyło 2011-01-05 08:07:57 0000 [reply] -------

I'd check your configuration files for dhcpcd, syntax has changed a bit.

here is the only file I add:
#/lib/dhcpcd/dhcpcd-hooks/60-l2tp.conf
#use ISP default gateway as a route for l2tp server
#written by niv vaizer
#set -x
#>/dev/null 2>&1
[ -f /etc/conf.d/strongVpn ] && . /etc/conf.d/strongVpn
LOG="/tmp/60-l2tp.conf.log"
DEBUG=0
if [ $DEBUG -ge 1 ] ; then
	echo "----------------------------------">>$LOG
	echo "`date '+%H:%M:%S_%d.%m.%Y'` invoked">>$LOG
	set >>$LOG
fi

if [ "$interface" = "$WAN_DEV" -a "$if_up" = "true" ] ; then
	#if [ $if_up -a "$reason" = "BOUND" ] ; then
	[ -n "${new_routers}" ] &&ip ro | grep -q "${VPN_HOST} via ${new_routers}"
	if [ $? -ne 0 ] ; then
		line=$(ip ro | grep "${VPN_HOST} via")
		line=${line%%dev*}
		[ -n "${line}" ] && ip ro del ${line}
		ip ro add "$VPN_HOST" via "$new_routers" 
	fi
	grep -q $new_ip_address /etc/ipsec.conf
	if [ $? -ne 0 ] ; then
		sed -i "s/left=.*/left=$new_ip_address/" /etc/ipsec.conf
		sed -i "s/.*\ :/$new_ip_address $VPN_HOST \:/" /etc/ipsec.secrets
		#/usr/bin/rc-config restart ipsec
	fi
	#$old_routers is missing so no ip ro del
	#fi
fi

1. is there anything wrong that may cause the "/sbin/rc-service: invalid
option -- 'D'" ?
2. I am seeking to harness dhcpcd to sustain a vpn connection , even if
the ISP chooses to change my eth0 address or even its gateway. as you
see I use the script to substitute the ipsec parameter and restart the
ipsec service. is this approach correct?

Follow-Ups:
Re: preserving l2tpNiv Wiser
References:
preserving l2tpNiv
Re: preserving l2tpRoy Marples
Re: preserving l2tpNiv
Re: preserving l2tpRoy Marples
Re: preserving l2tpNiv
Re: preserving l2tpRoy Marples
Re: preserving l2tpNiv Wiser
Re: preserving l2tpRoy Marples
Archive administrator: postmaster@marples.name