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.

Brief Description:

I need my Ethernet card (en0) to see all traffic under 192.168.2.xxx.

However I also need to use WiFi card (en1) for all other traffic.

OS: OS X Lion


I am using a separate network location to deal with this specific use (since this is a for a robotics project that communicates via Ethernet). Ethernet (en0) had to be set up as a static IP (192.168.2.10) per the requirements for the device I am connecting to. All connections on the Ethernet card (en0) should be 192.168.2.xxx as specified above. WiFi (en1) is set up as DHCP to a router since their is no point in assigning it as a static for general purpose traffic. Ethernet (en0) is set up as priority over WiFi (en1).

I would also like to keep this under the network location preferences if at all possible since I do not require this feature to be on all the time.

I would really appreciate your help on this. No one I have talked to knows how to solve this.

share|improve this question
    
What IP range does your WiFi assign? –  Kyle Cronin Apr 2 '12 at 19:47
    
What have you tried so far and what has happened? –  jtbandes Apr 2 '12 at 19:49
    
@KyleCronin It is connected to 192.168.19.1 as its router with a subnet mask of 255.255.255.0 –  jakebird451 Apr 2 '12 at 19:49
    
@jtbandes Since en0 is priority one, it hogs all traffic and disregards the existence of en1. However, if I unplug en0, en1 traffic works. –  jakebird451 Apr 2 '12 at 19:51

2 Answers 2

Mac OS X gives the default route to the highest-ranked, active interface. It doesn't have anything to do with bandwidth. To change interface rankings, go to System Preferences > Network, click the cog drop-down menu under the list of devices and select Set Service Order. Then drag to rearrange your interface rankings.

(source)

For your case, set the limited network above the internet connection. OS X will attempt to route packets to the first interface. For packets meant for that network, it will work fine. For packets not meant for that network it will see that it doesn't have a gateway or route to the internet, and will route those to the next interface, which is internet connected.

If your smaller network does have routers or a gateway that you need to access, you'll have to edit your routing tables to tell OS X which IP addresses can be found on which networks.

But I believe in your case the simple solution of putting the smaller network at a higher priority will work.

share|improve this answer
    
I have already set up the network with priorities. Ethernet card (en0) with top priority and Wifi (en1) getting secondary priority. Unfortunately, ethernet (en1) eats all traffic when enabled. I believe your second to last paragraph is what I was looking for. Routing tables. Describing my robot is well, interesting. But it contains a wireless bridge with a switch on the other side of the bridge. –  jakebird451 Apr 2 '12 at 20:33
    
@jakebird451 Yes, your problem can be solved using routing tables. –  Adam Davis Apr 2 '12 at 20:38
up vote 5 down vote accepted

The solution was extremely simple.

  1. Prioritize ethernet to be first.
  2. Under System Preferences->Network Settings: where EN0 is Manually configured, leave the router field blank.

I thought the router field was required, so I filled it in. My Ethernet connection has a "router" per say, but it is not used to access general connections. By filling in that field, the Mac OS would automatically try to create a default route through the Ethernet NIC. This would redirect all miscellaneous traffic through the wrong router.

I also tried to delete this route in the routing tables before I found the solution to my problem. This would delete the route appropriately and allow the my software system to run correctly. However after around a minute or so, the route was re-added (as I later discovered) by the operating system. After the route was re-added the connections would fail, so I had to restart the process all over again. This fix proved to be unproductive.

I hope this helps someone with their networking issues.

share|improve this answer

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.