How to add a static route permanently in Snow Leopard or 10.6

The Mac OS X Terminal

Image via Wikipedia

I had read some guides on the web about how to add static routes.  The instructions they provided worked for 10.4 or 10.5 clients, but none of them worked for me with 10.6  I also tried two 3rd party programs.  Routesplit and Lingon which is no longer supported.  However after some careful study and testing, this seemed to work to add a static route permanently.

How to Create a Permanent Static Route in Mac OS 10.6 or Snow Leopard

1. First download and install Routesplit. This requires Administrative access.

2. Start Routesplit and put in your IP information.

3. Then click on Start and then after it is started click on Routing table to see it was added.

4. Then Click on add item to startup menu. Now you can either do 5 or 6 depending if you are root or prefer the GUI.

5. You have to go to the Finder and select “Go to Folder” and then type in /etc. This is a hidden directory by default. This will work great if you are logged in as root. Then find the routes.sh file that was created and type in Step 7.

6. Alternatively you could use Terminal to go there. Made sure you are an administrative user and you sudo to root. Then go to step 7.

7. Then look for something that is called “Main Interface” and type the second line in:
# Add routes for main interface
route add -net 10.0.0.1 -netmask 255.255.255.0 -gateway 192.0.0.1

3. Then save this.

4. Restart the computer.

5. At the terminal to verify this worked type this:
netstat -nr

You should see your route in the list that appears.

Congratulations!

Share