DDWRT + PPTP Client: Add routes after connection

Average: 3.5 (122 votes)

Getting routes to be added after VPN connection is established is a bit tricky at least on some DDWRT routers.

In order to add routes after PPTP connection is established you need to modify ip-up script in /tmp/pptpd_client. The problem is that this script is generated when pptpd starts.

To modify it you need to add a startup script that will wait for this file to be created and then append whatever custom routes are needed.

Assuming that PPTP Server has IP and you want to add routes to and networks, saving this as startup script will do the trick:

while [ ! -f /tmp/pptpd_client/ip-up ]
sleep 1
cd /tmp/pptpd_client
cp ip-up ip-up.old
grep -v 'exit 0' ip-up.old > ip-up
echo "/sbin/route add -net gw" >> ip-up
echo "/sbin/route add -net gw" >> ip-up
echo "exit 0" >> ip-up

Try to reboot the router, wait for PPTP connection to come up. Check the routing table using ip route command.

glqxz9283 sfy39587stf02 mnesdcuix8