Skip to content

Instantly share code, notes, and snippets.

@whoamiTM
Forked from legokichi/vpnclient
Last active July 4, 2022 18:07
Show Gist options
  • Save whoamiTM/77ebb580820bfeaddacd3ad23baaeebe to your computer and use it in GitHub Desktop.
Save whoamiTM/77ebb580820bfeaddacd3ad23baaeebe to your computer and use it in GitHub Desktop.
softether vpn client for ubuntu /etc/init.d/vpnclient
#! /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
# 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
sleep 1
if ifconfig -a | grep vpn_vpn >/dev/null
then
echo "Setting up vpn_vpn..."
else
sleep 1
ifdown vpn_vpn
sleep 1
ifup vpn_vpn
sleep 1
if ifconfig -a | grep vpn_vpn >/dev/null
then
echo "Setting up vpn_vpn..."
else
echo "Interface vpn_vpn not found" 1>&2
exit 1
fi
route add -host 55.55.55.55 gw $(ip route list exact 0.0.0.0/0 | grep wlan0 | xargs | awk '{print $3}')
#route del default
#route add default gw 192.168.30.1 dev vpn_vpn
/usr/local/vpnclient/./vpncmd
;;
stop)
echo "Stopping VPN Client"
/usr/local/vpnclient/vpnclient stop
route del -host 55.55.55.55
route del default
route add default gw $(ip route list exact 0.0.0.0/0 | grep wlan0 | xargs | awk '{print $3}') dev wlan0
*)
echo "Usage: /etc/init.d/vpnclient {start|stop}"
exit 1
;;
esac
exit 0
@whoamiTM
Copy link
Author

whoamiTM commented Oct 3, 2018

55.55.55.55 = VPN server public IP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment