When I'm connected to two networks with separate routers using Wifi and Ethernet, how does my Mac know what connection to use when I visit a website?
From the Apple Support database article regarding network connection priority:
If you connect to the Internet or a network in several different ways (using Wi-Fi or Ethernet, for example), you can change the order of the network port configurations your computer tries when connecting to the Internet or network.
If there are multiple active network port configurations when you try to connect, OS X tries the one at the top of the list first, and then tries the other port configurations in descending order.
In that support article it is also described how you can change the priority order of network connections in System Preferences.
I recommand you to never use a configuration where you may have at the same time different interfaces up on the same machine. You won't have any easy knowledge and control of this dual connectivity.
This may lead to huge difficulties to analyse even the simplest network trouble.
This may also cause loops within company or personnal networks very hard to diagnose. For example, have a look at the following command:
sysctl -a | grep forwarding
which will show you if
IPv6 is going through your Mac from one
interface through the other without your knowledge or control.
As much as possible define locations with the interface you know you want to connect to and switch on the right one at will:
Apple menu > Location > Home / AirPort > Office / Ethernet > outside / AirPort [unsecure] > …
When 2 (or more) interfaces (for example
Wi-Fi) are flagged green (Connected) within:
Apple menu > System Preferences… > Network
one way to know which one you are taking to reach the outside is the following line command (within a
route get default | grep interface
The Service Order doesn't work. If you test it, you will find that Mac OS prioritizes Wifi over Ethernet, even if Ethernet is set higher in the Service Order.
One way to test it is to measure your bandwidth (e.g., https://www.fast.com) in the following scenarios:
- Connected to Wifi, with Ethernet unplugged
- Connected to Ethernet, with Wifi turned off
- Connected to Wifi and Ethernet
You will find that the speed from #2 is faster than #1 and #3. You will also find that #1 and #3 are the same speed.
The only solution is to disable WiFi when you connect via Ethernet and turn on Wifi when you disconnect Ethernet.
This script does that automatically!
If you have any issues, search the comments for the error message you encounter. For example, I got the
Path had bad ownership/permissions error, but the solution is posted in the comments.
When my M1 iMac arrives, I will be connecting to my old 2013 27" iMac which I'm keeping until a 32-bit program's conversion to 64-bit is beta. I could use Wi-Fi or an ethernet cable (My old Mac has Thunderbolt-1). And I plan on doing some data transferring with my wife's newer iMac with a Thunderbolt-3 cable, carrying my Mac into her Mac's room.
I figure the Thunderbolt-3 is fastest, and Wi-Fi's slowest.
I'm guessing that I should turn off Wi-Fi while I'm doing the transferring, and that's all I will need to do. Is that correct?
While this is true for some applications, what I experienced when I had connected my iMac to two ISP's - one wifi and another through LAN - applications like uTorrent and Games could apparently use both networks simultaneously. I got more download speed than individual connections and in case of multiplayer games, I could connect to servers with less lag and latency.