Skip to content

Instantly share code, notes, and snippets.

@eduardodeoh
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduardodeoh/10994439 to your computer and use it in GitHub Desktop.
Save eduardodeoh/10994439 to your computer and use it in GitHub Desktop.
Add custom route to mac os x after vpn connection
#!/usr/bin/env bash
MY_SERVER="192.168.0.150"
#Solution 1
#VPN_GW=$(ifconfig | grep -A2 ppp | grep inet | awk '{print $4}')
##Add route to host only
#sudo route add -host $MY_SERVER $VPN_GW
# Solution 2
/sbin/route add -host $MY_SERVER -interface ppp0
#Instructions
# 1 - Copy this file content to /etc/ppp/ip-up
# 2 - chmod +x /etc/ppp/ip-up
# 3 - connect to vpn
# 4 - check new custom route with: netstat -rn
# 5 - Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment