How do I add a static route (permanent) to Yosemite?
In previous Mac OS X releases, I was able to add a permanent static route to my system, following this article:
http://nellen.it/blog/2012/01/permanent-static-routes-for-mac-os-x/
========
Based on some research, here’s a way to add permanent static routes to Mac OS X Lion (and problably other OS Xs too).
The principe is that we create a bash script which is run on every boot and sets static routes.
First of all, you have to be a local admin.
Open a terminal and change to the StartupItems directory
cd /Library/StartupItems
Then create a new directory with root priviledges, e.g. AddRoutes and change into it
sudo mkdir ./AddRoutes cd ./AddRoutes
Now you have to create and edit the bash script
sudo touch ./AddRoutes sudo nano ./AddRoutes
Paste the following Lines into the bash script and adapt it for your network
#!/bin/sh # Set static routing tables . /etc/rc.common StartService () { sleep 10 ConsoleMessage "Adding Static Routing Table" sudo /sbin/route add -net 10.0.0.0 -netmask 255.0.0.0 -gateway w.x.y.z } StopService () { return 0 } StopService () { return 0 } RestartService () { return 0 } RunService "$1"
When you finished with the script, save it.
Then create the corresponding plist.
sudo touch StartupParameters.plist sudo nano StartupParameters.plist
When you created the plist file, paste the following lines into it.
{ Description = "Add static routing tables"; Provides = ("AddRoutes"); Requires = ("Network"); OrderPreference = "None"; }
When you finished the plist file, save it.
Finally we have to set the access rights
sudo chmod 755 /Library/StartupItems/AddRoutes/*
At the end we have to reboot and now your permanent static routes are set.
You can verify with the following
netstat -nr
============
But now with Yosemite, this doesn't working. Especially the point when executed this line in the :
RunService "$1"
in the startup script. Something has been changed in the latest OS. Any ideas, how to solve this OR another way to add a permanent static route?
Mac Pro, OS X Yosemite (10.10)