У меня вот так работает на wl500gp2
Code:#!/bin/sh vpn_concentrator="xx.xx.xx.xx" ##enter ip or hostname of your Ipsec vpn concentrator vpn_keepalive_host1="192.168.1.74" ##enter the ip or hostname of a computer that is only reachable if vpn connection is established. vpn_keepalive_host2="192.168.1.75" ##enter the ip or hostname of a computer that is only reachable if vpn connection is established. vpn_groupname="xxxx" ##enter the group name here vpn_grouppasswd="yyyy" ##enter the group password here vpn_username="xxxx" ##enter your username here vpn_password="yyyy" ##enter your password here LOG="/usr/bin/logger -t cisco-vpn" mkdir /tmp/etc/vpnc #--do not edit this-- #Written by Alain R. 28.Sep.2007 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 pingtest1 () { if ping -q -c 1 $param1 >> /dev/null; then echo 0 #reachable else echo 1 #not reachable fi } pingtest2 () { if ping -q -c 1 $param2 >> /dev/null; then echo 0 else echo 1 fi } while [ true ]; do param1=$vpn_concentrator; if [ "`pingtest1`" = "0" ]; then #Vpn concentrator reachable doloop=1; while [ $doloop -gt 0 ]; do param1=$vpn_keepalive_host1; if [ "`pingtest1`" = "0" ]; then sleep 300 else param2=$vpn_keepalive_host2; if [ "`pingtest2`" = "0" ]; then sleep 300 else $LOG "Cisco VPN connection is dead, restarting" doloop=0; vpnc-disconnect vpnc /tmp/etc/vpnc/vpn.conf --dpd-idle 0 sleep 1 if [ "`pingtest1`" != "0" ]; then sleep 10 fi 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 sleep 9 fi fi done else sleep 10; fi done return 0;




Reply With Quote
