Skip to content

Instantly share code, notes, and snippets.

@jperelli
Created July 5, 2016 22:00
Show Gist options
  • Save jperelli/a28398780107027114d804a68dea0915 to your computer and use it in GitHub Desktop.
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
#!/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
@mxlian
Copy link

mxlian commented Jul 5, 2016

Nice one, thanks!

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