TechSomething

pfsense: install correct realtek driver

Scope: #

I have pfsense installed on a pc with realtek NICs,
pfsense does not include the driver for those NICs,
Realtek NICs are unusable without the correct drivers.

Captain Hindsight says: #

"you should have bought an hardware with Intel NICs"

Problems encountered: #

My WAN interface disconnected when dealing with moderate/high traffic,
like a speedtest.

Solution: #

install the realtek drivers

Which version am I running?: #

to understand which version of freebsd you are running look at pfsense homepage under "System Information" --> "Version":

Version	2.6.0-RELEASE (amd64)
built on Mon Jan 31 19:57:53 UTC 2022
FreeBSD 12.3-STABLE

we are running "FreeBSD 12.3-STABLE"

Download the correct realtek driver: #

the download link for our version is:
http://pkg.freebsd.org/FreeBSD:12:amd64/release_3/All/realtek-re-kmod-v196.04_3.pkg

but how to retrieve it?

look at the link: "FreeBSD:12:amd64/release_3" means 12.3
"release 3" is our "3"

you can find the correct package version in the correct release repo following this:

  1. go in the main package download repo: https://pkg.freebsd.org
  2. select your arch/version: FreeBSD:12:amd64
    (full link: https://pkg.freebsd.org/FreeBSD:12:amd64/)
  3. select your specific release: release_3
    (full link: https://pkg.freebsd.org/FreeBSD:12:amd64/release_3/)
  4. since we cannot freely browse /All path, you'll need to download the packagesite.txz and look in the packagesite.yaml for our realtek package by searching "realtek",
    or you can use this oneliner:
    wget -q -O - https://pkg.freebsd.org/FreeBSD:12:amd64/release_3/packagesite.txz | tar --to-stdout -Jxf - packagesite.yaml | grep realtek | yq -r '.path'
    that will output the package path, relative to your position:
    "All/realtek-re-kmod-v196.04_3.pkg"
  5. at this point you can combine the two paths:
    "https://pkg.freebsd.org/FreeBSD:12:amd64/release_3/" + "All/realtek-re-kmod-v196.04_3.pkg"
  6. finally the complete path: https://pkg.freebsd.org/FreeBSD:12:amd64/release_3/All/realtek-re-kmod-v196.04_3.pkg

Install the driver: #

install the package:

fetch -v http://pkg.freebsd.org/FreeBSD:12:amd64/release_3/All/realtek-re-kmod-v196.04_3.pkg
pkg install realtek-re-kmod-198.00_1.pkg

add the correct lines to load the module on boot,
I've added them to /boot/loader.conf but I've ween suggestions to add the lines to /boot/loader.conf.local

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

and then reboot to be safe,
or manually load the module (see Bonus --> Manually load modules) /boot/modules/if_re.ko

Pfsense advanced config: #

in the past I had problems with Hardware Checksum Offload, so I've disabled it:

in PFsense go to: System/Advanced/Networking

and then check "Disable hardware checksum offload"

then reboot

after doing this my system was stable

Bonus: #

Check loaded modules: #

kldstat

and you have to see "if_re.ko":

Id Refs Address                Size Name
4 1 0xffffffffxxxxxxxx xxxxxx if_re.ko

Manually load modules: #

kldload module_name.ko

List installed packages: #

pkg info

Remove package: #

pkg remove package_name_version

sources: #