How to create persistent static route on Mac OS X 10.6?

3

I need to add static route on Mac OS. I found good description here Permanent Static Route Mac OS X 10.4.0 and followed the Roark Holz's (roarkh) solution.
Now my problem: sometimes this solution works, sometimes does not.
When it doesn't work I see these messages after boot in the Console Messages log:

06.05.10 9:34:13    com.apple.launchd[1]    *** launchd[1] has started up. ***  
06.05.10 9:34:46    com.apple.SystemStarter[30] Adding Static Route to 10.152
06.05.10 9:34:46    com.apple.SystemStarter[30] route: writing to routing socket: Network is unreachable
06.05.10 9:34:46    com.apple.SystemStarter[30] add net 10.152.0.0: gateway 192.168.1.234: Network is unreachable

I want to know what is going on. How this kind of problem can be troubleshooted?

kopobamypa

Posted 2010-05-06T15:30:05.303

Reputation: 79

Answers

1

I think the problem is that the network interfaces haven't been properly activated before the command runs. You may need to do another launchd job to wait before the command runs.

Alex

Posted 2010-05-06T15:30:05.303

Reputation: 11

1

I just solved this today.

Create the file /etc/rc.local and write this

sleep 30
route add -net <network, I.E. 192.168.1.0/24> <interface, I.E. 192.168.1.1>

You have to wait until the rest of the network stuff is started.. which is why you are getting the network unreachable error.

You can do this using the plist (which it looks like you are doing) but I have no idea how to do it.

You might try adding the sleep 30 command before the route command in the plist. if that works for you could you document it for the rest of us, Thanks!

Mr Enigma

Posted 2010-05-06T15:30:05.303

Reputation: 11

0

Make sure the route is set up after the interface corresponding to the 192.168.1.0/24 net is brought up. If the device in question is configured by a dhcp server either make sure your wifi is activated or the network cable is plugged in or let dhcp set up the static route--given that your dhcp server supports such settings.

artistoex

Posted 2010-05-06T15:30:05.303

Reputation: 3 353