Wi-Fi and LAN at the same time

As the question says, I have two Ethernet devices that I need to use. Wi-Fi hotspot for general traffic, and LAN connection for local traffic (192.168.1. *). Currently Wi-Fi receives all traffic and ignores the presence of local local devices. I am trying to communicate with this device using python urllib2 and basic HTTP settings. The program works partially when I turn off one or the other (turning off Wi-Fi makes the LAN code work, and turning on LAN turns off the work of the wifi / shared traffic code). I believe this is more of an operating system issue than a programming issue, but I could be wrong. I have been messing with the Ethernet setup in the system settings but nothing seems to work so far.

Thanks for the help.


source to share

2 answers

Depending on your needs and degrees of freedom, you can:

1) The simplest. If you can manage one or two network ranges, you can put Wi-Fi and LAN on different subnets. For example 192.168.2. * Can be LAN traffic, but 192.168.1. * Maybe wifi. If only the WiFi side has a gateway, then all traffic except 2. * traffic must be routed over WiFi, and all 1. * traffic goes to the LAN. There are no changes on your computer.

2) Medium: If you do not control the networks, you can define routing rules for the two ports. This allows you to tell certain IP addresses to be reached over Wi-Fi and others over the LAN port. An example on Linux that I think should work on OS X as well: http://linux-ip.net/html/routing-tables.html The hardest part is making sure you don't get stuck in when you are on someone else's network ... You can do this by creating narrow routing rules, or turning them off when you don't need them. It looks like you are doing it from a python program, so maybe the program can turn it on and off on startup and shutdown.

3) Slightly more exotic: I was not completely sure about your question, but if you are trying to load balance (not separate networks) you can create rules to bundle two network ports and distribute traffic across them.This is not what I did but real network engineers know how to set up this stuff.

I could expand on one of them if you clarify what you are trying to do and what degrees of freedom you have.



For someone you don't want to do research, you can just repeat my steps:

  • Open System Preferences
  • click "Network"
  • (make sure priority, first thunderbolt then wifi) click on thunderbolt
  • Configure IPv4 manually
  • remove router
  • done!

I have exactly the same user case. But I read this without any networking knowledge.

I achieved this simply by following @ Nils' instructions 1). I only understand these instructions after reading this link



All Articles