Developing software in the Real World

Routing specific traffic to the VPN on OS X

I have a client that requires me to use a VPN when connecting to their servers. I use OS X’s built in L2TP VPN to connect, but don’t want all my traffic going that way.

To do this, I unchecked the Advanced VPN setting “Send all traffic over VPN connection” in the Network preferences and then created the file /etc/ppp/ip-up like this:

The file itself is a bash script that runs various /sbin/route commands and looks similar to this:

/etc/ppp/ip-up:

Now, whenever I connect to the VPN, only traffic for hosts on 192.168.1.x is sent to the client’s VPN and we’re both happy.

One thought on “Routing specific traffic to the VPN on OS X

Comments are closed.