Solved How to install Realtek driver with no internet connection

I am moving my existing Freebsd install to another system to upgrade CPU. However, the network interface on the new motherboard is not visible and therefore I can't connect to the internet. It is a Realtek network interface.

What is the best way to install the realtek network driver with no internet connection?

I've tried to download the package directly from https://pkg.freebsd.org/FreeBSD:13:amd64/quarterly/All/realtek-re-kmod-v196.04_2.txz
but it seems to not be available anymore.

Also, I have downloaded the file from the Realtek site, but I'm not sure how to install the driver.

Thanks.
 
Based on what I've read here in the past, I suggest you stick with the version in the FreeBSD ports collection rather than using the version from the Realtek site. As Andriy suggests, you can use pkg fetch to download it with your already-existing FreeBSD install. You should also download the current version of pkg so you can pkg-add(8) it on the new install.
Code:
len@mate:~ $ su -
Password:
root@mate:~ # pkg search realtek
realtek-re-kmod-v196.04_3      Kernel driver for Realtek PCIe Ethernet Controllers
root@mate:~ # mkdir pkgtmp
root@mate:~ # pkg fetch -d -o pkgtmp realtek-re-kmod-v196.04_3
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following packages will be fetched:

New packages to be FETCHED:
    realtek-re-kmod: v196.04_3 (103 KiB: 100.00% of the 103 KiB to download)

Number of packages to be fetched: 1

103 KiB to be downloaded.

Proceed with fetching packages? [y/N]: y
Fetching realtek-re-kmod-v196.04_3.pkg: 100%  103 KiB 105.5kB/s    00:01    
root@mate:~ # pkg fetch -d -o pkgtmp pkg
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following packages will be fetched:

New packages to be FETCHED:
    pkg: 1.17.5 (8 MiB: 100.00% of the 8 MiB to download)

Number of packages to be fetched: 1

The process will require 8 MiB more space.
8 MiB to be downloaded.

Proceed with fetching packages? [y/N]: y
Fetching pkg-1.17.5.pkg: 100%    8 MiB   4.4MB/s    00:02    
root@mate:~ # ls pkgtmp/All
pkg-1.17.5.pkg            realtek-re-kmod-v196.04_3.pkg
root@mate:~ #

Please check out the following thread if you need more information:
Thread realtek-rtl-8125-2-5gbps-lan-controller.79710
 
You used to be able to 'browse' the repositories but they disabled that. So now you have to 'guess' the exact version of a package before you can fetch it (if you're doing this on Windows machine for example). It helps to check http://freshports.org, it usually has up to date information about versions in the various repositories.

You need at least two packages, one for ports-mgmt/pkg itself and the other for the module you need (net/realtek-re-kmod in this case). Copy those to a USB stick (use a FAT32 formatted stick for this if you use a Windows or Mac to download the files). Plug the stick in the network-less FreeBSD machine to copy them there.

Extract the package for ports-mgmt/pkg, don't worry about the weird extension, it'll decompress using tar(1). In that extracted pkg(8) package archive you will find a pkg-static executable, use that to 'install' the pkg(8) package. This is a bit of a chicken and egg problem, you need pkg(8) to install pkg(8). It's normally done through the 'bootstrap' of pkg(7), but you can't use that right now because you don't have network connection yet. Once that's done you can use pkg-add(8) to install the module you copied to the USB stick.
 
FWIW, that port also resolved an issue with a different Realtek Ethernet not being recognized.

FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64 as installed from the memstick

Code:
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0xf000-0xf0ff mem 0xfce08000-0xfce08fff,0xfce00000-0xfce03fff at device 0.1 on pci2
re0: Using 1 MSI-X message
re0: ASPM disabled
re0: Chip rev. 0x54800000
re0: MAC rev. 0x00200000
re0: Unknown H/W revision: 0x54800000
device_attach: re0 attach returned 6

After installing realtek-re-kmod-198.00_1

Code:
re0: <Realtek PCIe GbE Family Controller> port 0xf000-0xf0ff mem 0xfce08000-0xfce08fff,0xfce00000-0xfce03fff at device 0.1 on pci2
re0: Using Memory Mapping!
re0: Using 1 MSI-X message
re0: ASPM disabled
re0: version:1.98.00
re0: Ethernet address: 90:2e:16:aa:bb:cc

This product is covered by one or more of the following patents:           
US6,570,884, US6,115,776, and US6,327,625.
re0: Ethernet address: 90:2e:16:aa:bb:cc
 
Back
Top