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

8,371

Solution 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!

Solution 2

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.

Share:
8,371

Related videos on Youtube

kopobamypa
Author by

kopobamypa

Updated on September 17, 2022

Comments

  • kopobamypa
    kopobamypa over 1 year

    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?