Created
July 5, 2016 22:00
-
-
Save jperelli/a28398780107027114d804a68dea0915 to your computer and use it in GitHub Desktop.
Fix forticlient linux route table to be able to coonect to internet from outside the VPN
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 | |
if [ "$(id -u)" != "0" ]; then | |
echo "You must run this script as root." | |
exit 1 | |
fi | |
getaddr1 () { | |
hostname -I | tr " " "\n" | grep 192.168.100; | |
} | |
addr=$(getaddr1) | |
while [ -z "$addr" ] | |
do | |
echo "Can not get address, will try again in a second" >&2 | |
sleep 1 | |
addr=$(getaddr1) | |
done; | |
echo "Waiting for forti routes to settle" | |
sleep 5 | |
echo "Fixing routes" | |
route del default gw $addr | |
route add -net 192.168.10.0 netmask 255.255.255.0 gw $addr dev ppp0 | |
route add -net 172.20.1.0 netmask 255.255.255.0 gw $addr dev ppp0 | |
route add -net 172.25.0.0 netmask 255.255.0.0 gw $addr dev ppp0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one, thanks!