20

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.

3
  • What IP range does your WiFi assign? Apr 2, 2012 at 19:47
  • @KyleCronin It is connected to 192.168.19.1 as its router with a subnet mask of 255.255.255.0 Apr 2, 2012 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. Apr 2, 2012 at 19:51

2 Answers 2

24

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.

2
  • Thanks what you suggested helped me. I am using my mac as a media server for my ps3 over ethernet and my wifi wouldn't work when the media server was in use. I prioritized wifi first and ethernet second and left everything else on automatic and it all works. Thanks a lot.
    – user142730
    Aug 23, 2015 at 21:36
  • Thanks this worked for me. Leaving the router field blank enabled me to use ethernet to access my private network and the wifi to access the internet.
    – youssman
    Aug 2, 2017 at 15:25
8

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.

2
  • 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. Apr 2, 2012 at 20:33
  • @jakebird451 Yes, your problem can be solved using routing tables.
    – Adam Davis
    Apr 2, 2012 at 20:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .