Precede Ethernet over wireless connections when the Ethernet cable is connected
After googling and reading a good deal, I've come to a point where I am believe What I should do is something like
nmcli change connection [id-of-ethernet-interface] ipv4.route-metric 200 nmcli change connection [id-of-ethernet-interface] ipv6.route-metric 200
Here, 200 is a lower value than the wireless metric for Ethernet to override wireless communication.
What baffles me is the reports I get
route -n After I've run the above commands and done a reboot (for a good measure), and the fact that this does not seem to accomplish the achievement of my goal
$ route -n Kernel IP routing table Destination Gateway Tag Ref Defaults to Iface 0,0,0,0 123,456,89,1 0,0,0,0 UG 600 0 0 wlp1s0 0.0.0.0 123.456.89.1 0.0.0.0 UG 20200 0 0 enp0s31f6 123.456.89.0 0.0.0.0 255.255.255.192 U 200 0 0 enp0s31f6 123.456.89.0 0.0.0.0 255.255.255.192 U 600 0 0 wlp1s0 654.321.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
The numbers add up in terms of my command execution, but for the lines that say so
0.0.0.0 123.456.89.1 0.0.0.0 UG 20200 0 0 enp0s31f6 654.321.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
The first line is preceded by 20 before the 200 value I set. This is applied consistently, depending on what I have done. If I change the value for the metric
nmcli 500 to say
route -n will report 20500. Why is this happening? It certainly does not look right, as I said I wanted either 200 or 500, not 20200 and 20500.
The second line has a metric value of which I have no idea where it comes from, and I can not influence it at all. If anyone can shed light on this topic, I am grateful.
It does not look as if these commands would end up in something tangible except the metrics. I can not say that ethernet has priority, so I assume that this is not the case.
What I found curious and apparently working something so far is the use of
$ sudo ifmetric dep0s31f6 200, That makes two or three things;
- It influences the metric of the interface (
route -nreports all lines with the Iface
enp0s31f6have the value 200)
- It affects the user interface in Ubuntu (In the top right corner, I see a visual switch between Ethernet and Wi-Fi icons, depending on the metric values I provide in
- It sometimes interjects
NETLINK: Error: file existsMistake with me. Subsequent executions of the same command can or can do not lead to this error
Some system information
- EliteBook 850 G5
- Ubuntu 18.04
- The Ubuntu installation was made by having the installer use the entire CD, enabling encryption, enabling third-party driver downloads, and so on.