ubuntu 20.04 にusb WiFiアダプタを設定する手順 RTL8822BU Chipsets

古いノートパソコンを利用しているのですが、WiFiの速度の改善のため、USB WiFiアダプタを接続しました。

以下、認識から利用できるまでの手順です。

こちらを購入しました。Realtek 8812bu
Arbalest WiFi 無線LAN子機 1200Mbps USB3.0 2.4G(300Mbps)

ここがポイント!

・RTL8812buドライバはgitに複数ありますが、ubuntu20.04の場合には、以下からcloneすると動作します。

Linux Driver for USB WiFi Adapters that are based on the RTL8812BU and RTL8822BU Chipsets - morrownr/88x2bu

・またESSIDとKeyを設定する”/etc/netplan/”配下のyamlファイルがありますが、インデント処理の判定が厳しいので注意。

0.基本情報の確認
$ cat /etc/issue
Ubuntu 20.04.2 LTS \n \l

$ uname -a
Linux ThinkPad 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
user@ThinkPad:~$
1.認識しているかどうか確認:idVendor=0bda, idProduct=b812として認識
[    2.013657] usb 2-1.1: new high-speed USB device number 3 using ehci-pci
[    2.222889] usb 2-1.1: New USB device found, idVendor=0bda, idProduct=b812, bcdDevice= 2.10
[    2.222894] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.222899] usb 2-1.1: Product: USB3.0 802.11ac 1200M Adapter
[    2.222903] usb 2-1.1: Manufacturer: Realtek
[    2.222907] usb 2-1.1: SerialNumber: 123456
2.必要パッケージのインストール
sudo apt-get install build-essential git dkms
3.git clone & install(このあと再起動を求められる)
git clone https://github.com/morrownr/88x2bu.git

# install
cd ./88x2bu
sudo ./install-driver.sh
4.起動時にデバイスが認識されていることを確認
dmesg

--- SNIP ---

[    5.416621] Intel(R) Wireless WiFi driver for Linux
[    5.456735] 88x2bu: loading out-of-tree module taints kernel.
[    5.464578] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[    5.471923] iwlwifi 0000:03:00.0: loaded firmware version 8.83.5.1 build 33692 5000-5.ucode op_mode iwldvm
[    5.471965] iwlwifi 0000:03:00.0: Direct firmware load for iwl-debug-yoyo.bin failed with error -2

--- SNIP ---

[    5.600799] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUG disabled
[    5.600801] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUGFS enabled
[    5.600803] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEVICE_TRACING enabled
[    5.600806] iwlwifi 0000:03:00.0: Detected Intel(R) WiFi Link 5100 AGN, REV=0x54
[    5.650153] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs'

--- SNIP ---

