Skip to content

Instantly share code, notes, and snippets.

@jcberthon
Last active June 13, 2026 03:09
Show Gist options
  • Select an option

  • Save jcberthon/ea8cfe278998968ba7c5a95344bc8b55 to your computer and use it in GitHub Desktop.

Select an option

Save jcberthon/ea8cfe278998968ba7c5a95344bc8b55 to your computer and use it in GitHub Desktop.
NetworkManager Wi-Fi powersaving configuration

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
  • NM_SETTING_WIRELESS_POWERSAVE_ENABLE (3): enable powersave

Then I propose 2 files, only one of them needs to be put under /etc/NetworkManager/conf.d/.
One is forcing to disable powersaving, while the other one enable it.

Once you have put the file in the right folder, simply restart NetworkManager:

sudo systemctl restart NetworkManager
# File to be place under /etc/NetworkManager/conf.d
[connection]
# Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable).
wifi.powersave = 2
# File to be place under /etc/NetworkManager/conf.d
[connection]
# Values are 0 (use default), 1 (ignore/don't touch), 2 (disable) or 3 (enable).
wifi.powersave = 3
@JonasGroeger

Copy link
Copy Markdown

Check with

iwconfig <interface> | grep "Power Management"

@aceqbaceq

Copy link
Copy Markdown

this is amazing.

# cat /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf 
[connection]
wifi.powersave = 3

literally kills ssh performance.
and
wifi.powersave = 2
creates a miracle!

@owainkenwayucl

owainkenwayucl commented Feb 3, 2024

Copy link
Copy Markdown

If you aren't using NetworkManager (default in the minimal RaspberyOS 11 install at least) you can temporarily (until reboot) turn off power management with:

iwconfig wlan0 power off

There are many conceivable ways of making this persist, e.g. putting it in rc.local.

@jeremyb31

Copy link
Copy Markdown

If you aren't using NetworkManager (default in the minimal RaspberyOS 11 install at least) you can temporarily (until reboot) turn off power management with:

iwconfig wlan0 power off

There are many conceivable ways of making this persist, e.g. putting it in rc.local.

It may just be Ubuntu and its derivatives that set the wifi.powersave=3

@josecastillolema

josecastillolema commented Jul 12, 2024

Copy link
Copy Markdown

Is there a way to test the configuration has succeeded without iwconfig?

I have tried to disable wifi powersaving:

> cat /etc/NetworkManager/conf.d/wifi-powersave-off.conf
[connection]
wifi.powersave = 2

> sudo systemcl restart NetworkManager

However nmcli shows no changes:

> nmcli con show MIWIFI_FAC2_5G | grep save
802-11-wireless.powersave:              0 (default)

PS from the logs of the service it looks like the file has been read:

Jun 27 15:54:31 think NetworkManager[6030]: <info>  [1719496471.3339] Read config: /etc/NetworkManager/NetworkManager.conf (lib: 20-connectivity-fedora.conf, 22-wifi-mac-addr.conf) (etc: wifi-powersave-off.conf)

@YuChuXi

YuChuXi commented Jul 20, 2024

Copy link
Copy Markdown

有没有办法不用iwconfig来测试配置是否成功?

我尝试禁用 wifi 省电功能:

> cat /etc/NetworkManager/conf.d/wifi-powersave-off.conf
[connection]
wifi.powersave = 2

> sudo systemcl restart NetworkManager

但是 nmcli 没有显示任何变化:

> nmcli con show MIWIFI_FAC2_5G | grep save
802-11-wireless.powersave:              0 (default)

PS:从服务日志来看该文件似乎已被读取:

Jun 27 15:54:31 think NetworkManager[6030]: <info>  [1719496471.3339] Read config: /etc/NetworkManager/NetworkManager.conf (lib: 20-connectivity-fedora.conf, 22-wifi-mac-addr.conf) (etc: wifi-powersave-off.conf)

Me too.
But

[wifi]
powersave=2

is useful

@theomkumar

Copy link
Copy Markdown

@josecastillolema try the following

❯ nmcli con show

NAME                UUID                                  TYPE   
   DEVICE 

Name 4G     wifi   
 .......

❯ nmcli con show "Name 4G" | grep save


