Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a Mac Pro tower with two ethernet ports. One of them is connected to the company intranet and the other to my home network. I'd like my Mac to use the former ethernet connection only for those services within the intranet; for everything else I'd like to use the latter connection (e.g. the web).

Given that the intranet addresses will fall into a specific range, how can this be done?

Update

Thanks to some huge help from bmike I've been making some progress but am still not quite there yet. Here is my original routing table (with some details omitted) showing the two default paths leading out of either Ethernet port:

default    A.B.C.D    UGSc           17        0     en0
default    E.F.G.H    UGScI          12        0     en1

The first entry is to the company network via Ethernet 1 (en0); the second to my home network via Ethernet 2 (en1).

The goal is to force all traffic not destined for a location within the company to route through Ethernet 2. My understanding thus far has led me to modify the routing tables as such:

sudo /sbin/route -n delete default A.B.C.D
sudo /sbin/route -n add -net A A.B.C.D

Giving me the following modified table:

default    E.F.G.H     UGScI          1        0     en1
A          A.B.C.D     UGSc          28        0     en0

The end result is not quite what I'd expect, however. I am still able to access all sites on the company intranet however all traffic to e.g., stackoverflow.com or anywhere else other than the intranet fails. A sampling from ping confirms this:

FooBar:~ username$ ping latimes.com
PING latimes.com (144.142.224.43): 56 data bytes
ping: sendto: No route to host

Is the default entry above not sufficient for that purpose, or am I missing something?

Update 2

Apparently adding the following got things working as I'd expect:

sudo /sbin/route -n add default E.F.G.H

Resulting in the following table:

default            E.F.G.H     UGSc            0        0     en1
default            E.F.G.H     UGScI          25        0     en1
A                  A.B.C.D     UGSc            2        0     en0

But I don't understand why the original default entry didn't suffice? The documentation for the I flag reads:

I       RTF_IFSCOPE      Route is associated with an interface scope

So how does that default entry's I status prevent its use for my stated goal? (I've asked a related question to the same effect here.)

share|improve this question
    
If your VPN software prevents this (some are set up to only work if ALL traffic goes over the VPN) you will have a hard time of this. If is doesn't restrict, then you simply make the latter connection's router as the default route and set up network routing for each network you want to go through the VPN. –  bmike Jun 27 '11 at 22:23
    
@bmike: Can you explain a little more how to do what you propose? I'm not well versed in network configuration. –  fbrereto Jun 27 '11 at 22:29
    
OK - we might need a chat room for this. Can you hit me up here for some Q/A? chat.stackexchange.com/rooms/643/discussion-with-bmike –  bmike Jun 27 '11 at 22:48
    
It looks like this might be a good place to start. superuser.com/questions/4904/… Also, I'll put some unorganized ideas in a chat room - hit me up there if you want more discussion before I can know how to propose an answer. I don't know how much detail you want on networking... chat.stackexchange.com/rooms/643/discussion-with-bmike –  bmike Jun 27 '11 at 22:59
add comment

1 Answer 1

up vote 0 down vote accepted

The solution was to perform the following:

sudo /sbin/route -n delete default A.B.C.D
sudo /sbin/route -n add -net A A.B.C.D
sudo /sbin/route -n add default E.F.G.H

(details as to the above can be found in the question.)

share|improve this answer
add comment

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.