helloSystem / ISO

helloSystem Live and installation ISO
https://github.com/helloSystem/
BSD 3-Clause "New" or "Revised" License
807 stars 58 forks source link

Automatically switch to wired network when is available and while being connected to wireless network #469

Closed CocoCR300 closed 1 year ago

CocoCR300 commented 1 year ago

Describe the bug When the action specified at ethernet_tethering.conf runs when a new "ue" interface is added, an IP address is assigned but if, for example, a wireless network interface is active and a default route exits for it (so we have internet access), then a default route for the new interface is not added, so it is not possible to connect to the internet through it.

To Reproduce Steps to reproduce the behavior:

  1. Have an active internet connection with some network interface. netstat -r or netstat -rn should list a default route for the interface.
  2. Connect some device with USB Tethering. Wait until dhclient assigns an IP address for the new interface.
  3. Run netstat -r or netstat -rn.
  4. Only one default route is shown.

Expected behavior A default route is added for the new interface, allowing an internet connection through it.

Version (please complete the following information):

Computer (please complete the following information):

Additional context Adding the "New routers" address given by dhclient as a default route with sudo route add default [address] allows an internet connection with the interface, but I need to bring down the other interface (ifconfig wlan0 down) for it to work, is this the expected behavior?

probonopd commented 1 year ago

I don't know. So far I never had the need to add tethered Ethernet if I already have a working network connection.

Is there any particular command you would like to see running in addition to what ethernet_tethering.conf is currently running?

CocoCR300 commented 1 year ago

Well, I would expect this to work like it does in my phone, where it can be connected to mobile data and Wi-Fi at the same time (though this is a little bit different and I don't know if the system has this capability, having to put the wireless interface down tells me that it doesn't), or like on Windows, where it automatically drops the connection to the Wi-Fi network and connects to the Ethernet one. So that action would need to also add the new route and bring the active interface down, but I would like to know if the current behavior of dhclient is expected and if it's just my Wi-Fi adapter that doesn't like other network interfaces running at the same time.

CocoCR300 commented 1 year ago

For the first scenario, seems like I'm looking at link aggregation which requires some configuration and probably is not fine for a default setting, about dhclient, looking at /sbin/dhclient-script shows that only one default route is expected.

probonopd commented 1 year ago

Maybe this would be a task for Network.app?

CocoCR300 commented 1 year ago

Yeah, so I'm closing this.