Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.)

share|improve this answer
    
Thanks for the response and it worked for me when I tested it with Airport and iPhone tethering side by side. But this won't work on my Airport-Ethernet setup: both of my interfaces are connected through a gateway which is 192.168.1.1, so the gateway IP would be ambiguous. However, on en0 the machine has an IP 192.168.1.6 whereas on en1 it has 192.168.1.2. Is there any way to route traffic by device? –  GJ. Mar 28 '10 at 20:35
2  
If both interfaces are connecting to the same network, why don't you just rank Ethernet over AirPort (in System Preferences > Network> "Gear" icon menu > Set Service Order...) so all traffic goes over Ethernet whenever Ethernet is up? Were you hoping to maximize overall throughput by sending some traffic over Ethernet and other traffic over AirPort? –  Spiff Mar 28 '10 at 21:09
    
It's not the same network at all. It's just that both routers use 192.168.1.1 as their self-IP. The routers each use different infrastructure and different ISPs... –  GJ. Mar 29 '10 at 13:17
2  
Two separate locally-attached networks using the same IP subnet? That's bound to cause problems right there. Fix that first. –  Spiff Mar 29 '10 at 14:47
    
Thanks. Will do! –  GJ. Apr 4 '10 at 19:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.