Created
August 4, 2011 10:53
-
-
Save stefreak/1124955 to your computer and use it in GitHub Desktop.
OpenVPN fails to replace the default route on some UMTS/PPP connections. This script fixes the default route by adding the gateway information to the default route.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $(ip route list exact default |\ | |
awk '/^default/ {print $2}') = dev ]; | |
then | |
IF=$(ip route | awk '/^default/ {print $3}') | |
GW=$(ip address show $IF |\ | |
awk '/peer/ {print $4}' | cut -d"/" -f1) | |
ip route replace default via $GW dev $IF | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment