What's new

optware + vpnc possible?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Eet_46

Occasional Visitor
Hi! I'm new here and i'm quite new to the router flashing world in general, so i was hoping for some good advice :)



I've been posting on the dd-wrt and tomato forums aswell, but i'm still not there yet...



I have an Asus RT-AC56U, which i'm trying to get connected to a cisco vpn provider, which uses the ipsec protocol with xauth..



This means i need vpnc running and would then be running a startup script, to establish the vpn connection.



My question is, is it possible to install optware (i've seen a quick tutorial for the AC68U, so i guess it applies to the AC56U aswell), then vpnc and run the connection script on Merlin firmware?



Right now i'm on dd-wrt (no vpnc in any builds for my router it seems), but i'm stuck on installing optware, ipkg won't update - repository doesn't exist..



Thanks!



EDIT:



I THINK i managed to get vpnc installed, i'm about to test it out :)



But that brings me to next question.. I need to run a connection script, which i have to put on the jffs partition as i understand..

So, i created a script in the /jffs/scripts folder, but what should it be called? If i understand correctly, i need to name it after when the script must be run, my guess would be init-start for this script?? But i have no clue what would make it work..



Here's the script:
mkdir -p /tmp/etc/vpnc

rm -f /tmp/etc/vpnc/vpnc.sh

echo '

#!/bin/sh

vpn_concentrator="signon1.beevpn.com"

vpn_keepalive_host1="217.15.175.65"

vpn_groupname="beevpn"

vpn_grouppasswd="beecustomer"

vpn_username="" ##enter your username here

vpn_password="" ##enter your password here



#--do not edit this--

#Written by Alain R. 28.Sep.2007, and fixed/adapted by BeeVPN 13.May.2012

vpnc-disconnect

rm -f /tmp/etc/vpnc/vpn.conf

echo "

IPSec gateway $vpn_concentrator

IPSec ID $vpn_groupname

IPSec secret $vpn_grouppasswd

Xauth username $vpn_username

Xauth password $vpn_password

" >> /tmp/etc/vpnc/vpn.conf

DEFAULT_ROUTE_BACKUP="/tmp/vpnc-default-route-backup"

DEFAULT_RESOLV_BACKUP="/tmp/vpnc-default-resolv-backup"

pingtest1 () {

ping -w 5 -q -c2 $param1 >> /dev/null

if [ "$?" == "0" ]; then

echo 0 #reachable

else

echo 1 #not reachable

fi

}



iptablesdone="0"



restore_routing() {

if [ -f $DEFAULT_ROUTE_BACKUP ]; then

if [ "`ip route |grep default`" == "" ]; then

ip route add `cat "$DEFAULT_ROUTE_BACKUP"`

else

ip route replace `cat "$DEFAULT_ROUTE_BACKUP"`

fi

fi

}



restore_everything() {

tundev="`ifconfig |grep tun |cut -b 1-4`"

vpnc-disconnect

restore_routing

if [ "$iptablesdone" == "1" ]; then

iptables -D FORWARD -o $tundev -j ACCEPT

iptables -D FORWARD -i $tundev -j ACCEPT

iptables -t nat -D POSTROUTING -o $tundev -j MASQUERADE

iptablesone="0";

fi

if [ -f $DEFAULT_RESOLV_BACKUP ]; then

cat $DEFAULT_RESOLV_BACKUP > /tmp/etc/vpnc/resolv.dnsmasq.tmp

killall dnsmasq

cat /tmp/etc/vpnc/resolv.dnsmasq.tmp > /tmp/resolv.dnsmasq

dnsmasq --conf-file=/tmp/dnsmasq.conf

fi

}



if [ ! -f $DEFAULT_ROUTE_BACKUP ]; then

rm $DEFAULT_ROUTE_BACKUP

ip route| grep ^default > $DEFAULT_ROUTE_BACKUP

fi

if [ ! -f $DEFAULT_RESOLV_BACKUP ]; then

cp /etc/resolv.conf $DEFAULT_RESOLV_BACKUP

fi



while [ true ]; do

param1=$vpn_concentrator;

if [ "`pingtest1`" == "0" ]; then

doloop=1;

while [ $doloop -gt 0 ]; do

param1=$vpn_keepalive_host1;

if [ "`pingtest1`" == "0" ]; then

sleep 300

else

doloop=0;

vpnc-disconnect

restore_everything

vpnc /tmp/etc/vpnc/vpn.conf --dpd-idle 0

sleep 1

if [ "`pingtest1`" != "0" ]; then

sleep 10

fi

if [ "$iptablesdone" == "0" ]; then

tundev="`ifconfig |grep tun |cut -b 1-4`"

iptables -A FORWARD -o $tundev -j ACCEPT

iptables -A FORWARD -i $tundev -j ACCEPT

iptables -t nat -A POSTROUTING -o $tundev -j MASQUERADE

iptablesone="1";

fi

cat /tmp/resolv.conf > /tmp/etc/vpnc/resolv.dnsmasq.tmp

killall dnsmasq

cat /tmp/etc/vpnc/resolv.dnsmasq.tmp > /tmp/resolv.dnsmasq

dnsmasq --conf-file=/tmp/dnsmasq.conf

sleep 9

fi

done

else

restore_routing

sleep 10;

fi

done



return 0;

' >> /tmp/etc/vpnc/vpnc.sh

chmod a+rx /tmp/etc/vpnc/vpnc.sh

sh /tmp/etc/vpnc/vpnc.sh&
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top