Adding static routes to Mac OS X

I quite often encounter situations where I am restricted from accessing the internet via wired connections, but also have access to a guest wireless network for internet access.

In situations like this, the wireless adapter must first be set as the priority network adapter in System Settings.

Additionally, the wired networks must be added statically to the routing table on your Macbook. Here’s how I accomplish this.

NOTE: You will need to know the password of a user with administrator/root access to manually add routes.

1) Review the current routing table to identify the gateway for the wired network:

netstat -r

2) Add the temporary static route:

sudo route -n add 192.168.15.0/24 10.0.41.200

This will add the route to your local routing table and you should be good to go. Repeat for any other subnets that will be accessed over the wired network. Note however, this process doesn’t add persistent route(s) to the route table so the route(s) will be deleted when you reboot. Internal traffic will route out the wired interface and internet traffic will route out the wireless interface.

3) If you need to delete a static route manually:

sudo route -n delete 192.168.15.0/24 10.0.41.200