How can I make ethernet take precedence over wifi on Ubuntu 18.04?

Clash Royale CLAN TAG#URR8PPP
Goal
Let ethernet take precedence over wireless when ethernet cable is plugged in
Method
After having done a fair amount of Googling and reading I've come to a point where I believe what I should be doing is something along the lines of
nmcli connection modify [id-of-ethernet-interface] ipv4.route-metric 200
nmcli connection modify [id-of-ethernet-interface] ipv6.route-metric 200
where 200 is a lower value than the wireless metric, to have the ethernet take precedence over the wireless.
Results
What perplexes me is the reports I get from route -n after I have executed the above commands and rebooted (for good measure), and the fact that this doesn't seem to amount to reaching my goal
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use 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 with regards to my command execution, but for the lines that say
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 has 20 prefixed before the 200 value I set. This keeps being consistently applied based on what I run; If I change the value for the metric through nmcli to say 500, route -n will report 20500. Why does this happen? It sure doesn't look right, since I stated I wanted either 200 or 500, not 20200 and 20500.
The second line has a metric value that I have no idea where it comes from, and I can't seem to affect it at all. If anyone can shed light on this, I'm grateful.
It doesn't look like these commands end up in anything tangible, other than affecting the metrics; I cannot tell that that ethernet is taking precedence, so I assume it is not.
Other findings
What I have found curious, and seem to be working to some extent, is the use of $ sudo ifmetric enp0s31f6 200. This does two to three things;
- It affects the metric of the interface (
route -nreports all lines with the Ifaceenp0s31f6to have the value 200) - It affects the UI in Ubuntu (In the upper right corner I will see a visual switch between ethernet and wireless icons switching, depending on the metric values I provide in the
ifmetriccommand) - It sometimes throws a
NETLINK: Error: File existserror at me. Subsequent executions of the same command may or may not result in this error
Some system info
- EliteBook 850 G5
- Ubuntu 18.04
- Ubuntu install made through letting the installer use the entire disc, enabled encryption, enabled 3rd party downloads for drivers, etc.
Update #1
$ nmcli c show
NAME UUID TYPE DEVICE
Wired connection 2 [n/a] ethernet enp0s31f6
WiFi1 [n/a] wifi wlp1s0
$ route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 [n/a] 0.0.0.0 UG 600 0 0 wlp1s0
0.0.0.0 [n/a] 0.0.0.0 UG 20200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 600 0 0 wlp1s0
[n/a] 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
ubuntu networking
migrated from serverfault.com Jan 16 at 15:55
This question came from our site for system and network administrators.
add a comment |
Goal
Let ethernet take precedence over wireless when ethernet cable is plugged in
Method
After having done a fair amount of Googling and reading I've come to a point where I believe what I should be doing is something along the lines of
nmcli connection modify [id-of-ethernet-interface] ipv4.route-metric 200
nmcli connection modify [id-of-ethernet-interface] ipv6.route-metric 200
where 200 is a lower value than the wireless metric, to have the ethernet take precedence over the wireless.
Results
What perplexes me is the reports I get from route -n after I have executed the above commands and rebooted (for good measure), and the fact that this doesn't seem to amount to reaching my goal
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use 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 with regards to my command execution, but for the lines that say
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 has 20 prefixed before the 200 value I set. This keeps being consistently applied based on what I run; If I change the value for the metric through nmcli to say 500, route -n will report 20500. Why does this happen? It sure doesn't look right, since I stated I wanted either 200 or 500, not 20200 and 20500.
The second line has a metric value that I have no idea where it comes from, and I can't seem to affect it at all. If anyone can shed light on this, I'm grateful.
It doesn't look like these commands end up in anything tangible, other than affecting the metrics; I cannot tell that that ethernet is taking precedence, so I assume it is not.
Other findings
What I have found curious, and seem to be working to some extent, is the use of $ sudo ifmetric enp0s31f6 200. This does two to three things;
- It affects the metric of the interface (
route -nreports all lines with the Ifaceenp0s31f6to have the value 200) - It affects the UI in Ubuntu (In the upper right corner I will see a visual switch between ethernet and wireless icons switching, depending on the metric values I provide in the
ifmetriccommand) - It sometimes throws a
NETLINK: Error: File existserror at me. Subsequent executions of the same command may or may not result in this error
Some system info
- EliteBook 850 G5
- Ubuntu 18.04
- Ubuntu install made through letting the installer use the entire disc, enabled encryption, enabled 3rd party downloads for drivers, etc.
Update #1
$ nmcli c show
NAME UUID TYPE DEVICE
Wired connection 2 [n/a] ethernet enp0s31f6
WiFi1 [n/a] wifi wlp1s0
$ route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 [n/a] 0.0.0.0 UG 600 0 0 wlp1s0
0.0.0.0 [n/a] 0.0.0.0 UG 20200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 600 0 0 wlp1s0
[n/a] 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
ubuntu networking
migrated from serverfault.com Jan 16 at 15:55
This question came from our site for system and network administrators.
Ethernet should be preferred by default. Strange. Is the output ofnmcli c showthe same asroute -n's output?
– Tommiie
Jan 7 at 14:11
See my updated question.
– shellström
Jan 16 at 13:32
Please update your question with those result instead of dumping them in a comment.
– Tommiie
Jan 16 at 13:34
Yeah, I realised pretty fast, the dump into the comments weren't gonna work out. I'm making amendments to the edit. Give me 1 more minute, and you'll have the complete output. It's done.
– shellström
Jan 16 at 13:37
add a comment |
Goal
Let ethernet take precedence over wireless when ethernet cable is plugged in
Method
After having done a fair amount of Googling and reading I've come to a point where I believe what I should be doing is something along the lines of
nmcli connection modify [id-of-ethernet-interface] ipv4.route-metric 200
nmcli connection modify [id-of-ethernet-interface] ipv6.route-metric 200
where 200 is a lower value than the wireless metric, to have the ethernet take precedence over the wireless.
Results
What perplexes me is the reports I get from route -n after I have executed the above commands and rebooted (for good measure), and the fact that this doesn't seem to amount to reaching my goal
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use 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 with regards to my command execution, but for the lines that say
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 has 20 prefixed before the 200 value I set. This keeps being consistently applied based on what I run; If I change the value for the metric through nmcli to say 500, route -n will report 20500. Why does this happen? It sure doesn't look right, since I stated I wanted either 200 or 500, not 20200 and 20500.
The second line has a metric value that I have no idea where it comes from, and I can't seem to affect it at all. If anyone can shed light on this, I'm grateful.
It doesn't look like these commands end up in anything tangible, other than affecting the metrics; I cannot tell that that ethernet is taking precedence, so I assume it is not.
Other findings
What I have found curious, and seem to be working to some extent, is the use of $ sudo ifmetric enp0s31f6 200. This does two to three things;
- It affects the metric of the interface (
route -nreports all lines with the Ifaceenp0s31f6to have the value 200) - It affects the UI in Ubuntu (In the upper right corner I will see a visual switch between ethernet and wireless icons switching, depending on the metric values I provide in the
ifmetriccommand) - It sometimes throws a
NETLINK: Error: File existserror at me. Subsequent executions of the same command may or may not result in this error
Some system info
- EliteBook 850 G5
- Ubuntu 18.04
- Ubuntu install made through letting the installer use the entire disc, enabled encryption, enabled 3rd party downloads for drivers, etc.
Update #1
$ nmcli c show
NAME UUID TYPE DEVICE
Wired connection 2 [n/a] ethernet enp0s31f6
WiFi1 [n/a] wifi wlp1s0
$ route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 [n/a] 0.0.0.0 UG 600 0 0 wlp1s0
0.0.0.0 [n/a] 0.0.0.0 UG 20200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 600 0 0 wlp1s0
[n/a] 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
ubuntu networking
Goal
Let ethernet take precedence over wireless when ethernet cable is plugged in
Method
After having done a fair amount of Googling and reading I've come to a point where I believe what I should be doing is something along the lines of
nmcli connection modify [id-of-ethernet-interface] ipv4.route-metric 200
nmcli connection modify [id-of-ethernet-interface] ipv6.route-metric 200
where 200 is a lower value than the wireless metric, to have the ethernet take precedence over the wireless.
Results
What perplexes me is the reports I get from route -n after I have executed the above commands and rebooted (for good measure), and the fact that this doesn't seem to amount to reaching my goal
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use 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 with regards to my command execution, but for the lines that say
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 has 20 prefixed before the 200 value I set. This keeps being consistently applied based on what I run; If I change the value for the metric through nmcli to say 500, route -n will report 20500. Why does this happen? It sure doesn't look right, since I stated I wanted either 200 or 500, not 20200 and 20500.
The second line has a metric value that I have no idea where it comes from, and I can't seem to affect it at all. If anyone can shed light on this, I'm grateful.
It doesn't look like these commands end up in anything tangible, other than affecting the metrics; I cannot tell that that ethernet is taking precedence, so I assume it is not.
Other findings
What I have found curious, and seem to be working to some extent, is the use of $ sudo ifmetric enp0s31f6 200. This does two to three things;
- It affects the metric of the interface (
route -nreports all lines with the Ifaceenp0s31f6to have the value 200) - It affects the UI in Ubuntu (In the upper right corner I will see a visual switch between ethernet and wireless icons switching, depending on the metric values I provide in the
ifmetriccommand) - It sometimes throws a
NETLINK: Error: File existserror at me. Subsequent executions of the same command may or may not result in this error
Some system info
- EliteBook 850 G5
- Ubuntu 18.04
- Ubuntu install made through letting the installer use the entire disc, enabled encryption, enabled 3rd party downloads for drivers, etc.
Update #1
$ nmcli c show
NAME UUID TYPE DEVICE
Wired connection 2 [n/a] ethernet enp0s31f6
WiFi1 [n/a] wifi wlp1s0
$ route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 [n/a] 0.0.0.0 UG 600 0 0 wlp1s0
0.0.0.0 [n/a] 0.0.0.0 UG 20200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 200 0 0 enp0s31f6
[n/a] 0.0.0.0 255.255.255.192 U 600 0 0 wlp1s0
[n/a] 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
ubuntu networking
ubuntu networking
asked Nov 29 '18 at 9:38
shellström
migrated from serverfault.com Jan 16 at 15:55
This question came from our site for system and network administrators.
migrated from serverfault.com Jan 16 at 15:55
This question came from our site for system and network administrators.
Ethernet should be preferred by default. Strange. Is the output ofnmcli c showthe same asroute -n's output?
– Tommiie
Jan 7 at 14:11
See my updated question.
– shellström
Jan 16 at 13:32
Please update your question with those result instead of dumping them in a comment.
– Tommiie
Jan 16 at 13:34
Yeah, I realised pretty fast, the dump into the comments weren't gonna work out. I'm making amendments to the edit. Give me 1 more minute, and you'll have the complete output. It's done.
– shellström
Jan 16 at 13:37
add a comment |
Ethernet should be preferred by default. Strange. Is the output ofnmcli c showthe same asroute -n's output?
– Tommiie
Jan 7 at 14:11
See my updated question.
– shellström
Jan 16 at 13:32
Please update your question with those result instead of dumping them in a comment.
– Tommiie
Jan 16 at 13:34
Yeah, I realised pretty fast, the dump into the comments weren't gonna work out. I'm making amendments to the edit. Give me 1 more minute, and you'll have the complete output. It's done.
– shellström
Jan 16 at 13:37
Ethernet should be preferred by default. Strange. Is the output of
nmcli c show the same as route -n's output?– Tommiie
Jan 7 at 14:11
Ethernet should be preferred by default. Strange. Is the output of
nmcli c show the same as route -n's output?– Tommiie
Jan 7 at 14:11
See my updated question.
– shellström
Jan 16 at 13:32
See my updated question.
– shellström
Jan 16 at 13:32
Please update your question with those result instead of dumping them in a comment.
– Tommiie
Jan 16 at 13:34
Please update your question with those result instead of dumping them in a comment.
– Tommiie
Jan 16 at 13:34
Yeah, I realised pretty fast, the dump into the comments weren't gonna work out. I'm making amendments to the edit. Give me 1 more minute, and you'll have the complete output. It's done.
– shellström
Jan 16 at 13:37
Yeah, I realised pretty fast, the dump into the comments weren't gonna work out. I'm making amendments to the edit. Give me 1 more minute, and you'll have the complete output. It's done.
– shellström
Jan 16 at 13:37
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494864%2fhow-can-i-make-ethernet-take-precedence-over-wifi-on-ubuntu-18-04%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494864%2fhow-can-i-make-ethernet-take-precedence-over-wifi-on-ubuntu-18-04%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Ethernet should be preferred by default. Strange. Is the output of
nmcli c showthe same asroute -n's output?– Tommiie
Jan 7 at 14:11
See my updated question.
– shellström
Jan 16 at 13:32
Please update your question with those result instead of dumping them in a comment.
– Tommiie
Jan 16 at 13:34
Yeah, I realised pretty fast, the dump into the comments weren't gonna work out. I'm making amendments to the edit. Give me 1 more minute, and you'll have the complete output. It's done.
– shellström
Jan 16 at 13:37