# How can I get a Realtek driver for FreeBSD?



## SatanBSD (Jan 29, 2018)

I have the RTL8723BE wireless chipset for my laptop. However, only an Ethernet interface (re0) was detected during installation, and my chip set is not supported for wifi use by FreeBSD.

I found this: https://github.com/rtlwifi-linux/rtlwifi-next/tree/master/rtl8723be

But I am not sure how to use it with FreeBSD. How can I install a driver to FreeBSD in order to support my chip set for wireless internet? Thanks!


----------



## SirDice (Jan 29, 2018)

That's a Linux driver, you cannot install Linux drivers on FreeBSD.


----------



## SatanBSD (Jan 29, 2018)

SirDice said:


> That's a Linux driver, you cannot install Linux drivers on FreeBSD.



Well that is good to know. Thank you, sir!

But since FreeBSD does not support my RTL8723BE wireless chipset, am I shit out of luck, or is there some technical stuff I could do to make FreeBSD detect and use my device?


----------



## tingo (Jan 29, 2018)

The (only) technical stuff that will work is to either improve existing FreeBSD drivers to support your device, or to write a FreeBSD driver for your device. But this is real work; it takes knowledge and time.
Sorry, there are no magical formulas in the real world.

If you are pragmatic and have the money, you can always buy a usb wireless dongle that is supported by a FreeBSD driver. Using `apropos wireless` will tell you about the man pages with the word "wireless" in them. If you read the man pages for wireless drivers, you will find out which chipsets are supported. Now your quest is reduced to finding a usb wireless dongle which states the chipset used. Good luck!


----------



## ralphbsz (Jan 30, 2018)

