Adding a custom route to a VPN in Mac OS X

Me and my colleagues at work were facing a problem. We’re using a VPN to access our internal servers and for some reason Mac OS X always uses a 24 bit netmask with the VPN connection (when we need a 16 bit). Of course there’s a solution for this.

    1. Open your favourite text editor. Type in the following text (we happen to use the 172.16.0.0/16 network, adjust please):
#!/bin/sh
/sbin/route add -net 172.16 -interface ppp0
  1. Save this file as ip-up without .txt in the end.
  2. Open Terminal and move the file to /etc/ppp with sudo, “sudo mv /Users/username/ip-up /etc/ppp” assuming you saved it in your home folder.
  3. The last step is to add execute permissions to the file: “sudo chmod 755 /etc/ppp/ip-up”

The route should now be added every time you connect with VPN.

Comments are closed.