背景
- ThinkPadに入れたLinux (Kubuntu) のWiFiが異常に遅くなった
- fast.comで調べても、300Kbpsというレベルの速度だった
- そのWiFiが異常に遅い問題を直した時のメモ
結論
- 原因は、Intel の iwlwifiドライバのバグだった
- IntelのWi-Fi チップでは、受信側(RX)の速度だけが 6.5Mbps に固定されるバグがある
Intel 6.5Mbps WiFi Limitと呼ばれる
- なぜ、6.5Mbpsになるかというとドライバの省力モードによるもの
- Linuxのiwlwifiドライバが省電力関連の機能を有効にしていたため発生した
- ちなみに、充電しっぱなしのPerformance Modeで発生した
用語
- iwlwifi (Intel Wireless WiFi Linux driver)
- Intel製 Wi-Fi チップ用の公式 Linux ドライバ
- Linux カーネルに標準で含まれている
- U-APSD(Unscheduled Automatic Power Save Delivery)
- Wi-Fi の省電力機能のひとつで、
- ルーターからのデータをまとめて受け取る」仕組み
- 802.11n の省電力関連オプション
- パラメーターで制御できる
0: 無効にしない(デフォルト)1: 11n を完全無効化(遅くなる)8: U-APSD を無効化
現状確認
speedtest-cliでWifiの速度の確認をした。
1
2
3
4
5
6
7
8
9
10
11
12
| $ sudo apt install speedtest-cli
$ speedtest-cli
Retrieving speedtest.net configuration...
Testing from SoftBank Corp. (126.89.41.182)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by fdcservers.net (Tokyo) [32.61 km]: 162.46 ms
Testing download speed................................................................................
Download: 0.36 Mbit/s
Testing upload speed......................................................................................................
Upload: 5.55 Mbit/s
|
特にダウンロードが異常に遅い。
解決策
以下のコマンドで、U-APSDだけ無効化した。
1
2
| $ sudo modprobe -r iwlwifi
$ sudo modprobe iwlwifi 11n_disable=8
|
恒久的に対応する場合はドライバのオプションを入れる。
/etc/modprobe.d/iwlwifi.confに11n_disable=8を追加すると恒久対応になる。
もともとのオプションは以下。
1
2
3
4
5
6
7
8
9
| $ cat /etc/modprobe.d/iwlwifi.conf
# /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system. When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211
|
以下でドライバのオプションの追加。
1
| $ echo "options iwlwifi 11n_disable=8" | sudo tee -a /etc/modprobe.d/iwlwifi.conf
|
Update後の確認。
1
2
3
4
5
6
7
8
9
10
| $ cat /etc/modprobe.d/iwlwifi.conf
# /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system. When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211
options iwlwifi 11n_disable=8
|
直ったか確認
1
2
3
4
5
6
7
8
9
10
11
| $ speedtest-cli
Retrieving speedtest.net configuration...
Testing from SoftBank Corp. (126.89.41.182)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by 7 BULL (Tokyo) [32.61 km]: 9.97 ms
Testing download speed................................................................................
Download: 92.86 Mbit/s
Testing upload speed......................................................................................................
Upload: 295.55 Mbit/s
|
ダウンロードが100倍早くなり、正常になった。
再発したので再度修正
再発したので、Power Management:onをoffにした。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| $ iwconfig
lo no wireless extensions.
enp0s31f6 no wireless extensions.
br-0967a5b27f39 no wireless extensions.
br-5fa91303a558 no wireless extensions.
docker0 no wireless extensions.
enx00051bacb1ed no wireless extensions.
wlp2s0 IEEE 802.11 ESSID:"D80F99D9AC8C-5G"
Mode:Managed Frequency:5.54 GHz Access Point: D8:0F:99:D9:AC:8F
Bit Rate=780 Mb/s Tx-Power=17 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=70/70 Signal level=-36 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:396 Missed beacon:0
$ sudo iwconfig wlp2s0 power off
[sudo] password for mike:
$ iwconfig
lo no wireless extensions.
enp0s31f6 no wireless extensions.
br-0967a5b27f39 no wireless extensions.
br-5fa91303a558 no wireless extensions.
docker0 no wireless extensions.
enx00051bacb1ed no wireless extensions.
wlp2s0 IEEE 802.11 ESSID:"D80F99D9AC8C-5G"
Mode:Managed Frequency:5.54 GHz Access Point: D8:0F:99:D9:AC:8F
Tx-Power=17 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=70/70 Signal level=-36 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:396 Missed beacon:0
|
ただし、上の方法だと、再発するので、次の手で恒久的にOffにする。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| $ nmcli connection show
NAME UUID TYPE DEVICE
D80F99D9AC8C-5G xxxxxx-xxxxxx-4a9b-b528-xxxxx wifi wlp2s0
...
$ export NAME=D80F99D9AC8C-5G
$ sudo nmcli connection modify $NAME 802-11-wireless.powersave 2
$ nmcli connection up $NAME
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)
$ iwconfig
lo no wireless extensions.
enp0s31f6 no wireless extensions.
br-0967a5b27f39 no wireless extensions.
br-5fa91303a558 no wireless extensions.
docker0 no wireless extensions.
enx00051bacb1ed no wireless extensions.
wlp2s0 IEEE 802.11 ESSID:"D80F99D9AC8C-5G"
Mode:Managed Frequency:5.54 GHz Access Point: D8:0F:99:D9:AC:8F
Bit Rate=866.7 Mb/s Tx-Power=17 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=68/70 Signal level=-42 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:27 Missed beacon:0
|
なお、0=default, 1=ignore, 2=disable, 3=enableとなっている。
まとめ
- LinuxのWiFiが遅くなる問題はIntelのWifiドライバーが原因だった
- SSHやミーティングにも影響していたので、クリティカルな課題だった
参考文献