The Pain of Realtek Strike Again on FreeBSD 14.2

2025-01-12

Table of Contents:

I used to have a lot of pain using a Realtek adapter in Linux 5 era, with Linux 6 where most of the drivers got merged into mainline, most of the headaches have been eased.

However, history seems to repeat itself. After upgrading my Realtek driver for my RTL8125 on FreeBSD to 1100.00.1401000_1 at some point, it stopped working.

Pinging from the box emits a sendto: No buffer space available error, DHCP works but I can't access it from outside.

Debugging

Checking if it's hardware or software

I tried searching up and down the Internet, and found out only I am having this kind of issue. Re-plugging the Ethernet cable seems to work, so I initially thought this is my hardware's fault.

But something strange happened, I have changed many cables and tried re-plugging many LAN ports from my router and server, after plugging, everything works for a while and then it eventually breakdown.

What's even worse, I can run a ifconfig re0 down && ifconfig re0 up to achieve the same effect, which made me think it's a driver problem.

To verify, I booted into a Fedora LiveCD, the Ethernet works out of the box, and ran several iperf tests, without any issues. At this point I'm convinced something is wrong with the FreeBSD driver.

Researching the driver

This took me a lot of time, since the FreeBSD package is actually using a different versioning than upstream git[1], since it edits makefiles for building, but the error has been mentioned on the git tracker.[2]

Luckily someone has added a legacy version to the ports, so I should be able to use the older version.

Solving the issue

Disabling the driver

For some reason, if I unplug my Ethernet cable, the WiFi goes down as well, so I have to disable Realtek first. According to the install message, comment out these on /boot/loader.conf:

# if_re_load="YES"
# if_re_name="/boot/modules/if_re.ko"

Install package, and reboot

Then reboot, and install the net/realtek-re-kmod198 package.

After installing, remove the comments from /boot/loader.conf, and reboot.

Verifying

After reboot, I verified the functionality by taking the Ethernet IP address from ifconfig output and pinging it.

Additionally I ran some iperf tests aswell:

# Server side
iperf3 -s
# Client side from my laptop
iperf3 -c <Ethernet IP> -t 120 # Test for 2 mins straight

[!NOTE] It's possible to test from router directly to test the link speed using the same command

The adaptor is supposedly possible to work in 2500BaseT, however I only achieved 1Gbits/sec, which is still satisfactory:

[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.01  sec  1.10 GBytes   941 Mbits/sec                  receiver

Morale of story: always be skeptical of Realtek stuff


  1. https://github.com/alexdupre/rtl_bsd_drv

  2. 283887