Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kmarf/960f3a00690756f978882607dec94179 to your computer and use it in GitHub Desktop.
Save kmarf/960f3a00690756f978882607dec94179 to your computer and use it in GitHub Desktop.
compile realtek network driver for pfsense 2.4.x

How to compile and install latest realtek network driver in pfSense 2.4.5-RELEASE-p1 (FreeBSD 11.3)

  1. Download FreeBSD 11.3 VMDK and create a VM with it as HDD.

  2. Get FreeBSD source tree for your exact FreeBSD version and uncompress it to /usr/src:

    fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz
    tar -C / -xvf /tmp/src.txz
    
  3. Download latest Realtek network driver (you need to input any email address - a fake one will do!).

  4. Uncompress driver:

    tar xvzf rtl_bsd_drv_v196.04.tgz
    
  5. Make driver:

    cd rtl_bsd_drv_v196.04
    make
    
    1. If the last command fails, change the following line in file if_re.c

      From: #include <dev/re/if_rereg.h>

      To: #include "if_rereg.h"

  6. Copy the file if_re.ko to the /boot/kernel folder in pfSense device.

    scp if_re.ko root@<pfSense device IP>:/boot/kernel

  7. Change file permissions in if_re.ko file accessing through SSH to pfSense.

    chmod 555 /boot/kernel/if_re.ko

  8. Modify /boot/loader.conf.local file and add the following line at the end of the file: if_re_load="YES"

    • Through console: vi /boot/loader.conf.local
    • Through web: Diagnostics > Edit File and click Load. When finished editing click Save.
  9. Reboot pfSense.

  10. After restart, verify if module is installed through ssh with kldstat. Example execution:

    [2.4.5-RELEASE-p1][root@pfSense.local]/root: kldstat
        Id Refs Address            Size     Name
         1   10 0xffffffff80200000 37191d8  kernel
         2    1 0xffffffff8391b000 d10a0    if_re.ko
         3    1 0xffffffff85bb5000 10c0     cpuctl.ko
         4    1 0xffffffff85bb7000 7028     aesni.ko
         5    1 0xffffffff85bbf000 c80      coretemp.ko
    

Based on:

@kmarf
Copy link
Author

kmarf commented Aug 27, 2020

@kmarf
Copy link
Author

kmarf commented Aug 27, 2020

If driver loaded correctly system log (in web GUI under Status / System Logs / System / General) should include a line like this with the driver version number included:

re0: version:1.96.04

@kmarf
Copy link
Author

kmarf commented Apr 22, 2021

Copy of original Realtek BSD driver source link : https://drive.google.com/file/d/1rMRo3fM9U-bSHLtpuGsbDY8oao00DSac/view?usp=sharing

NOTE: This seems no longer available from the vendor (at last check I got 404 errors)

Apparently can be compiled using FreeBSD 12.2-STABLE version for pfSense 2.5.x (but I have not tested personally).

@kmarf
Copy link
Author

kmarf commented Apr 22, 2021

Some more useful links :
https://ostechnix.com/how-to-enable-ssh-on-freebsd/
(this makes it easy to forward port 22 - need to enable as root BUT make sure VM has enough disk space!)
and
Backup of source code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment