2

I can use the command:

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

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?

1

1 Answer 1

2

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"

#!/bin/sh

##
# 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 192.168.1.1

}

StopService ()
{
return 0
}

RestartService ()
{
return 0
}

RunService "$1"

And the proper paramaters in StartupParamaters.plist:

{
Description = "Static Routes";
Provides = ("StaticRoutes");
Requires = ("Network");
OrderPreference = "None";
}
2
  • 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.
    – Scott
    Commented Jan 13, 2011 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.
    – Scott
    Commented Jan 17, 2011 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .