Dealing with the situation that some LAN network consisting of multiple connected devices without the access to the Internet needs some work, while simultaneously requiring access the Internet from my laptop over the wireless.

The problem is that NetworkManager prioritizes wired paths for the access to the Internet over wired networks. The actual path priority can be shown using the route command:

route -n

The output on my machine confirms that the wired connection on the interface enp0s31f6 takes precedence:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.20.1    0.0.0.0         UG    10     0        0 enp0s31f6
0.0.0.0         192.168.2.1     0.0.0.0         UG    3003   0        0 wlp4s0
192.168.2.0     0.0.0.0         255.255.255.0   U     3003   0        0 wlp4s0
192.168.20.0    0.0.0.0         255.255.255.0   U     10     0        0 enp0s31f6
192.168.250.0   0.0.0.0         255.255.255.0   U     425    0        0 anbox0

Modifying routes

The entries are sorted by the priority from the most preferred to the least. The proper solution would be to learn to modify the routes using the route command we used to print the routes out. In a hurry, I have resorted to the hacky solution that wraps away the hard parts. Enter ifmetric command:

yay -S ifmetric

No the priorities can be changed straight away without the need for understanding anything else:

sudo ifmetric enp0s31f6 10
sudo ifmetric wlp4s0 9

The first line is unnecessary as the 10 is the priority assigned to the wired network automatically, but it is included here for a good measure.

The priority numbers chosen are arbitrary, the only important bit is that the lower the number, the higher the position in the IP routing table, meaning the higher the priority to choose which interface is used for the Internet access. We can confirm now that the wireless interface wlp4s0 has the highest priority, providing Internet access over the wireless connection while simultaneously permits access to the devices on the isolated network over LAN:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    9      0        0 wlp4s0
0.0.0.0         192.168.20.1    0.0.0.0         UG    10     0        0 enp0s31f6
192.168.2.0     0.0.0.0         255.255.255.0   U     9      0        0 wlp4s0
192.168.20.0    0.0.0.0         255.255.255.0   U     10     0        0 enp0s31f6
192.168.250.0   0.0.0.0         255.255.255.0   U     425    0        0 anbox0

This is a 80th post of #100daystooffload.