Persistent routes for DD-WRT PPTP VPN client

Posted by Tim Kemp on Super User See other posts from Super User or by Tim Kemp
Published on 2011-01-06T16:18:17Z Indexed on 2011/01/06 16:55 UTC
Read the original article Hit count: 312

Filed under:
|
|
|

My home network in the USA is behind a Buffalo router (G300NH) running their version of DD-WRT. I use the built-in PPTP VPN client to connect to a VPN provider in the UK. I route certain traffic over the VPN (so it has a UK source address, for various entirely legal reasons) which I achieved by following the instructions in the DD-WRT docs and my VPN provider's own instructions. I placed two commands like this in the firewall script:

route add -net xxx.xxx.0.0 netmask 255.255.0.0 dev ppp0
route add -net yyy.yyy.0.0 netmask 255.255.0.0 dev ppp0

I didn't put any of the iptables rules in since it my setup doesn't seem to need them. It works like a charm. Traffic to the xxx subnets goes over the VPN, everything else goes out over my ISPs own pipes.

The problem comes when the VPN drops, which it does occasionally. DD-WRT does a fine job of reconnecting it automatically, but the routes are trashed every time that happens. How do I automate the process of re-establishing my routes? I thought about static routes, but the IP address of the VPN connection is dynamically assigned (which is why I'm using dev ppp0).

Many thanks,

Tim

© Super User or respective owner

Related posts about vpn

Related posts about routing