In theory, you could run both Linux and FreeBSD simultaneously on your laptop (using virtual machines), use Linux just for connecting to the network and bridging to the other OS, and then use FreeBSD as your normal operating system.  Sounds like a crazy hack, and lots of work: (probably an hour or two for someone who has experience setting up VMs, way more for someone who's never done it before.  Just for one wireless chip that's out of line; getting a USB wireless device seems more practical.


----------



## doa379 (Sep 5, 2020)

It's possible to forward network traffic from a host to a VM running on that host using NAT.
Curious, is there a way to bridge or forward network traffic from a VM running on the host to the host itself?


----------



## tingo (Sep 5, 2020)

Yes, it is possible. The exact solution will depend on the operating system run on the vm. Here is one (rather long) thread that describes one such solution https://forums.freebsd.org/threads/use-a-virtual-network-interface-on-a-host.76420/


----------



## kpedersen (Sep 5, 2020)

Would NDISulator be an option?









						Chapter 13. Configuration and Tuning
					

This chapter explains much of the FreeBSD configuration process, including some of the parameters which can be set to tune a FreeBSD system.




					www.freebsd.org
				




Check out the section:
_*11.5.1.1. Using Windows® NDIS Drivers*_


----------



## shepper (Sep 5, 2020)

That is a fairly new chip and NDISulator is based on Windows XP drivers.  Did not specifically look but I'm cynical that there will be a Windows XP driver for this chip.

Another option is to replace the card with one that is supported.  I replaced an realtek wifi card on an HP Stream 14 but it was a bit of a chore to pry the case open.  Depending on the make/model of your laptop, this can be easier or harder.  The other thing to investigate is if the BIOS has a vendor whitelist.  My HP Stream did but it was easy to get an intel card that had been pulled from an HP laptop and was listed as supported.


----------



## vladd110 (Sep 6, 2020)

I've also replaced that 8723 chip with Intel dual band chip. I think it is the easiest way to make things work.


----------



## kpedersen (Sep 6, 2020)

If you do go the wifi dongle route and don't know which one to buy, remember that the popularity of the Raspberry Pi means that loads of these online shops now provide pretty compatible hardware (originally intended for Raspbian Linux).


----------



## wb7odyfred (Oct 8, 2020)

Edimax EW-7811un Version 1 USB nano dongle works with rtwn driver.  Uses the RealTek RTL8192cu chipset USB Vendor/Product Ids  7392:7811.  Edimax EW-7811un Version2  uses the RTL8188EU RealTek chipset USB Vendor/Product Ids  7392:b811
Reference these 2 GhostBSD forum posts, that I wrote to manually get a driver installed and working with GhostBSD to have Wifi operational.   I share some brief FreeBSD commands below, yet read the 2 posts referenced below for greater details and explanation

GhostBSD uses the same terminal (CLI) commands as FreeBSD.  Find what devices are connected on the PCI bus and the USB bus with the following terminal commands.  See if your Wi-Fi device is listed there in the output from the following commands.
You need to know your installed networking hardware and installed kernel modules and your version and revision of freebsd.
`uname -a` or `uname -k` command and look for the revision number like r310386 and the Kernel version  FreeBSD 12.0-CURRENT #1  The separate usb and pci drivers were combined into one rtwn driver module, with 2 interface kernel modules if_rtwn_usb.ko & if_rtwn_pci.ko  after Release r310386 ( Verify  Release number )

Then check the PCI bus devices and  the USB bus devices to see what you have for WiFi hardware in your computer.
`pciconf -lv`
`usbconfig list`  or  `usbconfig dump_device_desc`


*Now edit 3 Files *to add configuration lines into them.  This will make Wi-Fi operational
/boot/loader.conf /etc/rc.conf  /etc/wpa_supplicant.conf

Create rtwn0 device.  Only needed the first time when installing Wi-Fi.  This is persistent over future use and reboots.
`ifconfig wlan0 create wlandev rtwn0`

Check operation of wlan0 device.  Scan for Wi-Fi access points
`ifconfig wlan0`
`ifconfig wlan0 up scan`
`ifconfig wlan0 down`
`ifconfig wlan0`
`ifconfig wlan0 up`

Kill any previous instances of dhclient running.
`killall dhclient`  Then issue the wpa_supplicant command to configure the details of the Wi-Fi device.   A Debug version of wpa_supplicant is `wpa_supplicant -d -K -i wlan0 -c /etc/wpa_supplicant.conf`
Now kill the dhclient and issue the wpa_supplicant command again in the background.  Networking should come up and your ping commands should work
`killall dhclient
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
dhclient wlan0`

Check operation of network statistics or socket statistics
`netstat -r
netstat -i
sockstat -4`

When you make changes  to the network, you might have to restart the  network and routing processes.   This should bring up the network and connect again.
`service  netif restart
service routing restart`

`ifconfig wlan0`
`ifconfig wlan0 up`
Check if we can ping localhost first using just IP numbers,\; then 2nd time using  DNS lookup
`ping -c 3 127.0.0.1`
`ping -c 3 localhost`
Check if we can ping through external internet connection to Google.com
`ping -c  3   8.8.8.8`
`ping -c 3 he.net`       ping IPS backbone provider Hurricane Electric in Fremont California, simple to type he.net


Edimax EW-7811un Wifi setup for GhostBSD / FreeBSD This is helpful reading to understand manual commands
RealTek RTL8188CE PCI card Wifi setup uses RTWN device driver This is helpful reading to understand manual commands.

Optional idea is to use a cell phone cable connected to your cell phone, for a tethered internet connection.
https://forums.ghostbsd.org/ USB cellphone tethering for Network connection This is helpful using a USB Tethering from your cellphone data via USB cable


EDIMAX EW-7811un  details from manufacture website with a picture







RaspberryPi USB Wi-Fi Adapters listing with detail comments Some more reading to find usable Wifi Dongles for FreeBSD use by chipset number and User ID, this document references usage in a Linux Environment.


----------



## Alexander88207 (Oct 9, 2020)

wb7odyfred said:


> Edimax EW-7811un USB nano dongle works with rtwn driver.  Uses the RealTek RTL8192cu chipset .
> Reference these 2 GhostBSD forum posts, that I wrote to manually get a driver installed and working with GhostBSD to have Wifi operational.   I share some brief FreeBSD commands below, yet read the 2 posts referenced below for greater details and explanation
> 
> GhostBSD uses the same terminal (CLI) commands as FreeBSD.  Find what devices are connected on the PCI bus and the USB bus with the following terminal commands.  See if your Wi-Fi device is listed there in the output.
> ...



On FreeBSD, its only requiered to setup ifconfig in /etc/rc.conf and the network in /etc/wpa_supplicant.conf.


----------



## Abhi (Nov 28, 2020)

How to configure  RTL8188CUS usb wifi
?. when I connect in my lap ideapad (LENOVO) , it is not recognised ...? what are the steps I need to follow?......Thanks for your valuable advice


----------



## Abhi (Nov 28, 2020)

root@abhi:/usr/home/abhi #  ifconfig wlan0 create wlandev rtwn0
ifconfig: SIOCIFCREATE2: Device not configured
root@abhi:/usr/home/abhi #


----------



## Alexander88207 (Nov 29, 2020)

Hello, Abhi

do you have followed the instructions of 31.3. Wireless Networking?


----------



## wb7odyfred (Jan 14, 2021)

Abhi said:


> How to configure  RTL8188CUS usb wifi
> ?. when I connect in my lap ideapad (LENOVO) , it is not recognised ...? what are the steps I need to follow?......Thanks for your valuable advice


Start with these commands here to identify your Wifi Hardware Vendor/Product Ids.
http://bsd-hardware.info/ `hw-probe -all`  This might probe from the website??

u`name -a` or  `uname -k`   What version of FreeBSD are you running?

Please provide more info by https://www.freshports.org/sysutils/hw-probe for diagnostics.
 My valuable advice was to try the commands I listed in my Post above and to Follow Alexanders advice to read the FreeBSD Handbook  Section 31.3 Wireless Networking. When I started there was not available a hand holding how to start from the beginning.  I tried to write that in the forums.GhostBSD.org post I refered to up above  I read a lot of web articles, forum posts, FreeBSD handbook to find out the details to manually issue commands to make Wi-Fi networking operational.  It was hard to start, because I did not know what commands to issue in what order to find the information to edit into the files.  It broke down to editing 3 files, issue a few command lines for me to be able to ping a network like `ping -c 3 192.168.1.1` or `ping -c 3 8.8.4.4` or `ping -c 3 he.net`. After that setup, networking just worked for me. Networking automatically connected the next time I booted up.  I have placed the contents of those 3 files below:  /boot/loader.conf,/etc/rc.conf,/etc/wpa_supplicant.conf

Note that FreeBSD 12.0 the USB and PCI versions of the RealTek driver were incorporated in to one driver Kernel module rtwn.ko if_rtwn_usb.ko if_rtwn_pci.ko. Kernel modules that can be loaded with command `kldload rtwn if_rtwn_usb` . `kldstat` will show which kernel Modules were loaded into memory.

Can we see your USB Wi-Fi dongle connected and identified in the following 2 commands.

```
usbconfig list
usbconfig dump_device_desc
```

What are the outputs of the above two commands?  Do you see the Wifi chip set IDs there, reported back to you?.  No, pull out the USB dongle and reinsert to make sure it is seated good.

Check the output from dmesg looking for wireless information.

```
dmesg | less
dmesg | grep wlan
dmesg | grep rtl

sysctl net.wlan.devices

cat /var/log/messages
```

First verify that the USB wifi dongle is securely inserted into the USB socket.
I *strongly recommend* reading the webpages linked up above and report back what messages you receive. You may say it "FAILS", but I am not there to see the messages to understand what exactly is failing.
Edimax EW-7811un Wifi setup for GhostBSD / FreeBSD This is helpful reading to understand manual commands to test and diagnose a wifi connection.

I copied and placed the contents of those 3 files below, so that you have a template to work from

/boot/loader.con

```
legal.realtek.license_ack=1
if_rtwn_usb_load="YES"   #USB version Edimax 7811un [color=#000080]RTL8192CU[/color] installation lines
if_rtwn_load="YES"
rtwn-rtl8192cfwU_load="YES"
```
/etc/rc.conf

```
wlans_rtwn0="wlan0"
ifconfig_wlan0=" WPA SYNCDHCP"
```
/etc/wpa_supplicant.conf

```
network={
    #: my NetGear box
    ssid="NETGEAR59"
    psk="my_passkey_892"
    key_mgmt=WPA-PSK
}
network={
   #:  simple Open Access point
   ssid="innflux"
   key_mgmt=NONE
}
```


```
# kill the running dhclient process
killall dhclient
# Debug wifi with information.  Use the following line for testing with the Debug and wifi Password debug printout options
wpa_supplicant -d -K -i wlan0 -c /etc/wpa_supplicant.conf
dhclient wlan0

# use the No Debug version to start wifi
killall  dhclient
#  Manually issue the wpa_supplicant with the background Dameon option and dhclient commands
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
dhclient wlan0
```



The newer version of the Edimax EW-7811un Version2  is a RTL8188EU RealTek device USB Vendor/Product IDs 7392:B811  The Edimax EW-7811un Version1 is a RTL8192CU or RTL8188CU RealTek device  USB Vendor/Product IDs 7392:7811
So you might have to edit the RTWN FreeBSD driver to have the ability to recognize the newer version Edimax EW-7811unV2 device.    Look at the file  rtwn_usb_attach.h  for the details.


----------



## jb_fvwm2 (Jan 14, 2021)

`hw-probe -all` disables the usb mouse until it is unplugged, replugged here, not relevant to the thread, but to the post above.


----------

