[Guide] Resolve Realtek NIC Stability Issues on FreeBSD - pfSense (2.4.4, 2.4.5, 2.5.0) + OPNSense, use 2.5Gb Realtek

If you are running a pfSense/any FreeBSD machine with a Realtek NIC, you may have noticed it randomly shits the bed when under load:

re0: watchdog timeout
re0: link state changed to DOWN

Well, the default drivers in the FreeBSD kernel are older than dirt and god awful (if you mention this to them they get real confrontational), and Netgate won’t touch vendor driver distribution with a 10 foot pole. When the NIC is under load, it doesn’t respond to the software watchdog in time, and is reset. Happens with increasing frequency with a constant load, until it starts happening about 100 times a minute and the connection never comes back up.

Good news: you can load your own driver module that fixes this. I’ve uploaded 64-bit versions of 1.95 for pfSense 2.4.4, 2.4.5, and 2.5.0; 1.96.04 for 2.4.5, 2.5.0, and OPNSense 20.7. If you have a different version and would like a precompiled module, let me know and I’ll build one for you.

I am assuming you are using the shell. You can also use the virtual shell in the UI (Diagnostics->Command Prompt) along with the file editor and do the same stuff.

realtekdrivers.zip (1.1 MB)

  1. Download, unzip, and copy the module that matches your FreeBSD version (uname -rs) to /boot/kernel. Download it to your desktop and use SCP to copy it, or download it to your pfSense machine via fetch/curl/etc. pfSense 2.4.4 is 11.2, 2.4.5 is 11.3, 2.5.0-devel is 12.0.
commands to do this on your pfSense box (click me):
  1. Download the archive to your current working directory: fetch -o realtek.zip https://sbforumsuploads.s3.dualstack.us-east-2.amazonaws.com/original/2X/2/24b1c5215811de0b770a307fe4d87b65d427b6ed.zip
  2. Extract: unzip realtek.zip
  3. Copy (2.4.4): cp realtekdrivers/11.2/1.95/if_re.ko /boot/kernel
    Copy (2.4.5): cp realtekdrivers/11.3/1.96.04/if_re.ko /boot/kernel
    Copy (2.5.0): cp realtekdrivers/12.0/1.96.04/if_re.ko /boot/kernel
    You should use the latest version available in the package for your FreeBSD version if the guide text is not updated.
  1. Change perms of the if_re.ko file:

    chown root:wheel /boot/kernel/if_re.ko
    chmod 0555 /boot/kernel/if_re.ko

  2. Edit /boot/loader.conf.local (may need to be created) and add the line if_re_load="YES" I think it only has Vi by default, which is extremely annoying if you’re not familiar with it, so you can pkg install nano to make this easy (you’d then nano /boot/loader.conf.local).

  3. Enter the command kldload if_re.ko and if there’s no output, it’s been loaded (verify with kldstat)

  4. Reboot your machine and note how your Realtek interfaces don’t constantly kill themselves under load.

3 Likes

2.4.5 was recently released, is there a module available for it? It’s FreeBSD version 11.3.

Probably not, I’ll build one at some point today. It’s likely the other 11.x module will work, generally the major version changes are what breaks em - I’m still gonna make one though.

Edit: Built and uploaded.

1 Like

For this step, the file does not exist previously on my pfSense install. Do I assume it needs to be created? Or would there be another existing file in it’s place?

1 Like

It will need to be created, as by default there is only the /boot/loader.conf file, and the .local file is a user override that won’t be replaced with updates. nano won’t care either way if it doesn’t exist when you start though. Updating the guide to specify that.

1 Like

Excellent, thanks for clarifying!

Hello,

Which version of the driver is it ?

Realtek released the 1.96 version which support the RTL8125B, would you mind compiling this version please ? It to be used with OPNsense.

Regards.

It’s 1.95, but I have the source for 1.96 and can compile it. Which version of OPNsense are you using?

if you could provide the driver 1.96.04 for OPNsense 20.7 would be great.

@Skaarji @Lox
1.96.04 modules have been compiled and uploaded for FreeBSD 12.0 and 12.1 based systems.

1 Like

Awesome, thanks man.

Thanks heaps @Riggi !

@Skaarji I made the driver added to Opnsense master and a test kernel build. To test remove or comment out if_re_load="YES" and:

# opnsense-update -kr 20.7-re-mcast2
# opnsense-shell reboot

See here

Aug 11 10:01:59 router kernel: re0: <Realtek PCIe GbE Family Controller> port 0xc000-0xc0ff mem 0xfc099000-0xfc099fff,0xfebfc000-0xfebfffff irq 10 at device 10.0 on pci0
Aug 11 10:01:59 router kernel: re0: Using Memory Mapping!
Aug 11 10:01:59 router kernel: re0: Using 1 MSI-X message
Aug 11 10:01:59 router kernel: re0: ASPM disabled
Aug 11 10:01:59 router kernel: re0: version:1.96.04
Aug 11 10:01:59 router kernel: re0: Ethernet address: 00:1e:06:45:2d:2d
Aug 11 10:01:59 router kernel: re0: Ethernet address: 00:1e:06:45:2d:2d
Aug 11 10:01:59 router kernel: re0: link state changed to UP
1 Like

I got the driver for FreeBSD 12.1 to work on TrueNAS 12 Beta 2 using the Odroid H2+. A few things to note:

I had to put the if_re_load=“YES” in loader.conf, not loader.conf.local, as loader.conf.local got overwritten on reboot. Also, nano was already installed on the TrueNAS image so that made it easier to edit!

Interface re0 is the port above the USB 2.0 ports, and re1 is the interface above the USB 3.0 ports.

Once I installed TrueNAS initially, I had to use a USB ethernet adapter so that I could get to the UI, do some basic configuration, and get to the shell to make these changes. Once I manually loaded the driver with kldload, I went into the webUI and set the IP address for re0, then I rebooted and moved my cable from the USB adapter to the port above the USB 2.0 ports.

I haven’t load tested it yet to see if it is more stable than my USB ethernet adapter was. I’m happy that the two interfaces on the board now show.

I actually logged on and created an account to say thank you so much @Riggi for the compiled drivers. I had exhausted everything on my FreeNAS box including upgrading to TrueNAS beta to no avail. I was seeing the server drop off after only a few gig of transfers and noticed today that the console was still alive - the whole reason nothing was in my logs is nothing was wrong other than the network driver had crapped out. Followed the instructions as per PFsense and it worked a treat, all stable and solid now! Thank You @Riggi !

1 Like

Hi!

Is it possible to get an update for FreeBSD 11.3 based systems?

Yessir, built and uploaded.

Tank you so much!!

Greetings from down under.
Thank you so much @Riggi works perfectly in pfSense 2.4.5 (FreeBSD 11.3)
Just created an account for this.

@Riggi if you got a Patreon or any donation link, please share as I would like to appreciate your effort by buying you a coffee/beer!

Thanks again mate.

1 Like

I’m glad I could help you get it sorted, and I appreciate the sentiment - just recently threw one of these together. Cheers man.