Realtek RTL8188CUS – USB 802.11n WiFi Review

When using FreeBSD on a new laptop you sometimes find out that the WiFi chip that it came with is not supported … or not yet supported in RELEASE version and support exists in CURRENT development version that you do not want to use.

This is where Realtek RTL8188CUS chip comes hand.

realtek

Its used in many appliances and products but we are interested in its small USB WiFi version that is really small.

The Realtek company even got Taiwan Green Classics Award 2011 for their 802.11b/g/n 2.4GHz 1T1R WLAN Single Chip Controller (RTL8188CE/RTL8188CUS) on 2011 year when it was introduced.

chip

chip-look

Its not very powerful as it comes with 1×1 antennas and 802.11n support – yes only single antenna. 150Mbps at most.

Its also very small and almost does not stick out of the laptop.

chip-space

When connected it also gives subtle little dim light.

chip-light

FreeBSD

I will now show you how it works on FreeBSD. This is for 12.2-RELEASE version but it worked the same for 11.1-RELEASE 3 years ago.

My ThinkPad W520 laptop already has Intel 6300 with 3×3 antennas and 802.11n standard WiFi card supported by iwn(4) driver.

# sysctl net.wlan.devices
net.wlan.devices: iwn0

We will now attach Realtek RTL8188CUS chip and will check whats coming in dmesg(8) command.

# dmesg
(...)
ugen2.3:  at usbus2
rtwn0 on uhub4
rtwn0:  on usbus2
rtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R

… and some more information from usbconfig(8) command.

# usbconfig
(...)
ugen2.3:  at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

# usbconfig -d 2.3 show_ifdrv
ugen2.3:  at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen2.3.0: rtwn0: 

Its now listed as rtwn0 as its supported by the rtwn(4) driver on FreeBSD.

# sysctl net.wlan.devices
net.wlan.devices: rtwn0 iwn0

Lets connect to some wireless network with this Realtek chip. I will create wlan1 device as wlan0 is already taken by the other Intel 6300 card.

# ifconfig wlan1 create wlandev rtwn0

# ifconfig wlan1
wlan1: flags=8802<broadcast,simplex,multicast> metric 0 mtu 1500
        ether 00:1d:43:21:2d:1c
        groups: wlan
        ssid "" channel 1 (2412 MHz 11b)
        regdomain FCC country US authmode OPEN privacy OFF txpower 30 bmiss 7
        scanvalid 60 wme bintval 0
        parent interface: rtwn0
        media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
        status: no carrier
        nd6 options=21<performnud,auto_linklocal>

# wpa_passphrase WIFINETWORK PASSWORD >> /etc/wpa_supplicant.conf

# wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant
wlan1: Trying to associate with d8:07:b8:b8:f4:81 (SSID='wireless' freq=2442 MHz)
wlan1: Associated with d8:07:b6:b8:f4:81
wlan1: WPA: Key negotiation completed with d8:07:b6:b8:f4:81 [PTK=CCMP GTK=CCMP]
wlan1: CTRL-EVENT-CONNECTED - Connection to d8:07:b6:b8:f4:81 completed [id=40 id_str=]
^Z // HIT THE [CTRL]+[Z] KEYS HERE
zsh: suspended  wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf

# bg
[1]  + continued  wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf

#

We should now have network LAYER 2 connected and wpa_supplicant(8) should be running in a background and wlan1 interface should have associated status.

# ps ax | grep wpa_supplicant
48693  4  S        0:00.43 wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf
50687  4  S+       0:00.00 grep --color wpa_supplicant

# ifconfig wlan1
wlan1: flags=8843<up,broadcast,running,simplex,multicast> metric 0 mtu 1500
        ether 00:1d:43:21:2d:1c
        groups: wlan
        ssid wireless channel 7 (2442 MHz 11g ht/20) bssid d8:07:b6:b8:f4:81
        regdomain FCC country US authmode WPA2/802.11i privacy ON
        deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
        protmode CTS ht20 ampdulimit 64k ampdudensity 4 shortgi -stbc -ldpc
        -uapsd wme roaming MANUAL
        parent interface: rtwn0
        media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
        status: associated
        nd6 options=29<performnud,ifdisabled,auto_linklocal>

