Romeo M.
Romeo M.

Reputation: 3278

linux add ip route then restore the old routes

I have a small software which connects to a pptp VPN server. It adds a route on if-up.d which routes all traffic through the VPN ip route change default via $PPP_LOCAL dev $IFNAME

Problem is that when I disconnect the VPN/close the software, the pptp connection closes but the routes are not restored. I've also added a delete route command in the if-down.d section to delete this route ip route del default via $PPP_LOCAL dev $IFNAME but my internet stops working. I have to "Disable/Enable networking" to have internet again.

Upvotes: 0

Views: 2417

Answers (1)

nickgrim
nickgrim

Reputation: 5437

This is a guess since I have no way of testing it, but instead of changing the default-route, could you just add another with a lower metric?

Upvotes: 2

Related Questions