Ethernet or wifi on mac

How does the Mac choose which connection to use when both Wifi and Ethernet are connected?

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?

6 Answers 6

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.

If ethernet is higher priority but disabled & Wifi is enabled & connected, what will happen when I plug in to ethernet? Will I disconnect from the network & reconnect? Or stay connected via Wifi?

→ anotherdave: the Wi-Fi interface will be turned down (equivalent of an ifconfig en1 down ), and the Ethernet interface will be turned up (equivalent of an ifconfig en0 up ). If this last one is based on DHCP, this will cause a DHCP request and answer (< 6 s). If any of your interfaces have intermitent drop out, this will lead to an endless interfaces switching and DHCP requests.

This doesn’t explain how a user can know which interface is now used for outgoing trafic, when several interfaces are actives and connected.

Just note. Since Apple engineers are stupid as, you can only use one interface at a time. And you need to order the one on top you want to use. If you try to access an IP that is not on the top most interface it simply will not work.

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.

enter image description here

Choose «Set Service Order. » to drag them into the preferred order.

enter image description here

This doesn’t explain how a user can know which interface is now used for outgoing trafic, when several interfaces are actives and connected.
With such a configuration the Wi-Fi icon in the menu bar may be full black when in fact all your network activity is going through the Ethernet! Such a configuration may create a network loop no user will ever be able to see and debug.

@danielAzuelos Sure, but that’s not the question here. It’s about how the Mac chooses, which is a priority based system. If the one on top is working, you’re connected. In the main network panel, you can see what interfaces are connected and whether or not it’s a successful connection. Cross-ref that with your priority list and you should have your answer.

Читайте также:  Вай фай раздает компьютер работает

@plainclothes what if you connect / disconnect network interfaces? how does macOS behave? say I’m on wifi and then connect ethernet so now I have both. What happens with existing and now connections? what if I do the opposite? how does priority play into all of this?

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 IPv4 or 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 Ethernet and 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 Terminal or xterm window):

route get default | grep interface 

Источник

Подключение Mac к интернету

На Mac можно легко подключаться к интернету, где бы Вы ни находились: дома, на работе или в дороге. Самые распространенные способы подключения — это Wi-Fi (беспроводное подключение) и Ethernet (подключение по проводам). Если ни то, ни другое не доступно, то можно использовать Instant Hotspot.

Использование Wi‑Fi

При наличии доступной сети Wi‑Fi в строке меню у верхнего края экрана отображается значок Wi‑Fi . Нажмите этот значок и выберите сеть, к которой нужно подключиться. Если рядом с названием сети Wi‑Fi отображается значок , эта сеть защищена паролем. Для подключения к этой сети нужно ввести пароль. Подключение с помощью Wi-Fi.

Использование Ethernet

Можно использовать Ethernet через сеть Ethernet или через DSL-модем либо кабельный модем. Если Ethernet доступен, подключите кабель Ethernet к порту Ethernet на компьютере Mac. Порт помечен вот таким символом: . Если на Вашем Mac нет встроенного порта Ethernet, можно использовать адаптер и подключить кабель Ethernet к порту USB или Thunderbolt. Подключение с помощью Ethernet.

Использование Instant Hotspot

Если нет ни доступных сетей Wi-Fi, ни Ethernet, можно попробовать использовать Instant Hotspot и подключить Mac к интернету при помощи режима модема на iPhone или iPad. Как подключиться с помощью iPhone или iPad.

Дома, на работе и в дороге

Когда Вы дома. Ваш интернет-провайдер может предлагать подключение к интернету как через Wi-Fi, так и через Ethernet. Узнайте у провайдера, какой тип подключения Вам доступен.

Когда Вы на работе. У Вас может быть как сеть Wi-Fi, так и сеть Ethernet. Узнайте в IT-отделе компании или у администратора сети, как подключиться к корпоративным сетям и какие правила использования в них действуют.

Когда Вы в дороге. Вы можете пользоваться точками доступа Wi-Fi (это общедоступные беспроводные точки доступа) или функцией Instant Hotspot на Mac (если Ваш Mac и Ваш сотовый оператор поддерживают эту функцию). Помните о том, что для использования некоторых точек доступа Wi-Fi нужно будет ввести пароль, принять условия обслуживания или внести дополнительную плату.

Источник

How does a Mac choose between Wi-Fi and Ethernet to work with? [duplicate]

My Mac is connected via a 1GBit Ethernet. However, from time to time I do turn on WiFi and let it connect, typically because I need to use AirDrop etc. When I’m done with AirDrop I usually turn the Wi-Fi off and stay on Ethernet. My thinking is that «wifi is slower» and my Mac may use it when downloading or uploading instead of my fast Ethernet. Now I realize this is not based on anything else other than fear. Is there truth to my fear? If a Mac has two active connections, Wi-fi, and Ethernet — what will it choose to use when I’m uploading a large file? Is there a possibility it would choose to use the slower Wifi connection? Or does it employ some kind of algorithm to figure out which one to use based on availability, type and speed?

