Press "Enter" to skip to content

FreeNAS on Odroid H2+ – RTL8125B driver installation

I wanted to try FreeNAS on my Odroid H2+ NAS system, unfortunately the driver for the Realtek RTL8125B was missing on the FreeBSD OS which is used currently used by FreeNAS.

After reading some post which say something like “There is no way in hell there will be a driver for the RTL8125 unless a big company needs it…”, I came across the following forum topics which pointed me to the actual driver supplied by Realtek.

https://www.xigmanas.com/forums/viewtopic.php?t=15326
https://forum.netgate.com/topic/135850/official-realtek-driver-binary-1-95-for-2-4-4-release/8

Actually I didn’t expected Realtek to provide drivers for FreeBSD but it is available as source for download at:

https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software

Compiling the driver

Hint: I also provide the binaries for FreeNAS/FreeBSD 11.3. If you don’t want to compile the driver, you can download the binaries and just install it.

As a first attempt I tried to compile the driver directly on my FreeNAS installation. Unfortunately it looks like FreeNAS comes without a build system. As this is my first contact with FreeBSD, I decided to compile the driver on a virtual machine using a fresh FreeBSD 11.3 installation.

You can get the ISO image at https://download.freebsd.org/ftp/releases/ISO-IMAGES/11.3/FreeBSD-11.3-RELEASE-amd64-dvd1.iso and install it on e.g. a new VitualBox.

During the installation process you should select to install the “System source tree” in order to be able to compile the system and the driver. If you forgot this step you might consider this blog post: https://www.jan0sch.de/post/install-freebsd-sources/. There is nothing else to worry about during the installation. Just follow the process.

The required steps to build the driver are described in the drivers readme.txt. I will describe the steps again as there are some slight changes necessary.

First of all you might want to backup the original files

cp /usr/src/sys/dev/re/if_re.c /usr/src/sys/dev/re/if_re.c.org
cp /usr/src/sys/modules/Makefile /usr/src/sys/modules/Makefile.org
cp /usr/src/sys/modules/re/Makefile /usr/src/sys/modules/re/Makefile.org
cp /usr/src/sys/amd64/conf/GENERIC /usr/src/sys/amd64/conf/GENERIC.org

Now we remove the driver as part of the kernel build. Remove the following lines from /usr/src/sys/amd64/conf/GENERIC respectively /usr/src/sys/modules/Makefile. I used vi for this. If you’re not familiar with vi some hints:
dd –> delete line
:wq –> save and exit
:q! –> exit without saving (if you messed up 🙂

vi /usr/src/sys/amd64/conf/GENERIC
delete line -->  device              re

vi /usr/src/sys/modules/Makefile
delete line -->  re \

Now the fun part. First we set the build config, then we start the build process. You might consider to get some coffee, this might take a while. After the build we make a reboot.

cd /usr/src/sys/amd64/conf
/usr/sbin/config GENERIC
cd ../compile/GENERIC

make cleandepend
make depend
make
make install
reboot

Now we have the environment to build our driver as a kernel module. First we download the sources from Realtek (or use the link on my webspace). Then we unpack the files to the home dir.

cd ~
fetch http://www.embedded-ideas.de/files/rtl_bsd_drv_v196.04.tgz
tar -zxvf rtl_bsd_drv_v196.04.tgz

Now we copy the files to the right folders…

cd rtl_bsd_drv_v196.04
cp if_re* /usr/src/sys/dev/re/
cp Makefile /usr/src/sys/modules/re/

…and build them.

cd /usr/src/sys/modules/re
make clean
make

Thats it. Copy the if_re.ko onto a USB drive and continue with the installation on FreeNAS.

Update 16.08.20: The build system changed a bit on FreeBSD 12.1. You will find the binaries at /usr/obj/usr/src/amd64.amd64/sys/modules/re. If in doubt, use find / | grep if_re.ko to find the module.

Installing the RTL8125 driver on FreeNAS

As you might not have a working network connection you might consider to copy the driver to a USB stick. If you didn’t wanted to compile it yourself, you can download the binary here :

https://www.embedded-ideas.de/files/if_re-amd64-FreeBSD_11_3.ko

Update 16.08.20: Binaries for TrueNAS 12 BETA 2 (FreeBSD12.1) untested on my target machine but loadable on a virtual machine: https://www.embedded-ideas.de/files/if_re-amd64-FreeBSD_12_1.ko

Please make sure to safe the file on the USB stick as if_re.ko.

On the FreeNAS shell we first have to mount the USB stick. The example expects a FAT32 stick.

mkdir /mnt/usbstick
mount -t msdosfs /dev/da0s1 /mnt/usbstick

Now we have to copy the driver and change the file permissions.

cd /boot/kernel
cp /mnt/usbstick/if_re.ko ./
chown root:wheel if_re.ko
chmod 0555 if_re.ko

In order to load the module on startup we have to add the following line to /boot/loader.conf

vi /boot/loader.conf
add line --> if_re_load="YES"

Again a hint if you are not familiar with vi:
i –> change to insert mode
ESC –> leave the insert mode
:wq –> save and exit
:q! –> exit without saving

The driver should be loaded after a reboot. You can check this with

kldstat

if_re.ko should appear in the list. And the network interfaces should be available on FreeNAS.

43 Comments

  1. szeph
    szeph 15. August 2020

    Ich habe die Anleitung mit TrueNAS 12 Beta 2 versucht. Hat leider nicht funktioniert. Habe zum Kernel-Compilieren extra ein FreeBSD 12.x aufgesetzt (VM).

    • Tobi
      Tobi 15. August 2020

      What version of FreeBSD did you use exactly? If you try to compile for TrueNAS 12.0 you have to use the exact FreeBSD version which is used by TrueNAS 12.0 (I’d expect FreeBSD 12.0). You can check it by utilizing the freebsd-version command

  2. szeph
    szeph 16. August 2020

    i wanted to try truenas core because it is based on the current ZFS. So you should be able to replace the OS with another OS without any problems.
    Since I currently have only one emmc (64GB) in the Odroid H2+, this might not be such a good idea.

    In the Linux kernel you can integrate the driver via DKMS. I find this actually quite elegant, since it should survive kernel updates.

    Had OMV5 running.

    • Tobi
      Tobi 16. August 2020

      It would also be possible to integrate the driver into the FreeBSD kernel. Unfortunately I’m not so much into FreeBSD development and didn’t had the time to figure out how to commit changes to the the FreeBSD kernel. But actually this would be the right thing to do. Maybe I will give it a try someday.
      For your test I compiled the driver for TrueNAS 12 BETA 2 and uploaded the module. You will find the link in the install section above.Let me know if it works.

  3. szeph
    szeph 16. August 2020

    Thank you very much. I just finished the OMV5 installation after spending a lot of time with experiments. So I will probably not try TrueNas Core that soon. Tomorrow I have to work again … so unfortunately I probably do not find the time to try it out now.
    But I might order a cheap NVME SSD and try it later.
    By the way, I had used FreeBSD 12.1 for compiling.

    Note:
    – Realtek RTL8156 (Club 3D Adapter, RJ-45, USB-A 3.0) => works with more recent Linux kernel out-of-the box. I used it for the installation of OMV5 until I got the driver installed via DKMS. Maybe it also works in the FreeBSD kernel OOTB?
    – DKMS: https://de.wikipedia.org/wiki/Dynamic_Kernel_Module_Support

    Currently I am using OMV5 (Proxmox-Kernel + ZFS). See how it goes.

    • Tobi
      Tobi 29. August 2020

      I tested with iperf3 for one hour in both directions. I get good speeds (for my 1Gbit setup) and it doesn’t look like there is any loss to worry about.

      0.00-3600.00 sec 392 GBytes 934 Mbits/sec 1 sender
      0.00-3600.00 sec 392 GBytes 935 Mbits/sec receiver

      It would be great if someone with 2.5Gbit hardware could do some testing. Maybe the problem only exists when the NICs are used at higher speeds.

    • Tobi
      Tobi 29. August 2020

      I got a system with two Seagate IronWolf and an additional NVMe. With a cheap meter I get

      21W on IDLE
      11W on IDLE (with spindown)
      25W with some load (iperf test 1 NIC / 1GBit)

      It might also depend on the power supply. Mine is a Kensington universal notebook supply @ 16V.

      • Anonymous
        Anonymous 29. August 2020

        11W with spindown sounds like quite a lot for the device. It would be more likely to expect values around 5W. Either the current meter is not good and shows wrong values or the reason is FreeBSD (or both). I think under FreeBSD you can’t use the power saving mechanisms as good as under Linux and there is no PowerTop. This is probably still the case.
        Maybe it is better with TrueNas Core 12 (more recent FreeBSD)?

        Translated with http://www.DeepL.com/Translator (free version)

  4. Anonymous
    Anonymous 29. August 2020

    Update 16.08.20: Binaries for TrueNAS 12 BETA 2 (FreeBSD12.1) untested on my target machine but loadable on a virtual machine: https://www.embedded-ideas.de/files/if_re-amd64-FreeBSD_12_1.ko

    => I can confirm that driver is working. TrueNAS-12.0-BETA2.1

    Unfortunately, the power consumption seems to be higher for me too.
    I estimate 5 to 10 watts more than under Linux.
    But I also just booted and haven’t done anything.

    • Tobi
      Tobi 30. August 2020

      Thank you for testing. Good to know that the binaries are working in real life 🙂

  5. Anonymous
    Anonymous 29. August 2020

    Short impression:
    – Power consumption seems to be about 5 watts higher with two hard drives than with OMV5. Maybe there is still room for improvement. I think that FreeBSD has a disadvantage here.
    I did not look at IDLE yet, because I do not know how to put the disks to sleep (there is a plugin).
    – The most important thing: NIC-problems do not exist as they do under Linux. So the driver seems to be much better at the moment.
    The 1GBe connection via Samba was OK in a quick test, although not perfect. Here I had huge problems under Linux (about 50 MB/s download and only about 17 MB/s upload).
    I tested 2.5 GbE only very briefly. I have a USB dongle (but it seems to have some bugs).

    => Will probably stay with TrueNAS for now. First impression is very good. Stupid about the power consumption. But that is still OK.
    I’ll probably order a NVMe SSD now and install TrueNAS correctly.
    Any suggestions?

    • Tobi
      Tobi 30. August 2020

      If you want to spin down the HDDs you need the additional NVMe. There is a log which is used frequently and would wake up your drives (see System–>System Dataset). You also need to configure the S.M.A.R.T. service to not wakeup the drives if they are spun down (Services–>SMART–>Edit–>Power Mode: Standby).

      Let me know if get any progress on the power consumption. I should do some measurements directly on the DC input. My power supply doesn’t seem to be very effective when it comes to low power delivery. Maybe there are some watts to save with a better supply.

  6. Anonymous
    Anonymous 30. August 2020

    sysctl dev.cpu | grep cx
    dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
    dev.cpu.3.cx_usage_counters: 7692 13363 82292
    dev.cpu.3.cx_usage: 7.44% 12.93% 79.62% last 2113us
    dev.cpu.3.cx_lowest: C8
    dev.cpu.3.cx_supported: C1/1/1 C2/2/50 C3/3/150
    dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
    dev.cpu.2.cx_usage_counters: 5120 12627 80705
    dev.cpu.2.cx_usage: 5.20% 12.82% 81.97% last 4273us
    dev.cpu.2.cx_lowest: C8
    dev.cpu.2.cx_supported: C1/1/1 C2/2/50 C3/3/150
    dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc
    dev.cpu.1.cx_usage_counters: 4818 11464 80208
    dev.cpu.1.cx_usage: 4.99% 11.88% 83.12% last 2729us
    dev.cpu.1.cx_lowest: C8

    => as far as I understand c8 is being used. that should be fine.

    kldload cpufreq
    kldload: can’t load cpufreq: No such file or directory
    => is this normal? Or do we have an option to tune the power consumption?

    System => advanced => Enable Autotune
    => I have the impression that it helped. When I had just looked, the consumption was relatively constant at 20W.

    —-
    powerd => I don’t understand it. Is it active? Is there some potential?

    —-
    UEFI-Settings: I didn’t check the settings. I will do it later on.


    Emby server is running fine.

    Overall I like the system.

    I am not familiar with FreeBSD

  7. Anonymous
    Anonymous 30. August 2020

    “(Services–>SMART–>Edit–>Power Mode: Standby).”
    => in TrueNAS Core 12 I don’t find this option.

    Yesterday I tested the transfer speed via SMB with some Movie-Data (MP4).

    1 GBe connection: Around 90 MB/s
    AsRock Deskmini (Fedora) Netgear MS510TX Odroid H2+
    Not perfect but “OK”.

    2.5 GBe: Around 120 oder 130 MB/s
    => Not so great. Maybe the USB 2.5 GBe Dongle is not the best. I have read that RTL8156 has also some problems.
    AsRock Deskmini (Fedora) with USB-Dongle (https://www.heise.de/preisvergleich/club-3d-adapter-cac-1420-a2074937.html) Netgear MS510TX Odroid H2

    If you buy a USB dongle, then you should buy the successor: RTL8156b
    But then you probably have the driver problem again.

    The driver is probably not yet perfect either. But at least for me it is much better than the current Linux driver.

    Since Linux and TrueNAS use the same ZFS, the OS can easily be swapped. This worked without any problems yesterday.
    If the situation changes, I can easily switch back to Linux if I want to.

    Which NVMe SSD are you using? I will buy one. you could also install Linux beside TrueNAS… .

    • Tobi
      Tobi 30. August 2020

      Good to know it is possible to switch between OMV and TrueNAS. There is a list with my system setup in the 3D printed case post at Dual 3.5″ HDD NAS Case for Odroid H2 / H2+ . I got some problems with the mentioned Kingston A2000. The first one died after some hours. I got it replaced. The new one runs without any problems but I have have some trust issues 😉

  8. Anonymous
    Anonymous 30. August 2020

    Thanks.
    I also wanted to buy the SSD. I guess I’ll take another one now. Probably a Samsung.

    Since you are still using FreeNAS 11.x, you probably won’t be able to simply change the OS. Therefore I have taken TrueNAS Core 12 directly.
    You will probably have to convert the ZFS pool to the current ZFS version first. There is probably a migration path.
    FreeBSD 12.1 or TrueNAS now uses the same ZFS as Linux.

  9. Anonymous
    Anonymous 4. September 2020

    Thank you, your nic driver loading instruction worked perfect on TrueNAS core 12.0-BETA2.1

    • Tobi
      Tobi 4. September 2020

      Thank you for the feedback.

  10. Anonymous
    Anonymous 6. September 2020

    – I have bought and installed the Kingston A2000 SSD after all. So far the SSD runs without problems. Apart from that I have two hard disks, which run in ZFS_Mirror. I have deactivated the eMMC in UEFI.
    – System => System Dataset => Configure System Dataset ===> boot-pool
    – Plugins and Jails: Installed on the ZFS_Mirror. This is the intended way in the GUI. In the forum I found a thread that you could put it manually on the SSD. This is not offered in the GUI yet.
    – ACL: I don’t use it yet.
    (*) – LAN driver – Realtek: I think it works quite well for 1GBe. The transfer speed also depends on the file size.
    At 2.5 GBe I have the impression that the driver doesn’t work that well yet. But it could also be because of the USB dongle, which I use sometimes on the other side.
    => We should look in intervals whether there is a new driver.
    – Mid September the RC1 of TrueNAS Core will be released. I think you can use it as a home user without any problems. The current beta seems to run well.
    (*) – System => Advanced => Enable Autotune
    This can reduce the power consumption somewhat. But I deactivated it again, because I think this could be the reason for a stability problem.
    => (*) I could observe several times that when transferring some 100 GB of files the share was gone after a certain point. The share was no longer responsive. Also I could not access the Odroid H2+ anymore.
    I looked at some log files but couldn’t find the cause. I am not a FreeBSD expert.
    But after I deactivated “Enable Autotune” and deleted all tunables, this problem didn’t occur anymore. I guess that was the reason.
    With the autotunes you can optimize some things but apparently you can also break them.
    – PowerManagement Disks: Currently I use level 128 (no spindown). With spindown you can still save power. The opinions about this differ. I think it depends on the usage profile.
    – Power consumption: I cannot say if there are differences between FreeBSD 11.x and 12.x (C-States). Power consumption seems to be only slightly higher than under Linux, depending on the settings. Of course you have to compare with comparable settings. If you use Spindown on the Linux system and not under TrueNAS, it is clear that the TrueNAS system consumes more.
    TrueNAS is by nature more designed to run continuously. OMV, on the other hand, I think is more focused on the home user.
    – Plugin: Currently I only use Emby. So far I have only set up Emby in a rudimentary way. There is also Plex. I have given Emby the preference. Main reason: Plex seems to be much better from a privacy point of view. It works also without registration.

    One more hint:
    This post was helpful:

    What is the output of the following commands on your system:

    – freebsd-version
    – ls -la /boot/kernel | grep if_re
    – kldstat | grep if_re
    – cat /boot/loader.conf | grep if_re

    https://forum.odroid.com/viewtopic.php?f=170&p=303035

    • Tobi
      Tobi 6. September 2020

      Thank you for the information. I didn’t had time to do any more work on the NAS but I think I will try the power settings on my system. I started the mentioned thread. Good to know that it is helpful.

      • Anonymous
        Anonymous 6. September 2020

        kldload /boot/kernel/if_re.ko

        => I needed to load the modual manually too.

        “I didn’t had time to do any more work on the NAS but I think I will try the power settings on my system.”

        Thank you.

        I would be happy if you could do this with TrueNAS Core 12. Then we have a common basis. There are probably differences between FreeNAS 11 and TrueNAS Core 12.

        The RC of TrueNAS is coming out soon. And the final is not far away either.

        Maybe you can then write down your experiences (also SpinDown).

        I am using this:
        TS 45-25111 Energiekostenmessgerät, digital
        https://www.reichelt.de/energiekostenmessgeraet-digital-ts-45-25111-p155326.html?utm_source=psuma&utm_medium=idealo.de&PROVID=2378&&r=1

  11. MoròSwitie
    MoròSwitie 21. September 2020

    Thanks for the updated binaries.

    Tested the binaries on TrueNAS Core 12 RC1 (FreeBSD 12.2-PRERELEASE). It is working like a charm.

  12. Mark Pro
    Mark Pro 5. October 2020

    FreeNAS -11.3-U5
    Using if_re-amd64-FreeBSD_11_3.ko (renamed to if_re.ko)
    Driver is loaded on reboot
    2.5Gbe USB network device not showing in interfaces
    Hardware ID VID_0BDA&PID_8156 (which is RealTek 8156)

    Any ideas?

  13. Mark Pro
    Mark Pro 12. October 2020

    Read/write around 295MB/sec from FreeNAS (pci–e card) to Windows 10 (USB dongle).
    Initially server read speeds were hovering around 50MB/sec until I enabled Jumbo Frames (MTU=9000 on FreeNAS; Jumbo Frames=9014 on Win10).
    Directly connected over approx 20m run Cat6.

    Simply Excellent!
    Thanks again!!!

  14. Anonymous
    Anonymous 6. December 2020

    Yes man, great manual even for a linux/freebsd newbie like me!
    Saved me a bunch of time and money!

    Thanks a lot!

  15. Fanlabiz
    Fanlabiz 20. December 2020

    Thank you Tobi for this post.
    Worked perfect for me on FreeBSD11.3, but not on the first time however…
    Not on the second neither (full make after setting up a full FreeBSD).

    PLEASE ADD AN SLIGHT BUT IMPORTANT UPDATE TO DO TO YOUR POST:
    Please change add line –> if_re_load=“YES” to add line –> if_re_load=”YES”.
    WTF? The double quotes are not the ones Linux expects !!!
    So if you copy-paste, driver load simply does not happen!
    I think many guys will be happy if you update your post with this 2 char change.
    Merry Christmas and happy new year (whatever 2021 will be….)

    • Tobi
      Tobi 21. December 2020

      It seems like this is a “feature” of WordPress called “Smart-Quote”. Actually it corrected your comment as well. I disabled the “feature” and it should work now. Maybe it would be a good idea to get back to plain HTML. There is to much bullshit in wordpress. Happy xmas to you as well. Hopes are high for 2021 😉

      • Anonymous
        Anonymous 18. January 2021

        I’ve compiled them from FreeBSD 12.0, while the one in the article is compiled from FreeBSD12.1.

    • Anonymous
      Anonymous 5. May 2021

      Thanks for your driver, It works under truenas 12.0U3 which shows it as 1000baseT only.
      Is it works as 2.5g under freenas ?

  16. Anonymous
    Anonymous 19. February 2021

    Is the link above just for AMD – is there a separate intel one?

    • Tobi
      Tobi 19. February 2021

      The architecture is called amd64 because AMD was first with the 64bit CPUs for the PC market. It can be used for Intel as well.

  17. Alex
    Alex 9. May 2021

    whoever created this and made this tutorial, thank you. i purchased a 2.5gb nic off ebay not realizing it had this chip which is unsupported, but your tutorial worked perfectly..

  18. Patrick
    Patrick 2. June 2021

    Hey Tobi,

    I wanted to say thank you, as I was able to run my home NAS on my Odroid H2+ for over half a year thanks to your Howto!

    But there’s big news! iXSystems has released Truenas 12.0-U4, which now includes the Realtek driver, so you don’t have to copy it manually to the boot partition.

    Unfortunately, it does not completely run by default, as the module was not automatically loaded. For this I first re-added the `if_re_load=”YES”` line in `/boot/loader.conf`, but I then realised, that this could be achieved also via Tunables configuration in the web interface:
    https://imgur.com/a/IIrwYtU

    I was not able to verify this yet, but do hope, that this finally is proof to further updates. Yeah!

    • Tobi
      Tobi 2. June 2021

      Thanks for the feedback and for sharing the information.

  19. Barry Chen
    Barry Chen 3. July 2021

    Thanks a lot man! That really did help me…
    I thought I had to change another NIC cuz I got the wrong one lol

  20. Anonymous
    Anonymous 30. July 2021

    I am not convinced of the Realtek NIK so far. Now and then it happens that the NIK is gone and I have to restart the Odroid.
    Has anyone of you ever copied x-gigabyte-sized files to the Odroid, like a Final Cut Pro X library? I canceled that after it was super slow.
    Maybe I’ll try the driver that comes with TrueNAS.

  21. Synctrex
    Synctrex 2. September 2021

    Hey thanks for this! Got it up and running on my truenas system with a ASUS B550 Plus TUF motherboard. Works great!

Comments are closed.