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:
In that support article it is also described how you can change the priority order of network connections in System Preferences.
It's in your Network Preferences. Here's screen shots from 10.7.3.
Access the settings from the gear at the bottom of the network type sidebar.
Choose "Set Service Order..." to drag them into the preferred order.
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:
which will show you if
As much as possible define locations with the interface you know you want to connect to and switch on the right one at will:
When 2 (or more) interfaces (for example
one way to know which one you are taking to reach the outside is the following line command (within a