Last active
May 8, 2021 17:05
-
-
Save legokichi/10535395 to your computer and use it in GitHub Desktop.
softether vpn client for ubuntu /etc/init.d/vpnclient
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: vpnclient | |
# Required-Start: $all | |
# Required-Stop: $network $local_fs $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start VPN Client at boot time | |
# chkconfig: 345 44 56 | |
# description: Start VPN Client at boot time. | |
# processname: vpnclient | |
### END INIT INFO | |
# /etc/init.d/vpnclient | |
case "$1" in | |
start) | |
echo "Starting VPN Client" | |
/usr/local/bin/vpnclient start | |
sleep 1 | |
ifdown vpn_vpn | |
sleep 1 | |
ifup vpn_vpn | |
sleep 1 | |
route add -host 55.55.55.55 gw 192.168.0.1 | |
route del default | |
route add default gw 192.168.10.1 dev vpn_vpn | |
;; | |
stop) | |
echo "Stopping VPN Client" | |
/usr/local/bin/vpnclient stop | |
route del -host 55.55.55.55 | |
route del default | |
route add default gw 192.168.0.1 dev eth0 | |
;; | |
*) | |
echo "Usage: /etc/init.d/vpnclient {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i've changed it a little bit
#! /bin/sh
BEGIN INIT INFO
Provides: vpnclient
Required-Start: $all
Required-Stop: $network $local_fs $remote_fs $syslog
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: Start VPN Client at boot time
chkconfig: 345 44 56
description: Start VPN Client at boot time.
processname: vpnclient
END INIT INFO
/etc/init.d/vpnclient
case "$1" in
start)
echo "Starting VPN Client"
/usr/local/vpnclient/vpnclient start #check path to vpn softether app
sleep 1
dhclient vpn_vpn
sleep 1
route add -host "softether serwer IP" "gw default gw IP"
route del default
route add default gw "softether gateway in tunnel" dev vpn_vpn
;;
esac
exit 0