Wednesday, September 2, 2009

Static Routes on Snow Leopard

Snow Leopard seems to be a mixed bag of core changes to underlying infrastructure. Adding static routes appears to be one of those changes. See the end of this post if you just want to see the new syntax.

Welcome to another sporadic and completely random tech update. This will be a short one as I just have a little bit of info to share that I couldn't quickly find on the interwebs with the google. Turns out there are some slight changes to the terminal command to add a static route.

I am currently running OS X Snow Leopard (10.6) on my work MacBook. The update was not pretty and I essentially had to completely wipe my OS X partition and start over. Along with that comes a few incompatibilities, most notably for me, MS Live Mesh doesn't work any more, which is how I had intended to get my data back onto my MacBook after I had to clean install, oops!

But here's a slightly obscure change that probably affects very few people:
The basic command to add a static route has changed slightly. I use a static route to connect to a split tunnel VPN (bad practice I know, but it's a long story).

The old command I used to use:
sudo route add -net 192.168.x.0 192.168.y.z
Appeard to work as it used to, but no traffic would actually route through the VPN tunnel. I searched around and saw no references other than a blog comment from today (Sep 2) saying the command in that how-to wouldn't work for them.

So it seemed to me that somehow the way static routes were added changed a little bit. I broke down and read the man page for route (man route) to see if I could figure anything out. Granted I never read it before so I have no idea if there was a difference, but I noticed the following optional parameters that could be used in the route command like static (indicate a static route) and interface (which tells it the interface is directly connected already). I was then able to successfully create a static route using the following command:

sudo route add -net 192.168.x.0 192.168.y.z -static -interface