PPTP tunnels and if-up.d
By Iain Cuthbertson
Current project requires a couple of VPN tunnels to be set up. An IPsec and a PPTP.
The IPsec will wait for another day, the PPTP is set up and ready to go.
One thing that wasn’t quite right with the tunnel though, is the static route created by PPTP missed out a large chunk of the server’s network.
Starting the tunnel sets up the routing rule of 192.168.100.111 to be sent to the tunnel.
This meant that if I wanted to get to 100.10, it wasn’t being sent.
The way around this was to add a new route: route add -host 192.168.100.10 dev ppp0
Works great from the CLI, nothing happens when added to /etc/network/interfaces
or /etc/network/if-up.d/foobar
.
Found out (trial and error) that it was trying to add the route as soon as the tunnel was created. This doesn’t work as the tunnel takes a few seconds to wake up.
Work around was to add a sleep 5
to /etc/network/if-up.d/foobar
before the route command line.
Creating race conditions isn’t nice, but it works 🙁