[    6.993895] rtl88x2bu 2-1.1:1.0 wlx1cbfce5a8c4d: renamed from wlan0
[    7.255713] audit: type=1400 audit(1622787256.548:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lsb_release" pid=533 comm="apparmor_parser"
[    7.325046] audit: type=1400 audit(1622787256.620:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/cups/backend/cups-pdf" pid=534 comm="apparmor_parser"
[    7.325051] audit: type=1400 audit(1622787256.620:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cupsd" pid=534 comm="apparmor_parser"
[    7.325055] audit: type=1400 audit(1622787256.620:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cupsd//third_party" pid=534 comm="apparmor_parser"
[    7.369002] audit: type=1400 audit(1622787256.664:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/snapd/snap-confine" pid=540 comm="apparmor_parser"
[    7.369008] audit: type=1400 audit(1622787256.664:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=540 comm="apparmor_parser"
[    7.442413] audit: type=1400 audit(1622787256.736:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-soffice" pid=532 comm="apparmor_parser"
[    7.442419] audit: type=1400 audit(1622787256.736:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-soffice//gpg" pid=532 comm="apparmor_parser"
[    7.449556] audit: type=1400 audit(1622787256.744:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=541 comm="apparmor_parser"
[    7.449561] audit: type=1400 audit(1622787256.744:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=541 comm="apparmor_parser"
[    7.998698] random: crng init done
[   10.774063] aufs 5.x-rcN-20200622
[   10.812448] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
[   10.947575] iwlwifi 0000:03:00.0: Radio type=0x1-0x2-0x0
5.デバイス名の確認とWiFiの電波受信状況確認
nmcli d | grep wifi

wls1                     wifi      disconnected  --
wlx1cbfce5a8c4d          wifi      disconnected  --
p2p-dev-wlx1cbfce5a8c4d  wifi-p2p  disconnected  --


nmcli dev wifi list

IN-USE  BSSID              SSID            MODE   CHAN  RATE       SIGNAL  BARS>
*       10:66:82:00:00:3B  aterm-888886-a  Infra  36    44 Mbit/s  98      ▂▄▆█>

IN-USE  BSSID              SSID            MODE   CHAN  RATE        SIGNAL  BAR>
        10:66:82:00:00:3A  aterm-888886-g  Infra  9     270 Mbit/s  52      ▂▄_>
        10:66:82:00:00:3B  aterm-888886-a  Infra  36    270 Mbit/s  17      ▂__>
6a.SSID等設定&接続  /etc/netplan/01-network-manager-all.yamlを編集し、dev名,essid,Keyを指定する
cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
   wifis:
           wlx1cbfce5a8c4d:
                   dhcp4: true
                   access-points:
                           "SSID":
                                   password: "Key"
   version: 2
   renderer: NetworkManager
6b.参考:コマンドラインでSSID&Keyを設定する方法
# 例 Keyを入力する場合
nmcli --ask dev wifi connect network-ssid

# 例2 Key一括して一行で指定する場合
sudo nmcli dev wifi connect SSID password "Key"

# 参考)接続されているネットワークを表示
nmcli con show

# 参考)ネットワークの UP / DOWN
nmcli con up/down ssid/uuid
7.設定適用・接続の確認
# 設定適用
sudo netplan apply

# 接続の確認
iwconfig

wls1      IEEE 802.11  ESSID:"接続先SSID"
          Mode:Managed  Frequency:5.22 GHz  Access Point: 00:00:00:31:F1:3B
          Bit Rate=6 Mb/s   Tx-Power=15 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=29/70  Signal level=-81 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:68   Missed beacon:0

wlx1cbfce5a8c4d  IEEE 802.11an  ESSID:"接続先SSID"  Nickname:"WIFI@RTL88X2BU"
          Mode:Managed  Frequency:5.22 GHz  Access Point: 00:00:00:31:F1:3B
          Bit Rate:300 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=36/100  Signal level=-77 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


ifconfig

wls1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.11.114  netmask 255.255.255.0  broadcast 192.168.11.255
        inet6 2222:3333:e3c0:0:ea0c:adaa:7eee:ea85  prefixlen 64  scopeid 0x0<global>
        inet6 2222:3333:e3c0:0:3ae1:e03b:6834:9b48  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::531b:7d74:ca06:fa4a  prefixlen 64  scopeid 0x20<link>
        ether 00:00:00:c8:7d:c4  txqueuelen 1000  (Ethernet)
        RX packets 1935  bytes 452259 (452.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 569  bytes 86403 (86.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlx1cbfce5a8c4d: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.11.119  netmask 255.255.255.0  broadcast 192.168.11.255
        inet6 2222:3333:e3c0:0:1ebf:ceff:fe5a:8c4d  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::1ebf:ceff:fe5a:8c4d  prefixlen 64  scopeid 0x20<link>
        inet6 2222:3333:e3c0:0:19ec:3e04:cb59:ed4f  prefixlen 64  scopeid 0x0<global>
        ether 00:00:00:5a:8c:4d  txqueuelen 1000  (Ethernet)
        RX packets 953  bytes 331194 (331.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 167  bytes 74466 (74.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

8.WiFi無効化・有効化
# 無効化
sudo iwconfig wls1 txpower off

# 有効化
sudo iwconfig wls1 txpower auto

9.WiFiによるLAN通信速度計測

# サーバ側
sudo apt install iperf3
iperf3 -s

# クライアント側(サーバに60秒間テストする)
iperf3 -c server-ip -t 60

肝心の受信性能ですが、あまり芳しくありませんが、同じチップを利用したもう少し高いアダプターであれば、満足する結果が出ると思います。

参考にさせていただきました。ありがとうございます。

https://github.com/morrownr/88x2bu
Netplanの設定方法。Raspberry Pi 3 B+、OSはUbuntu 18.04.2(arm64)にて、NetplanでRaspberry Piのon boardのWiFiを有効化しました。

シェアする

  • このエントリーをはてなブックマークに追加

フォローする