How to configure wireless wake-on-lan for Linux WiFi card

I have Network Attached Storage (NAS) server that backups all my devices. However, I am having a hard time with my Linux powered laptop. I cannot backup my laptop/computer when it is in suspended or sleep mode. How do I configure my wifi on a laptop to accept a wireless wol when using Intel-based wifi card? How can I configure wireless wake-on-lan on Linux?

Wake-on-LAN (WOL) is an Ethernet networking standard that allows a server to be turned on by a network message. You need to send magic packets to wake-on-lan enabled ethernet adapters and motherboards, in order to switch on the called systems.
linux-configire-wake-on-wireless-lan-wowlan
Wake on Wireless (WoWLAN or WoW) is a feature to allow the Linux system to go into a low-power state while the wireless NIC remains active and stay connected to an AP. This quick tutorial shows how to enable WoWLAN or WoW (wireless wake-on-lan) mode with a wifi card installed in a Linux based laptop or desktop computer.

ADVERTISEMENTS

Please note that not all WiFi cards or Linux drivers support the WoWLAN feature.

Syntax to configure wireless wake-on-lan under Linux

You need to use the iw command to see or manipulate wireless devices and their configuration on a Linux based system. The syntax is:
iw command
iw [options] command

List all wireless devices and their capabilities

Type the following command:
$ iw list
$ iw list | more
$ iw dev

Sample outputs:

phy#0
	Interface wlp3s0
		ifindex 3
		wdev 0x1
		addr 6c:88:14:ff:36:d0
		type managed
		channel 149 (5745 MHz), width: 40 MHz, center1: 5755 MHz
		txpower 15.00 dBm

Please note down phy0.

Find out the current status of your wowlan

Open the terminal app and type the following command to find out wowlan status:
$ iw phy0 wowlan show
Sample outputs:
WoWLAN is disabled

How to enable wowlan

The syntax is:
sudo iw phy {phyname} wowlan enable {option}
Where,

  1. {phyname} – Use iw dev to get phy name.
  2. {option} – Can be any, disconnect, magic-packet and so on.

For example, I am going to enable wowlan for phy0:
$ sudo iw phy0 wowlan enable any
OR
$ sudo iw phy0 wowlan enable magic-packet disconnect
Verify it:
$ iw phy0 wowlan show
Sample outputs:

WoWLAN is enabled:
 * wake up on disconnect
 * wake up on magic packet

Test it

Put your laptop in suspend or sleep mode and send ping request or magic packet from your nas server:
$ sudo sh -c 'echo mem > /sys/power/state'
Send ping request from your nas server using the ping command $ ping your-laptop-ip
OR send magic packet using wakeonlan command :
$ wakeonlan laptop-mac-address-here
$ etherwake MAC-Address-Here

How do I disable WoWLAN?

The syntax is:
$ sudo phy {phyname} wowlan disable
$ sudo phy0 wowlan disable

How to enable iw settings after reboot?

Edit or update or create a file named /etc/rc.local as follows:
sudo vim /etc/rc.local
Update as follows:

#!/bin/bash
/sbin/iw phy0 wowlan enable magic-packet disconnect
exit 0

Save and close the file in vim. Run the chmod command to set correct permissions:
sudo chmod +x /etc/rc.local
Under systemd rc-local will gets pulled automatically into multi-user.target by systemd-rc-local-generator if /etc/rc.local is executable. For example, to view this file, run:
sudo systemctl edit --full rc-local
Configure wireless wake-on-lan for Linux WiFi card using systemd

Conclusion

You learned how to configure wireless (Wi-Fi) for wake-on-lan under Linux operaring system using the iw command. For more info read the iw command man page:
$ man iw
$ iw --help

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Darksun Dec 14, 2017 @ 14:40

    There is a typo

    Open the terminal app and type the following command to *tind* out wowlan status:
    Do you mean `find`?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.