Skip to content

Instantly share code, notes, and snippets.

@GlitchWitch
Last active October 22, 2024 04:44
Show Gist options
  • Save GlitchWitch/de26aa942a6eb877a3693ff3619054af to your computer and use it in GitHub Desktop.
Save GlitchWitch/de26aa942a6eb877a3693ff3619054af to your computer and use it in GitHub Desktop.
Setup the RTL8156 USB2.5G Ethernet Adapter on Ubuntu 20.04

RTL8156 USB2.5G Ethernet Adapter on Ubuntu 20.04

Download: https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-usb-3-0-software

Extract the downloaded drivers

sudo tar -xvjf r8152.53.56-2.15.0.tar.bz2 -C /usr/src/

Create a DKMS.conf file

sudo echo -e 'PACKAGE_NAME="r8152"\nPACKAGE_VERSION="2.15.0"\nBUILT_MODULE_NAME[0]="$PACKAGE_NAME"\nDEST_MODULE_LOCATION[0]="/updates/dkms"\nAUTOINSTALL="YES"\nREMAKE_INITRD="YES"' > /usr/src/r8152-2.15.0/dkms.conf

Copy the .rules file to /usr/lib/udev/rules.d

sudo cp /usr/src/r8152-2.15.0/50-usb-realtek-net.rules /usr/lib/udev/rules.d/50-usb-realtek-net.rules

Install and load the driver

sudo dkms add -m r8152 -v 2.15.0
sudo dkms build -m r8152 -v 2.15.0
sudo dkms install -m r8152 -v 2.15.0
sudo depmod -a
sudo modprobe r8152
@jpaodev
Copy link

jpaodev commented Mar 4, 2024

After installation:

root@pve:~# lshw -c network -businfo 
Bus info          Device           Class          Description
=============================================================
pci@0000:00:1f.6  enp0s31f6        network        Ethernet Connection (2) I219-LM
usb@2:3           enx00e04c68006e  network        Ethernet interface
root@pve:~# ethtool enx00e04c68006e
Settings for enx00e04c68006e:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 10Mb/s
        Duplex: Half
        Auto-negotiation: on
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00007fff (32767)
                               drv probe link timer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
        Link detected: no
root@pve:~# 

Tried installing the drivers that way, however had no success. Tried https://github.com/wget/realtek-r8152-linux before, same result.
Once I switch the LAN port from PCIe to the USB adapter the connection to my server can't be established again - do you have any ideas?

Version I used: 2.17.1 on proxmox kernel 6.2.16-15-pve
I'll try to debug it with a screen attached!:)

Thanks for the straightforward guide! 🙏

@GlitchWitch
Copy link
Author

GlitchWitch commented Mar 4, 2024

@jpaodev The out of tree Linux driver for this appears to only be made to support upto Kernel 5.17. Kernel 6+ should have native support and my guide should no longer be followed for distributions with more modern kernels.

I've used the same adaptor across both the latest release of Ubuntu and Proxmox without this.


As a tip, since it appears yours is detected and since you're using Proxmox, you will need to manually adjust your network configuration to use the new network interface before switching that connection. Read more here and here on that topic if you haven't already :]

(tl;dr update /etc/network/interfaces and replace enp0s31f6 with enx00e04c68006e before switching the cable and rebooting the networking stack)

@jpaodev
Copy link

jpaodev commented Mar 4, 2024

Will try that! Many thanks for the fast response and explanation - Have a nice week!:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment