Created
October 5, 2016 01:48
-
-
Save dimitrovs/8d21f6c70cbf4a4f1c24663e743d1916 to your computer and use it in GitHub Desktop.
OpenVPN Client Up Script
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/bash | |
#Clear all routes on vpn routing table (this is to make sure there isn't any crap left over from a previous vpn connection | |
/sbin/ip route flush table 100 | |
#Copy routing table from main routing table into vpn table | |
/sbin/ip route show table main | grep -Ev ^default | while read ROUTE ; do ip route add table vpn $ROUTE; done | |
#Add default gateway to vpn routing table | |
/sbin/ip route add default via ${route_vpn_gateway} dev ${dev} table 100 | |
/sbin/ip rule add from ${ifconfig_local} table 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment