Add static route on Mac – VPN connection on same subnet as local network

A remote Mac user needed to VPN into an office network, and then RDP onto their office machine, but their home network and the office were both using the same subnet. Using the native Mac VPN client meant that the VPN connected fine, but no traffic was routed to the office network.

The solution is to add a static route on the Mac as follows:

Find the name of your VPN network:

$ networksetup -listnetworkserviceorder

Next setup additional routes

$ networksetup -setadditionalroutes networkservice [dest1 mask1 gate1] [dest2 mask2 gate2] … [destN maskN gateN]

Example:

$ networksetup -setadditionalroutes “VPN Name” 10.100.1.100 255.255.255.255 10.100.1.1 10.100.2.0 255.255.255.0 10.100.2.1

Check this settings (first example is for a specific destination machine only, the second covers the entire subnet):

$ networksetup -getadditionalroutes “VPN Name”
10.100.1.100 255.255.255.255 10.100.1.1
10.100.2.0 255.255.255.0 10.100.2.1

To delete this settings just set it without addresses:

$ networksetup -setadditionalroutes “VPN Name”

Thanks to vlk from Superuser for the info.

Related Posts

Need IT Help?

If you need assistance please feel free to reach out to us.