15
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Last updated at Posted at 2018-12-27

ラズパイをデフォルト設定で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運用が可能になります。

15
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?