FreeBSD 13.X and RTL8125 Ethernet Chipset
Author: Jonathan Vasquez <jon@xyinn.org>
Last Updated: 2023-03-12-1740
Running On: FreeBSD 13.2-STABLE (stable/13-n254781-d6852eed98ed/GENERIC)
Preface
My current motherboard ASUS TUF GAMING X670E-PLUS WIFI contains a RTL8125 chipset. The good news is that this ethernet adapter does have a driver available for FreeBSD that also has good performance (I did get a lock up once when the system was in a specifically stressful situation, but it hasn't happened again and it may not have been related to this driver). The bad news is that it doesn't work out of the box in FreeBSD 13.X. The steps below show you how to get this working.
Installation
Basically we are in a chicken-or-egg problem where the driver can be installed via pkg
. However, we don't have internet yet, so we can't do that. You'll need another computer for this, and a USB.
Get the realtek-re-kmod precompiled package
The first thing we want to do is download the pre-built ethernet driver for FreeBSD 13. The package will be located at pkg.freebsd.org/FreeBSD:13:amd64/latest/All/realtek-re-kmod-<major>.<minor>.pkg
, the only issue is that you need to know the exact version number, and the All
directory gives a 403 Forbidden if you try to access it directly. you can use FreshPorts to find the current version (I've provided the direct URL for your convenience). Try and download the file by replacing the version numbers to what you see. You may need to play around with the version numbers depending on the state of the repository at the time of access. For my own convenience, I'm mirroring a few versions of the driver here.
Once you download the file, put it on your USB.
Extract the file into place
On the affected computer, plug and mount your USB, and copy the file to your computer. Once you have the file (let's say it's called realtek-re-kmod-198.00.pkg
), we can do:
# tar xf realtek-re-kmod-198.00.pkg
# cp boot/modules/if_re.ko /boot/modules/if_re.ko
Add the following lines to /boot/loader.conf to override the built-in FreeBSD re(4) driver:
if_re_load="YES"
if_re_name="/boot/modules/if_re.ko"
Add the following to /etc/rc.conf to let the system set up DHCP for this interface:
ifconfig_re0="DHCP"
ifconfig_re0_ipv6="inet6 accept_rtadv"
Reboot your computer. You should hopefully now have internet. Once you are online, I would recommend re-installing the package via pkg
so that it's now registered with your package manager and you can then start receiving updates for the driver:
# pkg install realtek-re-kmod