, ,

It is intereting that the Fortinet SSL VPN client works fine in my Windows machine, but does not work in my Ubuntu laptop. I have found the reason is that a few routes are missed in the routing table. To make it work, I wrote a script to manually add those routes after VPN is connected.

Create an executable file named VPN under /usr/local/bin. Next time just run the command VPN to connect vpn and add routes.


# Start VPN

# Check if ppp0 is ready
while ! ifconfig  | grep ppp0 >/dev/null 2>&1
echo VPN is connecting…
sleep 3

# Add routes
IP=`ifconfig ppp0 | grep ‘inet addr’ | awk ‘{print $2}’ | cut -d’:’ -f2`
sudo route add -net gw $IP dev ppp0
sudo route add -net gw $IP dev ppp0