Routing traffic to specific web sites through Ethernet, rest via wifi on Mac OS X 10.6?

I have two separate Internet connections connected to a Mac and I'd like one of them (via Ethernet en0 gateway) to serve for just backing up to an remote online storage, and the other one (via Airport en1 gateway) for all other Internet traffic.

I tried using "route" from the terminal as follows:

sudo route add -host 98.207.226.113 -interface en0

(just for testing against the site www.whatismyip.org whose IP is 98.207.226.113, to see through which gateway the traffic is routed)

I can see using netstat that the route is added.

However, the traffic in this case does NOT get routed properly through Ethernet, as if the routing definition I made is ignored.

Any ideas?

Thanks!


Solution 1:

The man page for route(8) on Snow Leopard (10.6.2) says -interface is only for when "the destination is directly reachable via an interface requiring no intermediary system to act as a gateway".

When I tried your command, I didn't get to whatismyip.org at all. When I modified it to be more correct, like this:

sudo route add -host 98.207.226.113 $MyGatewayOutEn0

...where "$MyGatewayOutEn0" was the IP address of the default gateway on the subnet that en0 was connected to, it successfully routed the way I think you were expecting.

(FYI, my en1 was attached to a completely different network, different subnet, than what my en0 was attached to at the time. I think that's what you were saying was the case for you, but I thought I'd be clear.)