802-11-wireless.powersave:              0 (default)

❯ nmcli connection modify "Name 4G" 802-11-wireless.powersave 2

❯ nmcli connection up "Name 4G"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/21)

❯ nmcli con show "Name 4G" | grep save


802-11-wireless.powersave:              2 (disable)

@EmreKaratopuk

Copy link
Copy Markdown

I am using Ubuntu 24.04, and I had an issue with Bluetooth where my headphones sometimes were repeatedly disconnecting and connecting again. Changing the value from 3 to 2 solved my issue. Thanks!

@mutiev

mutiev commented Jul 16, 2025

Copy link
Copy Markdown

This solved the problem with Raspberry 5, when after a night I could not log into ssh, and ping RPI by the IP address of the issued host is unreachable.

@josecastillolema

Copy link
Copy Markdown

Thanks @theomkumar !
I wonder if there is any way to make it the default for all wifi connections.

@Jyrijoul

Jyrijoul commented Dec 7, 2025

Copy link
Copy Markdown

Thank you for this helpful post. Using Fedora 42 and this fixes the problem I had with latency spikes while gaming.

I found that Framework has also created a script with a similar purpose, sharing it here in case anybody finds it useful.

@draczihper

Copy link
Copy Markdown

@josecastillolema try the following

❯ nmcli con show

NAME                UUID                                  TYPE   
   DEVICE 

Name 4G     wifi   
 .......

❯ nmcli con show "Name 4G" | grep save


802-11-wireless.powersave:              0 (default)

❯ nmcli connection modify "Name 4G" 802-11-wireless.powersave 2

❯ nmcli connection up "Name 4G"

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/21)

❯ nmcli con show "Name 4G" | grep save


802-11-wireless.powersave:              2 (disable)

How can make this a default for all wifis because wifi.powersave=2 doesn't seem to work in etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

@Koguni31

Copy link
Copy Markdown

Following make default no powersave on WiFi adapters beeing placed to some.conf file at /etc/NetworkManager/conf.d/:

[802-11-wireless]
powersave=2

@jlearman

jlearman commented Mar 2, 2026

Copy link
Copy Markdown

Following make default no powersave on WiFi adapters beeing placed to some.conf file at /etc/NetworkManager/conf.d/:

[802-11-wireless] powersave=2

None of the above suggestions works on Raspberry Pi OS Bookworm (12).

@robang74

robang74 commented Jun 13, 2026

Copy link
Copy Markdown

Ubuntu wifi power signal hygene:

$ cat /etc/network/if-up.d/wlan-low-txpower
#!/bin/sh
if echo $IFACE | grep -Eq "wlan|wlp"; then
# RAF: the value 0 may work as 0dB or refused or took as default
  iw dev $IFACE set txpower limit 100
fi

$ cat /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
[connection]
wifi.wake-on-wlan=0
wifi.powersave=3
wifi.bgscan=0


$ cat ~/bin/iwrtx.sh 
#!/bin/sh
sudo iw dev $wifiname info |
	grep -E "Interface|addr|type|channel|txpower"
nmcli -f SSID,BSSID,SIGNAL dev wifi
while sleep 1; do
  iw dev $wifiname link |
    sed -ne "s,.*bitrate: \([^ ]* [^ ]*\) .*,rx: \\1,p" |
      tr '\n' '@' | sed -e "s,@rx, - tx," | tr -d @; echo

Does it work?

  • Yes, as long as your private hotspot is nearby otherwise not, but it is the inteded behaviour.

  • Side effect: your Android hotspot tends to increase the TX power by +20dB which is not good.

Equilibrium can be found testing different tx powers:

  • sudo iw dev $wifiname set txpower limit 500

In my case this setting (500 mdB) is equivalent to 1500 in terms of TX power by the Android hotspot.

Considering that dB is a logaritmic scale the sweet post (least EM pollution) is obtained when the sum of all wifi networks nodes tx dB are at its minimum. Usually, compared with the standard TX power value that in my case was 1500 mdB.

Note: value provided by the script under the "SIGNAL" are RSSI expressed in % (higher better) and it is about signal noise ration not about the power. However, for a quick evaluation can be also used as an indirect evaluation of the hotspot TX power.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment