> ## Content Index
> Fetch the complete content index at: https://george.bike/llms.txt
> Use this file to discover other available public pages before exploring further.

# Using networksetup to add static route(s) to a Mac OS VPN
- URL: https://george.bike/using-networksetup-to-add-static-routes-to-a-mac-os-vpn/
- Published: 2019-02-04T14:32:00.000Z
- Updated: 2019-02-04T14:32:00.000Z
- Author: George Carey
- Tags: #Import 2026-11-24 15:41

These commands were executed in a user context, no sudo needed. The routes added to your VPN connection should survive a reboot.

First I list out my network connections to make sure I have the name correct:

> `$ networksetup -listallnetworkservices  
>  
> An asterisk (*) denotes that a network service is disabled.  
> Ethernet  
> Wi-Fi  
> home.mydomain.net  
> *INT  
> Bluetooth PAN  
> Thunderbolt Bridge  
> COGENT-HSLC  
> GUEST  
> COGENT-ACCESSPA  
> Verizon-DSL  
> DMZ  
> MGMT  
> STORAGE  
> 55 with Default  
> 55  
> 52  
> 52 with Default  
> HSLC`

I want to add a route to home.mydomain.net so I do:

> `$ networksetup -setadditionalroutes home.mydomain.net 192.168.2.0 255.255.255.0 192.168.1.71`

I happen to know that the IP address on the other side of the gateway is 192.168.1.71\. If you don't know, connect to your vpn and look in the routing table with:

> `$ netstat -nr -f inet`

If you want more than one route you have to combine them all into one command. You can't add them one at a time as the current route will override the previous. So to add two routes I would do:

> `$ networksetup -setadditionalroutes home.mydomain.net 192.168.2.0 255.255.255.0 192.168.1.71 192.168.3.0 255.255.255.0 192.168.1.71`

If your VPN name has a space in it, put quotes around the name like:

> `$ networksetup -setadditionalroutes "home vpn" 192.168.2.0 255.255.255.0 192.168.1.71`

Finally, to delete all the additional routes just leave the route blank.

> `$ networksetup -setadditionalroutes "home vpn"`

To check your work:

> `$ networksetup -getadditionalroutes "home vpn"`

[Original post](https://george.bike/?p=76&more=1) blogged on [b2evolution](http://b2evolution.net/?ref=george.bike).