A permanent static route for Macintosh OS X (10.4.7)

Last modified on July 24, 2026 • 2 min read • 296 words
I have set up OpenVPN on our pribvate network, but our special setup requires manually adding a static entry to the routing table of computers that we want to access from the outside via our VPN server.
I have set up OpenVPN on our pribvate network, but our special setup requires manually adding a static entry to the routing table of computers that we want to access from the outside via our VPN server. In SuSE Linux this is a nobrainer as Yast provides a section where to add static routing information. On MacOS X the command line works, but upon reboot the route is lost:route add 10.8.0.0/24 192.168.0.2Check what the route is for a specific IP:route get 10.8.0.1The same command has a different syntax on Linux though:route add -net 10.8.0.0 netmask 255.255.255.0 gw 192.168.0.2In order to preserve the routing information over a reboot I created the folder AddRoutes in /Library/StartupItems. Inside this folder there have to be two files: AddRoutes and StartupParameters.plist . The content of these files is the following:AddRoutes:#!/bin/sh# Set up static routing tables. /etc/rc.commonStartService (){ ConsoleMessage "Adding Static Routing Tables" route add -net 10.8.0.0/24 192.168.0.2}StopService (){ return 0}RestartService (){ return 0}RunService "$1"StartupParameters.plist:{ Description = "Add static routing tables"; Provides = ("AddRoutes"); Requires = ("Network"); OrderPreference = "None";}These files need to be readable and executable by everybody for MacOS X 10.4.7. However, MacOSX might wipe these files with each system upgrade (at least from Mountain Lion to Mavericks my settings disappeared completely). After recreating them, I got the error message “Insecure Startup Item disabled” at boot and I needed to give the directory and the files the following permissions to make the error to disappear:drwxr-xr-x 4 root wheel 136 Aug 6 22:44 AddRoutes``-rwxr-xr-x 1 root wheel 238 Aug 6 22:43 AddRoutes-rwxr-xr-x 1 root wheel 123 Aug 6 22:44 StartupParameters.plistHowever, the route does not get added in Mavericks by this procedure and I could not find any information how to do this.The original information is from the following website: http://macosx.com/forums/showthread.php?t=267209  .