Created
October 5, 2014 04:20
-
-
Save bsmithyman/174a7d062e47af171cb3 to your computer and use it in GitHub Desktop.
OpenVPN up script to add route to custom table
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 | |
TUNNEL="tun0" | |
TABLE="tablename" | |
OUTADDR=$(ip addr | grep $TUNNEL | sed -nr 's/.*peer ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/p') | |
ip route add default via $OUTADDR dev $TUNNEL table $TABLE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment