16
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

updated at

ラズパイのWiFi運用の為にpower managent機能をオフにする方法

ラズパイをデフォルト設定でwifi運用を始めると1日程度放置するとpingにも応答しない事象が発生します。
wifiのpower management機能が働き、wifiがオフになるためです。
wifi運用を考える時にはpower management機能をオフにする必要があります。

環境

  • Raspberry Pi 3 Model B
  • OSバージョン
$ uname -a
Linux raspberrypi 4.14.79-v7  #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
$ grep -H "" /etc/*version ; grep -H "" /etc/*release
/etc/debian_version:9.6
/etc/os-release:PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
/etc/os-release:NAME="Raspbian GNU/Linux"
/etc/os-release:VERSION_ID="9"
/etc/os-release:VERSION="9 (stretch)"
/etc/os-release:ID=raspbian
/etc/os-release:ID_LIKE=debian
/etc/os-release:HOME_URL="http://www.raspbian.org/"
/etc/os-release:SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
/etc/os-release:BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

設定変更

デフォルトの設定確認。

$ sudo iwconfig wlan0
wlan0     IEEE 802.11  ESSID:"xxxx"  
         Mode:Managed  Frequency:2.412 GHz  Access Point: 6C:E4:DA:xx:xx:xx  
         Bit Rate=72.2 Mb/s   Tx-Power=31 dBm  
         Retry short limit:7   RTS thr:off   Fragment thr:off
         Power Management:on
         Link Quality=45/70  Signal level=-65 dBm  
         Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0   Missed beacon:0

wifiのpower managementをオフにします。

$ sudo iwconfig wlan0 power off
$ sudo iwconfig wlan0
wlan0     IEEE 802.11  ESSID:"xxxx"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 6C:E4:DA:xx:xx:xx   
          Bit Rate=72.2 Mb/s   Tx-Power=31 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=63/70  Signal level=-47 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:1  Invalid misc:0   Missed beacon:0

再起動するとまたオンになるので再起動後もオフになるように /etc/rc.local を編集します。

/etc/rc.local
#!/bin/sh -e
#
# rc.local
〜省略〜
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
 printf "My IP address is %s\n" "$_IP"
fi

iwconfig wlan0 power off # wlan0 power management off <- 追記
exit 0

これで再起動してもwifiの power management 機能はオフになるのでwifi運用が可能になります。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
16
Help us understand the problem. What are the problem?