Читайте также:  Управляемый вай фай билайн

3 Answers 3

It’s possible to set network access interface priority order. Go to System Preferences → Network, click on the lock icon to unlock the preference pane. Now click on the gear icon shown towards the bottom of the network interface list, and select Set Service Order. command.

enter image description here

Now, in the new pane that opens, you can drag the priority network interface (Ethernet in your case) to top.

enter image description here

(I do not have a LAN interface, so the same isn’t visible in the screenshot).

In a default setup, macOS will prefer the ethernet connection over the WiFi connection automatically. You do not need to fear that you’re limiting your network speeds by also connecting to WiFi.

You can change the default order by opening System Preferences, select Network, click on the Gear icon below the interface list and select «Set Service Order». There you can drag the interfaces to prioritize.

You can also list the current order from Terminal.app with:

networksetup -listnetworkserviceorder 

And change the default order by running the following command:

networksetup -ordernetworkservices

where etc. needs to replaced by the service names listed by the previous command.

If you have a slightly more advanced network setup, or are interested in networking — you need to know that the above mentioned answer (and the other answers here) are really a simplification of what actually happens.

Technically it is not so that the highest ordered interface is always used for network communication.

For example if the WiFi and Ethernet connections really connect to two different IP networks (i.e. two different LANs) — then macOS will route packets destined for local computers over the correct interface — so that computers only accessible through WiFi will be transmitted to over WiFi. This is handled by ordinary IP routing.

In addition, if you have a more specific route for a destination (rather than the default gateway) — then it will be routed over that interface instead of the one you have chosen as the top pick in the service order. This can often be the case with VPN software that inserts more specific routes for all or parts of the IP network.

Also the simple answer might seem a bit odd if you’re familiar with networking on Windows or Linux — as macOS is actually different in this respect.

On Windows and Linux the choice of which route to use when there’s multiple available at the same specificity, is actually determined by a metric on the route itself. This is different than on macOS where it is determined by a metric (the service order) on the interface.

Читайте также:  Драйвер для wifi compaq

Additionally, macOS actually automatically provides source routing in this case (contrary to other systems). This means that even though you have chosen for example «Ethernet» as your top pick, then if another computer contacts yours via the WiFi connection, your Mac will respond via the WiFi connection instead of the Ethernet. Even in the case, where if you had initiated the connection yourself, it would have taken place over Ethernet.

Источник

Connect to the internet with your Mac

Learn how to use Wi-Fi, Personal Hotspot, and Ethernet to connect to the internet.

Connect to a Wi-Fi network

From the Wi-Fi menu in the menu bar, choose a network. You might then be asked to enter the Wi-Fi network’s password or agree to terms and conditions.

Connect using Personal Hotspot

With most carrier plans, you can share the cellular data connection of your iPhone or iPad (Wi-Fi + Cellular) with your Mac. Learn how to set up Personal Hotspot.

Connect using Ethernet

To use a wired connection to the internet, connect an Ethernet cable between your router or modem and the Ethernet port on your Mac. Some Mac models require an Ethernet adapter, such as the Belkin USB-C to Gigabit Ethernet Adapter or the Apple Thunderbolt to Gigabit Ethernet Adapter.

Information about products not manufactured by Apple, or independent websites not controlled or tested by Apple, is provided without recommendation or endorsement. Apple assumes no responsibility with regard to the selection, performance, or use of third-party websites or products. Apple makes no representations regarding third-party website accuracy or reliability. Contact the vendor for additional information.

Источник

If my Mac is connected to ethernet and WiFi, which will it use? [duplicate]

As per title. I have ethernet issues at home and if I just turn WiFi on my MacMini, will this take over or will it default to ethernet unless I pull the cable out?

1 Answer 1

You can select the preferred connection in System Preferences -> Network. Then use the Gear-Icon and select «Set Service Order. «.

Your system will then prioritize the connection at the first position.

@Cullub That’s a very relevant question, but also much more complicated than you may realize. The two interfaces may be connected to the same network or two different networks. And if it is the same network does it use the same IP for both? And what if it is two different networks but both networks use the same IP range? And do the two networks run the same IP version or different IP versions or is one or both running dual stack? How is IP and outgoing interface chosen? Do you expect it to use ECMP? And are you communicating between two MPTCP capable devices?

Oh, I get that it might not work (or at least improve anything) for a lot of cases; I was just wondering if there were cases where being connected to WiFi and Ethernet would be beneficial.

One reason to use both Ethernet and WiFi could be if you want to be conmected to 2 different networks at the same time

What is the default preference in macOS? Does it matter if one is connected (or disconnected) first? What if you have multiple USB ethernet adapters connected?

Источник

Оцените статью
Adblock
detector