Networking - Using two *different* ETH0 and WLAN0 connections simultanreously

First - I realize this is a very, very edge case, but if anyone has any ideas I’d appreciate it.

Short Story - is it possible to connect ETH0 to a LAN WITHOUT internet access, and WiFI (WLAN0) to a system WITH internet access and have both work?

Long Story

I am in an extended stay hotel for 1-2 months (1.5 weeks down and more to go) as my condo is being rebuilt after upstairs had an uncontained water leak that basically ruined my condo (very surreal to stand and watch water falling from every ceiling-mounted light, fan, and smoke detector for many hours and there was nothing I could do to stop any of it).

So, being the retired IT guy I am, I bought a $35 TPLink Archer54 router to create a NON-internet LAN to run a Lyrion Music Server (because I mostly listen to music, audiobooks, radio drama, etc.). The Hotel provides WIFI that is secured by LastName/RoomNumber which works decently enough. I had to manually configure the IP, Gateway, etc for the laptop’s ETH0 to connect to the router. I can also connect my cell phone’s WIFI to the router with a manual configuration (if I allow the router to DHCP neither laptop nor cell phone successfully connect to the router).

This all works :slight_smile:

Problem

If in KDE’s Networking System Configuration I connect my laptop’s ETH0 to the router while the laptop’s WIFI is connected to the Hotel WIFI, the WIFI no longer has internet access. The networking system still shows a WLAN0 connection and shows the IP assigned, but no internet. All attempts to connect to some remost host in email, web, etc. result in a timeout.

I found three different possible solutions to this issue which rely on a special built LD_PRELOAD library shim that acts as a mediator to force an application to use a specific system IP. None of them, unfortunately, work. They all appear to load successfully, but internet access still fails (see this blog post where all three are mentioned: Binding applications to a specific IP | Daniel Lange's blog).

Questions

  • Does anyone know of a way to tell the KDE networking to attempt to use WLAN0 first on any attempted use of the network and if that fails to then use ETH0? Playing with Priority in the settings seems to have had no affect so far as I can see (is there a way to check this??).
  • Is there a way to tell the KDE networking by application which to use (since the binding library approach did not work)?
  • Is there a way to get the binding libraries mentioned at that blog post to work?

Thanks in advance for any help.

Do you want the laptop to be a gateway between the LAN and WiFi or should the laptop just have access to both networks without LAN devices having Internet?

If the latter, do you really need a per-app network configuration or can all applications be allowed to see both networks?

Oh well, at work I have similar problems, eg. accessing an embedded device via wifi and accessing internet via eth (or via a wifi dongle).

I never got NetworkManager metrics working properly (you can set them via nmcli con edit). The only way around I have is launching a script that sets appropriate metrics to the interfaces, eg. lower metric to eth and higher to wlan.

Considering the case wifi + wifi via usb dongle, when leases change at router side, metrics screw up and I have to launch again my script.

How I understand the script must be relaunched? When I don’t reach internet :rofl: . I’ll work on this when I’ll have the time, thinking about a simple application which monitors the metrics and reapplies them properly.

1 Like

krake - I don’t need the laptop to be a gateway. As is, the router’s set to 10* with gateway 10.0.0.1 and subnet 255.255.255.0. Both ETH0 and my cell phone’s WIFI, when manually configured (e.g., laptop ETH0 to 10.0.0.234 and cell phone to 10.0.0.236) connect to the router and “see” the LMS server configured at 10.0.0.235. I can ssh to the LMS server from both laptop and cell when connected. But BOTH laptop and cell loose internet connectivity when I do this. Cell because I connect its WIFI to the router which disconnects the hotel’s WIFI. Laptop because for some reason I don’t understand, the KDE/Linux networking absolutely privileges ETH0 over WLAN0.

I do not need per app network configuration. I attempted to use the LD_PRELOAD shim to solve the lack of internet connectivity on the laptop when I connect ETH0 to the router hoping that I could temporarily force, say, firefox to use WLAN0. Alas, as I said, all three approaches though they appear to load to not solve the internet connectivity issue.

I guess the default route gets set to point to your LAN connection but you actually want it to point to the WiFi and only route LAN addresses on LAN.

No idea if or how this can be done through the UI though.

1 Like

gcarlo_f

What do you mean “set metrics” for your configured network devices? I took a look at nmcli and it is very daunting to figure out since most of the available parameters are, to me, unintelligible :rofl:

Maybe you can change the Ethernet connection’s IPv4 and IPv6 method option to “share to other computers” and change your setup accordingly?

I used to do something similar.

1 Like

I think this might be what you’re looking for

3 Likes

Yes NM config is quite messy (I believe simply because networking is a huge topic).

You can set the NM metrics this way (lower metric is the preferred):

nmcli con modify ethernet_connection ipv4.route-metric 10
nmcli con modify wifi_connection ipv4.route-metric 100

but I never got this working properly.

2 Likes

BINGO! I think we have a winner. Setting

$ nmcli c # To see configured connections
$ nmcli c mod "Hilton Honors" ipv4.route-metric 20  # More preferred connection
$ nmcli c mod "ETH0" ipv4.route-metric 40  # Less preferred connection

Apparently does the trick. Ethernet is connected to router (which has no internet) and internet access via WIFI still works. I can point a browser to the server IP on the router 10.0.0.x in a browser and it comes up and I can send this at the same time.

Thank you SO much.

1 Like

gcarlo_f, happy to say, sorry for you, that this does work for me. BUT - without the “ethernet_connection” and “wifi_connection” strings, see my followup post.

1 Like