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.
This works, shebang was wrong. Thanks to athairus and Mark Gaensicke in the comments. 🙌
- 2022-11-02: I've updated the script to reflect suggested changes in comments and I've added logging of the command
The script still isn't right :)
You wrote:
#/sbin/route add 192.168.0.0/16 -interface $1
The actual call to
route
should be:/sbin/route add -net 192.168.0.0/16 -interface $1
Note that:
-net
it becomes a route for a single address, not for a network.