Add a permanent static route to Mac OS X

As a reminder for myself, but likely useful for you! If you are in a situation where you'd like to add a static route to you Mac OS X machine, you could issue:

$ sudo route add

This commands tells the TCP/IP stack to sent traffic with the destination 10.*.*.* via But, this command is only active after issuing it and before the next reboot. To "save" this command, make it permanent, you can take these simple steps.
$ sudo mkdir /Library/StartupItems/AddRoute
# cd /Library/StartupItems/AddRoute
$ echo "{
        Description     = \"Add static routing tables\";
        Provides        = (\"AddRoutes\");
        Requires        = (\"Network\");
        OrderPreference = \"None\";
}" > StartupParameters.plist
$ echo "#!/bin/sh

# Set up static routing tables
# Roark Holz, Thursday, April 6, 2006

. /etc/rc.common

StartService ()
        ConsoleMessage "Adding Static Routing Tables"
sudo route add

StopService ()
        return 0

RestartService ()
        return 0

RunService "$1"" > AddRoutes
$ sudo chmod 755 AddRoutes

Now you should be prepared. After a reboot, the route will be visible. (netstat -rnf inet)


in Snow leopard Server 10.6.3

in Snow leopard Server 10.6.3 I need to write the StartupParameters.plist as follows:
Description = "Add static routing tables";
Provides = ("AddRoutes");
Requires = ("Network");
OrderPreference = "None";

also sudo chmod 755 StartupParameters.plist

hello there and thank you for

hello there and thank you for your info – I
have certainly picked up anything new from right
here. I did however expertise several technical issues using thiss web site,
sinhce I experienced to reload the site many times previous to I could get it to load correctly.
I hhad been wondering if your wweb host is OK? Not that I am
complaining, but slow lading instances times will very frequently affect your placement in google and can damage you high quality score if ads and marketing with
Adwords. Well I am adding this RSS to mmy email and
can look out for a lot more off your respective exciting content.
Ensure that you update this again soon.

He's not desperately trying

He's not desperately trying to look like a big shot. Do
you wear your own football package when actively playing football along with friends on the park
or even wear your shirt casually around town or perhaps is this your ritual to wear your groups
colors when going down to the pub. There are some excellent websites that offer live
football matches, as well as live match scores, for one low price.

- there is also an

- there is also an inconsistency between "AddRoute" and "AddRoutes"

doesn't work for several

doesn't work for several reasons.

- the first echo fails because regular user can't create file in directory owned by root

- the second echo fails for the same reason, plus also your attempt at nesting double quotes fails

- even after compensating for these problems, config fails on 10.4.11, simply doesn't work

thanks anyway

This didn't work for me, but

This didn't work for me, but I found something that did. This is just in case others are looking for a solution.

About Consultancy Articles Contact

References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]