Skip to content

Instantly share code, notes, and snippets.

@angelyordanov
Forked from GabLeRoux/0-ReadMe.md
Created March 23, 2020 12:30
Show Gist options
  • Save angelyordanov/28108bac20e77dae10ff067dfe9fd231 to your computer and use it in GitHub Desktop.
Save angelyordanov/28108bac20e77dae10ff067dfe9fd231 to your computer and use it in GitHub Desktop.

Attempt to manage vpn routing table with /etc/ppp/ip-up

Related Stackoverflow Question:
https://superuser.com/a/206826/55267

Related answer:
https://superuser.com/a/206826/55267

# setup
sudo touch /etc/ppp/ip-up
sudo vim /etc/ppp/ip-up # fill the script
sudo chmod +x /etc/ppp/ip-up
# tail the logs
sudo tail -f /var/log/ip-up.log

Tested on MacOS 10.13 and didn't work for me. Script doesn't get called.

#/bin/sh
now=`date +%Y-%m-%d_%Hh%Mm%Ss`
logfile=/var/log/ip-up.log
echo "$0 called at $now with following params:" >> $logfile
echo "The VPN interface (e.g. ppp0): $1" >> $logfile
echo "Unknown, was 0 in my case $2" >> $logfile
echo "IP of the VPN server: $3" >> $logfile
echo "VPN gateway address: $4" >> $logfile
echo "Regular (non-vpn) gateway for your lan connections: $5" >> $logfile
#/sbin/route add 192.168.0.0/16 -interface $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment