Leopard Static Routes

From Secure Computing Wiki
Revision as of 22:00, 4 April 2008 by Ecrist (Talk | contribs) (New page: I found a little how-to over at [http://www.osxfaq.com OSXFAQ] on how to do a proper static route on OS X Leopard, which will persist through reboots. Please, go over [http://www.osxfaq.c...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I found a little how-to over at OSXFAQ on how to do a proper static route on OS X Leopard, which will persist through reboots. Please, go over there and read it, if you'd like. I've got a couple minor changes to make it a bit clearer as to what it does:

To add a static route you need to issue a command like:

sudo route -nv add -net 192.168 -interface en0

To avoid having to do this everytime you reboot your system:

cd /System/Library/StartupItems
sudo cp -R NetworkExtensions NetworkLocal
cd NetworkLocal
sudo mv NetworkExtensions NetworkLocal
sudo vi NetworkLocal

- replace the startup section with the comand above to get:

#!/bin/sh

##
# Load local static routes
##

. /etc/rc.common

StartService ()
{
ConsoleMessage "Loading Static Routes"
route -nv add -net 192.168 -interface en0
}

StopService ()
{
return 0
}

RestartService ()
{
return 0
}

RunService "$1"

sudo vi StartupParameters.plist

-- edit it to get

{
Description = "Static Routes";
Provides = ("StaticRoutes");
Requires = ("Network");
OrderPreference = "None";
}

cd Resources/English.lproj sudo vi Localizable.strings

-- edit it to get:

(?xml version="1.0" encoding="UTF-8"?)
(!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd")
(plist version="0.9")
(dict>
(key>Loading Static Routes(/key)
(string>Loading Static Routes(/string)
(/dict)
(/plist)