I just installed Ubuntu Server (Bionic Beaver) on a new PC.
It seems like my internet connection does not work at all (pinging Google does not work and the orange LED on the ethernet port lights constantly), so I did some research on Google (via another PC...).
I found out that this could be an incompatible driver version.
Ubuntu 18.04 LTS comes with Linux Kernel 4.15 (https://wiki.ubuntuusers.de/Bionic_Beaver/).
My NIC: Realtek 8111HS
As I have absolutely no experience with drivers and that kind of things, I visited some webpages and found the following:
https://launchpad.net/ubuntu/bionic/+package/r8168-dkms which seems to be an older driver version as it says "This driver should only be used for devices not yet supported by the in-kernel driver r8169."
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/realtek?h=v4.15 Indeed, (I think) this shows that Kernel 4.15 comes with the newer 8169 driver version
https://medium.com/@lgobinath/no-ethernet-connection-in-ubuntu-16-04-linux-mint-18-with-realtek-rtl8111-8168-8411-7ae2779dc9b8 This article is about the same problem (more or less)
https://www.realtek.com/en/component/zoo/advanced-search/72?Itemid=276 This is the Realtek Software Download site, unfortunately, my NIC is not listed there, but only some others like RTL8111F, RTL8111G and RTL8111GUS. However, the software button takes me to this download site:
https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software So I chose Unix (Linux) -> LINUX driver for kernel up to 4.15 and downloaded the software. What did I get? Driver version r8168-8.046.00. Strange, as this version does not appear on the site above. Instead, the launchpad site (link above) shows me several versions of which the latest are r8168-dkms 8.045.08-2 in amd64 (Proposed)/(Released). So I also downloaded the (Released) version there by clicking on it -> Downloadable files -> downloading the .deb file. I don't think that that's the right file though, because the folder structure is weird: it contains two directories 'control' and 'data'. So I assume this is for Debian only, not for Ubuntu and consequently not for me.
So I also downloaded the source file from here:
https://launchpad.net/ubuntu/+source/r8168/8.045.08-2 I chose the largest file which is about 1.2MB (fortunately, because the other file I downloaded, the 8.046 file, has about the same size, so I feel confirmed). One thing that I still don't understand is why the included README file lists a ton of NICs: This is the Linux device driver released for RealTek RTL8168B/8111B, RTL8168C/8111C, RTL8168CP/8111CP, RTL8168D/8111D, RTL8168DP/8111DP, and RTL8168E/8111E Gigabit Ethernet controllers with PCI-Express interface., but my Realtek 8111HS is not included although the launchpad site again explicitly lists my NIC.
So the steps I would take to resolve my problem are the following:
- Take the 'r8168_8.045.08.orig.tar.bz2' file from here, put it onto a USB stick, plug the stick into the Ubuntu PC, copy the file to the root folder (extract) and execute autorun.sh with root rights (or basically, do everything as mentioned in the README).
Is that correct? Will everything work after that? Do I still have to patch anything or uninstall the old driver or reload anything? Will it work? Are my assumptions correct?
I know, this question might be a little long, however I think it was more important to be accurate than keeping the answer short and (maybe) forgetting something.
Edit: Just found out that v8.046 is part of Ubuntu Cosmic.
Also, I configured my network by editing the yaml file in
/etc/netplan with DHCPv4 as described here.(and with correct indentation!)
The result of
lspci -nnk | grep 0200 -A3:
02:00:0 Ethernet controller [<red>0200</red>]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15) Subsystem: Gigabyte Technology Co., Ltd. Onboard Ethernet [1458:e000] Kernel driver in use: 8169 Kernel modules: r8169
The Netplan configuration file (YAML):
network: version: 2 renderer: networkd ethernets: enp3s0: addresses:  dhcp4: true