Linux Client Route Configuration

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
kolpinkb
Posts: 9
Joined: Thu Aug 06, 2015 3:57 pm

Linux Client Route Configuration

Post by kolpinkb » Sun Nov 01, 2015 2:45 am

Does anyone have a nice script that they use to execute changes to the routing table in Ubuntu 14.04 and up when the vpn connection is established? Currently, I have to establish the vpn connection and then I run the following script:

root@XXXXX:~/Documents# ./route.sh add vpn_server_ip

---------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
if [ "x$2" == "x" ];
then
echo "vpn server ip missing! ./route.sh add/del vpn_server_ip "

else

case "$1" in

add)



# restore default route to home network
ip route delete default
ip route add default via 192.168.43.1 dev wlp3s0

# obtain ip address for vpn_vpn
ifdown vpn_vpn
ifup vpn_vpn


# add route to vpn server

ip route add $2/32 via 192.168.43.1 dev wlp3s0
ip route delete default
ip route add default via 192.168.74.1 dev vpn_vpn


;;

del)


ip route del $2/32
ip route del default
ip route add default via 192.168.43.1 dev wlp3s0
ifdown vpn_vpn


;;

esac


fi
~
~
~
~
~
~
~
~
"route.sh" 46 lines, 619 characters
------------------------------------------------------------------------------------------------------------------------------------------

raafat
Posts: 223
Joined: Fri Jul 03, 2015 2:21 pm

Re: Linux Client Route Configuration

Post by raafat » Tue Nov 17, 2015 12:54 am

I think you'r going at the wrong direction, so tell us more about your setup so that i can help you (:


Good luck

thisjun
Posts: 2458
Joined: Mon Feb 24, 2014 11:03 am

Re: Linux Client Route Configuration

Post by thisjun » Thu Nov 26, 2015 5:46 am

NetworkManager is using in ubuntu.
https://help.ubuntu.com/community/NetworkManager

Post Reply