Realtek network interface cards have a bad reputation in the pfSense community. At least a part of it is due to the old Realtek drivers that ship with pfSense. However, it is possible to swap those drivers for newer ones used in OPNsense. Here's how.

First, find the driver in the OPNsense repository. Visit the repository page from your computer:

https://pkg.opnsense.org/FreeBSD:12:amd64/snapshots/latest/All/

On that page, find the package whose name contains re-kmod (meaning, Realtek kernel module). As of this writing, this package is realtek-re-kmod-196.04.txz. Note its full URL. In our case, it is:

https://pkg.opnsense.org/FreeBSD:12:amd64/snapshots/latest/All/realtek-re-kmod-196.04.txz

Next, log in to your pfSense router via ssh or console and change to a directory where you can store some files (for example, /root if you feel you might need those files later or /tmp if you don't think so). Use the fetch utility to download the module:

fetch -v https://pkg.opnsense.org/FreeBSD:12:amd64/snapshots/latest/All/realtek-re-kmod-196.04.txz

Then, install the module you just downloaded:

pkg install -f -y realtek-re-kmod-196.04.txz

Finally, enable this module. To do that, open the local bootloader configuration file for editing (it may not exist on your system, so don't worry if the file is empty when you first open it):

vi /boot/loader.conf.local

Add two lines to the end of the file:

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

Save and exit (Esc, then :x), then reboot the router. Once it reboots, log in again and check your handiwork:

kldstat

If everything went well, the output will include the name of the driver, if_re.ko. For example:

[2.6.0-RELEASE][admin@pfSense.home.arpa]/root: kldstat
Id Refs Address                Size Name
 1   16 0xffffffff80200000  3aed878 kernel
 2    1 0xffffffff83cee000    d01c0 if_re.ko
 3    1 0xffffffff83dbf000   39adb0 zfs.ko
 4    2 0xffffffff8415a000     9860 opensolaris.ko
 5    1 0xffffffff84321000     1000 cpuctl.ko
 6    1 0xffffffff84322000      bf8 coretemp.ko

When we did this upgrade on a brand-new super-compact two-port router (a repurposed Shuttle mini PC), our LAN-to-WAN throughput went from dubious 720-or-so Mbps to values consistent with the Gigabit moniker:

iperf3_re

Not a bad way to spend a few minutes... :)

A few months later (September 2023)

We did a clean install of pfSense 2.7 on the same device and tested it on the same rig. Out of the box, iperf3 showed 920 Mbit/s. So it appears that pfSense has caught up with OPNsense in terms of the currency of Realtek NIC drivers...

Previous Post Next Post