I use my Ubiquiti USG for Remote User VPN Using L2TP, but L2TP does not provide routing information to the client, so I needed a way to automatically create routes when the VPN connection fires. Thankfully, this is pretty easy in macOS (and Linux).
The /etc/ppp/ip-up
file, if present, triggers every time a PPP (L2TP is based on PPP) connection is made, thus making it easy to trigger a route command when a connection is established.
My /etc/ppp/ip-up
looks like this:
#!/bin/sh
/sbin/route add -net <my home network subnet>/24 -interface $1
Replace <my home network subnet>/24
with your network information, and you should be ready to go.
Running netstat -rn
after making a connection, should now show a line similar to the one below, where xxx.xxx.xxx is your remote subnet, routed over a ppp interface
~ netstat -rn
Routing tables
Internet:
Destination Gateway Flags Netif Expire
...
xxx.xxx.xxx ppp0 USc ppp0
...
Related Posts
- Automating Elgato Key Lights From macOS Touch Bar — Published
- macOS: Aggregate Device for Teams - Fixing Auto-Adjusting Mic Level — Published
- macOS: Hiding Menu Bar Icons With Dozer — Published
- macOS Keeps Asking for SSH Passphrase — Published
- macOS: Using Custom DNS Resolvers — Published