How prioritize ethernet over wifi in Ubuntu 18.04?

6,114

Solution 1

It was hardware: my Toshiba USB-C Travel adaptor (PA5272U-2PRP). The problem persisted many weeks in which I worked mostly on wifi. After much hesitation (expense) I bought a similar adaptor: Goobay USB-C Premium Multiport dock. It works flawlessly.

Solution 2

Open the terminal application and type:

nm-connection-editor

On the window that opens, select your Wired Connection and click the gear icon at the bottom of the window to edit it. You need to select the General tab, enable "Connect automatically with priority", and change the priority to 1. This will prioritize the ethernet connection.

Understand that:

  • Ubuntu normally auto-selects the connection with the best performance.

  • If you have an ethernet connectivity problem, that would explain why your connections keep on switching.

  • Check that your USB-C port doesn't power itself down at idle... you may have to check BIOS settings for that.

enter image description here

Share:
6,114

Related videos on Youtube

Rob Rutten
Author by

Rob Rutten

Updated on September 18, 2022

Comments

  • Rob Rutten
    Rob Rutten over 1 year

    When I am on wifi and then plug in the Ethernet cable the internet connection switches to the latter (three-box symbol), but after pause it is back to wifi and I do not know how to return to Ethernet (which I want since much faster). Unplugging and reconnecting the cable doesn't affect the selection of wifi. I only found older (pre-18.04) recipes that do not work.

    I switched wifi off, took USB-C adapter out and back in, got network icon symbol, am on network (500 Mbps download) but the icon symbol changed to ?.

    Output of sudo lshw -C network

      *-network DISABLED        
           description: Wireless interface
           product: Wireless 8265 / 8275
           vendor: Intel Corporation
           physical id: 0
           bus info: pci@0000:02:00.0
           logical name: wlp2s0
           version: 78
           serial: f8:34:41:49:8c:e3
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
           configuration: broadcast=yes driver=iwlwifi driverversion=5.0.0-29-generic firmware=36.9f0a2d68.0 latency=0 link=no multicast=yes wireless=IEEE 802.11
           resources: irq:135 memory:d0000000-d0001fff
      *-network:0 DISABLED
           description: Ethernet interface
           physical id: 3
           logical name: wwp0s20f0u2i12
           serial: 12:c1:b8:08:68:e9
           capabilities: ethernet physical
           configuration: broadcast=yes driver=cdc_mbim driverversion=22-Aug-2005 firmware=CDC MBIM link=no multicast=yes
      *-network:1
           description: Ethernet interface
           physical id: 4
           logical name: enx0050b692363f
           serial: 00:50:b6:92:36:3f
           size: 1Gbit/s
           capacity: 1Gbit/s
           capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
           configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.09.9 duplex=full ip=192.168.178.10 link=yes multicast=yes port=MII speed=1Gbit/s
    
  • Rob Rutten
    Rob Rutten over 4 years
    thanks! But the nm-connection-editor window only shows wifi (current and past names). The ethernet light on the connector on my Toshiba Travel Aadaptor is green. Seems I should suspect that box?
  • Rob Rutten
    Rob Rutten over 4 years
    @heyennema: Aha, I now restarted the laptop (Toshiba) and now have Wired connection in the manager window. I followed your recipe; the priority setting was -999, changed it to 1. The icon remained the curved wifi symbol but the speed is 500 Bps so via the cable. Now hope it stays! Aha, now (minutes later) the icon became the three-box cable one.
  • Boris Hamanov
    Boris Hamanov over 4 years
    @RobRutten remember to undo the changes you made to /etc/network/interfaces. Also, please accept my answer if it was helpful. Thanks!
  • Rob Rutten
    Rob Rutten over 4 years
    @heyennema: next morning here. Reopen laptop. Laptop is on wifi, wifi symbol does not show network. I had removed that line in /etc/network/interfaces. I restarted laptop, again on wifi but now showing "network connected", after two minutes it switched to network. I checked nm-connection-editor, changes still there. Not there yet...
  • Rob Rutten
    Rob Rutten over 4 years
    By the way, in case some Stack overseer sees this, I find typing such comments very hard. I have emacs habits and type returns all the time. I then get thrown out with an incomplete comment. Luckiily I may edit but often 5 min is too short for me.
  • Boris Hamanov
    Boris Hamanov over 4 years
    @RobRutten Since your ethernet adapter is connected via your USB-C port, check your BIOS for a USB power setting. There should be one that keeps power to that port all the time. If you disconnect the wi-fi, disconnect the ethernet adapter, plug in the ethernet adapter, how long does it take to actually connect you to the Internet?
  • Boris Hamanov
    Boris Hamanov over 4 years
    @RobRutten status please...
  • Rob Rutten
    Rob Rutten over 4 years
    Sorry for silence. Two nightly halts after restart it went back to wireless and stayed there without mentioning network. I was waiting for an expert family member visit to check the bios (I don't dare ). But my moise shares that adaptor and works without interruptions. Your tirck above: switch wifi off, adaptor out, adaptor in: immediately on network! This is quick and esay to do, better than restart, so I will rely on this for now. Thanks!
  • Rob Rutten
    Rob Rutten over 4 years
    Again thrown out at 5 min editing. moise = mouse, tirck = trick, esay = easy.
  • Rob Rutten
    Rob Rutten over 4 years
    alas - network went off after 20 min. Wireless still off so my internet connection died. Plug adaptor out-in restored network immediately - but so still too flaky.
  • Rob Rutten
    Rob Rutten over 4 years
    Hour later I again lost network, after adaptor out and in I now also lost my mouse and that also didn't work with another (USB multiplier) adaptor in the other USB-C port. Restart didn't work, needed hard kill per power button. Your BIOS idea gets more likely...
  • Boris Hamanov
    Boris Hamanov over 4 years
    @RobRutten when the ethernet is working, edit your question and show me sudo lshw -C network.
  • Boris Hamanov
    Boris Hamanov over 4 years
    @RobRutten what is the wwp0s20f0u2i12 interface? Its got a driver from 2005.
  • Rob Rutten
    Rob Rutten over 4 years
    Our expert son visited and checked your suggestions. wwp0s20f0u2i12 is for gsm but I don't use that, no sim card. He found nothing in the BIOS. He enabled USB power on sleep, no difference. When on network cable with wifi off ethernet goes off after a few minutes, switches itself on after a second at request for website. Every few hours goes dead altogether, needing USB adapter pull-out and back in. The cable is cat3a, I tried another one, no difference. Now wonder about the Toshiba USB-C adapter (PA5272U-2PRP). Hesitate on a new one, they are expensive.
  • user68186
    user68186 over 4 years
    @heynnema It looks like OP found the problem to be hardware related. See answer below.