Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can use the command:

sudo route add 93.***.***.***/29

This adds the route that I want but its not persistant as in when I reboot the server the route needs to be re-added. There doesnt seem to be a static/persistant switch to save this route like there is under windows. How do I get the above route to stick after reboot?

share|improve this question
possible duplicate of Defining a persistent static route on Mac OS X – jj33 Jan 12 '11 at 16:13
up vote 2 down vote accepted

After a bit of googling around, it looks like the only way to create a persistent route is through a startup script. I found a good tutorial at Secure Computing Networks.

Basically you need to create two files; a script for the route add and and paramaters file. Build out the files with these commands:

# cd /System/Library/StartupItems
# sudo mkdir StaticRoutes
# sudo chmod 0755 ./StaticRoutes
# cd StaticRoutes
# touch StaticRoutes && touch StartupParameters.plist
# chmod 0644 ./* && chmod o+x StaticRoutes

Add the script with your route in "StaticRoutes"


# Load local static routes

. /etc/rc.common

StartService ()
ConsoleMessage "Loading Static Routes"

## Enter static routes here, one line at a time as follows:
# route add <destination_network> <next_hop>  (man route for syntax)
route add 93.***.***.***/29


StopService ()
return 0

RestartService ()
return 0

RunService "$1"

And the proper paramaters in StartupParamaters.plist:

Description = "Static Routes";
Provides = ("StaticRoutes");
Requires = ("Network");
OrderPreference = "None";
share|improve this answer
I had already tried something like this but it didnt work. But this post seems to have a few more steps so I've given it a go but I cannot test till later when I can reboot server. Will let you know if this works. Fingers crossed. – Brady Jan 13 '11 at 10:45
I cannot test if this is working as I have opted for another way of dealing with static routes on my main gateway. – Brady Jan 17 '11 at 11:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.