Lets add LAYER 3 with IP address using dhclient(8) command.

# dhclient wlan1
DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 3
DHCPOFFER from 10.0.0.1
DHCPREQUEST on wlan1 to 255.255.255.255 port 67
DHCPACK from 10.0.0.1
bound to 10.0.0.9 -- renewal in 3600 seconds.

We just got the 10.0.0.9 IP address.

One last step with DNS and we will test the connection with ping(8) command.

# echo nameserver 1.1.1.1 > /etc/resolv.conf

# ping -c 3 freebsd.org
PING freebsd.org (96.47.72.84): 56 data bytes
64 bytes from 96.47.72.84: icmp_seq=0 ttl=50 time=119.870 ms
64 bytes from 96.47.72.84: icmp_seq=1 ttl=50 time=119.371 ms
64 bytes from 96.47.72.84: icmp_seq=2 ttl=50 time=119.128 ms

--- freebsd.org ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 119.128/119.456/119.870/0.309 ms

Works.

FreeBSD Benchmark

I next tested the performance of this simple single antenna Realtek chip using NFS large file transfer in thunar(1) file manager.

not-great-not-terrible

The results are not that bad but not great either.

The file copy from LAN server attached directly to WiFi router to my laptop was about 2.9 MB/s fast. I was 5 meters away from the router.

server  ==LAN==>  router  ==WiFi==>  laptop  @  2.9 MB/s

The file copy from laptop using WiFi to LAN server attached directly to WiFi router was about 2.6 MB/s fast. Still about 5 meters away from the router.

laptop  ==WiFi==>  router  ==LAN==>  server  @  2.6 MB/s

That is 23.2 Mbps and 20.8 Mbps respectively. Really far from theoretical single antenna 802.11n 150 Mbps transfer … its probably fault of the FreeBSD wireless stack.

I would say that its sufficient for Internet browsing but using local LAN resources over NFS can be painful.

On the contrary my Intel 6300 WiFi card does 5.5 MB/s on the laptop-to-router-to-server copy and 10.5 MB/s on the server-to-router-to-laptop road. That is 44 Mbps and 84 Mbps respectively instead of 450 Mbps theoretical maximum. Both the Intel 6300 and my router have 3×3 antennas.

Would love to see these number closer to 30 MB/s …

Raspberry Pi

One of the other benefit of the Realtek RTL8188CUS chip is that it works very well on small Raspberry Pi boxes. Personally I have tested it on the Raspberry Pi 2B and it worked like a charm.

rpi

Price

This chip is also great when it comes to price. Products based on this chip are available everywhere. They are on EBAY. They are on ALIEXPRESS. And it costs as low as $2.50 in many cases.

Sometimes the delivery costs more then the product itself πŸ™‚

Enjoy.

UPDATE 1 – Middle Ages

Reddit user Yaazkal user from Reddit just reminded me thatΒ  rtwn(4) driver on FreeBSD still does not support 802.11n protocol.

It’s still in the middle ages of 802.11g transfers.

18 thoughts on “Realtek RTL8188CUS – USB 802.11n WiFi Review

  1. Fred Finster

    Vermaden, I share a copy of my reply at reddit.com to ASUS N-10 wifi module .Thank you for all this documentation efforts you have created.

    Respectfully,
    wb7odyFred

    There is a combined version of PCI and USB of Realtek wifi devices kernel module now.

    # kldstat 
    # kldload if_rtwn 
    # kldload if_rtwn_usb 
    # kldstat
    # ifconfig wlan0 create wlandev rtwn0
    # ifconfig wlan0
    # usbconfig dump_device_desc
    # ifconfig wlan0 up scan
    

    Edit 3 files:
    /boot/loader.conf
    /etc/rc.conf
    /etc/wpa_supplicant.conf

    Debug connection start up:

    # wpa_supplicant -d -K -i wlan0 -c /etc/wpa_supplicant.conf

    Background version:

    # wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf

    DHCP:

    # dhclient wlan0

    Edimax EW-7811UN RTL8192CU
    Setup example commands for wireless manual configuration.
    Please read.
    Will help you setup your wifi chip:
    https://forums.ghostbsd.org/viewtopic.php?f=64&t=526

    RTL8188CE PCI
    Device setup.
    More wifi setup example commands:
    https://forums.ghostbsd.org/viewtopic.php?f=64&t=570

    Please do share your 3 configuration files here.

    I know this will work for your RTL8192CU chip, because the manual configuration did work for me.

    // EDITED BY VERMADEN

    Like

    Reply
  2. Vasilis

    Vermaden,
    Thank you for the documentation.
    I purchased a Realtek RTL8188CUS from my RPi3B.
    Should the dongle led light up when you plug it in? If not shall I assume that it is faulty?

    Liked by 1 person

    Reply
    1. vermaden Post author

      Hi,

      I do not remember if it lights up after WiFi connection or directly after attach to the USB port – but it should light up.

      Hope that helps.

      Like

      Reply
  3. Pingback: FreeBSD Cope with WiFi Fuckup | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  4. Pingback: FreeBSD справляСтся с ошибкой WiFi - FlMarket.ru - Ρ…ΠΎΡ€ΠΎΡˆΠΈΠ΅ новости

  5. Pingback: Silent Fanless Dell Wyse 3030 LT FreeBSD Server | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  6. Pingback: FreeBSD 13.2 on ThinkPad T14 (GEN1) | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  7. DK

    Does not seem to work with Raspberry Pi 3/4 using FreeBSD 13.1 in WPA. wpa_supplicant output indicates some authentication issue when resolving ptk pass phrase. ioctl problems presumably due to register incompatibility. Spent 3 days learning, trying to resolve. May be missing something but tried a lot of things. Used .12x on raspi 3b+, same problem. Might be helpful next time if you posted what FreeBSD version you were using and what protocol was used – posting relevant loader.conf, rc.conf, wp_supplicant.conf would help as well.

    Like

    Reply
    1. vermaden Post author

      I have RPI 2B so I could not test on 3/4/5 unfortunately.

      I used WPA/WPA2 on it.

      Maybe try FreeBSD 14.0 for better results?

      Have You submitted the BUG yet?

      Thanks,
      vermaden

      Like

      Reply
      1. DK

        Tried 14.x a few days ago, same result. I originally bought the dongle based on this post:
        https://forums.freebsd.org/threads/usb-wlan-recommendation.88658/ (and this page).

        Turns out I should have read the whole post – further down it shows others had the same issue I did with the 8188CUS on later FreeBSD versions. Didn’t file a bug report since others seemed to have the same issue before me. It was easy enough to get my money back from Amazon for the dongle.

        Wound up ordering a used Archer T2U nano:
        https://www.amazon.com/gp/product/B07PB1X4CN/

        After doing a little more research. It (should) use an RTL8821AU, which in 2023, reading the latest forums, should be OK for 13.1. We’ll see if it works when it arrives. I wish there weren’t such an explosion of hardware/software combinations to wade through when putting together a FreeBSD system, but I guess it’s part of the joy of being in a niche community. Thanks for posting back.

        Like

  8. DK

    Confirmed, Archer T2U nano works on pi 4B using FreeBSD 13.1. As long as it continues to use the RTL8821AU at least. These instructions should work as is. Only difference would be the Archer does not have an LED or button.
    Cheers!

    Like

    Reply
      1. DK

        Not sure how fast or what protocol, was on BSD Pi last week, but put it on the shelf for the time being. Unclear how useful my speed data would be anyway since my connection (even on a β€˜real’ Linux box) is sketchy. I’m as far from the router as I can be. Normally just use wired. But wanted to ensure I had an SSH connection over WiFi to the Pi/BSD config. So no real speed testing, just practical CLI stuff.

        Like

  9. Pingback: Tiny Undervalued Hardware Companions | πšŸπšŽπš›πš–πšŠπšπšŽπš—

Leave a comment