Wake-on-LAN (WOL) is a feature to switch on a computer via the network.
- 1 Hardware settings
- 2 Software configuration
- 3 Trigger a wake up
- 4 Miscellaneous
- 5 Troubleshooting
- 6 See also
The target computer's motherboard and NIC have to support Wake-on-LAN. Wireless cards do not support Wake-on-LAN, so the target computer has to be physically connected (i.e. by cable) to router or the source computer.
The Wake-on-LAN feature also has to be enabled in the PC's BIOS. Different motherboard manufactures use slightly different language for this feature. Look for terminology such as "PCI Power up", "Allow PCI wake up event" or "Boot from PCI/PCI-E".
It is known that some motherboards are affected by a nasty bug that causes reboots rather than shutdowns under certain situations (see this thread for example). To prevent this bug from surfacing, it is recommended to do the following on the target machine:
- Disable all references to "xHCI" as it pertains to USB settings.
- Disable EuP 2013 if it is explicitly an option.
- Optionally enable WOL for keyboard actions.
Depending on the hardware, the network drivers may have WOL switched off by default. To query this status or to change the settings, install.
Query the network device via this command:
# ethtool net0 | grep Wake-on
Supports Wake-on: pumbag Wake-on: d
The values define what activity to wake on:
p (PHY activity),
u (unicast activity),
m (multicast activity),
b (broadcast activity),
a (ARP activity), and
g (magic packet activity). The value of
g is required for WOL to work.
To enable the WOL feature in the driver:
# ethtool -s net0 wol g
This command might not last beyond the next reboot, so it must be repeated via some mechanism. Common solutions are listed in the following subsections.
Make it persistent
If using netctl, one can make this setting persistent by adding the following the netctl profile:
ExecUpPost='/usr/bin/ethtool -s net0 wol g'
Link-level configuration is possible through systemd. The actual setup is performed by the
net_setup_link udev builtin. Add the
WakeOnLan option to the network link file:
[Link] WakeOnLan=magic ...
See systemd-networkd#link files and for more information.
This is an equivalent of previous
systemd.link option, but uses a standalone systemd service.
[Unit] Description=Wake-on-LAN for %i Requires=network.target After=network.target [Service] ExecStart=/usr/bin/ethtool -s %i wol g Type=oneshot [Install] WantedBy=multi-user.target
Alternatively install theAUR package.
Then activate this new service by starting
ACTION=="add", SUBSYSTEM=="net", NAME=="enp*", RUN+="/usr/bin/ethtool -s $name wol g"
$name placeholder will be replaced by the value of the
NAME variable for the matched device.
@reboot /usr/bin/ethtool -s [net-device] wol g
In version 1.0.6 NetworkManager adds Wake-on-LAN controls. One way to enable Wake-on-LAN by magic packet is through nmcli.
First, search for the name of the wired connection:
# nmcli con show
NAME UUID TYPE DEVICE wired1 612e300a-c047-4adb-91e2-12ea7bfe214e 802-3-ethernet enp0s25
By following, one can view current status of Wake-on-LAN settings:
# nmcli c show "wired1" | grep 802-3-ethernet.wake-on-lan
802-3-ethernet.wake-on-lan: default 802-3-ethernet.wake-on-lan-password: --
Enable Wake-on-LAN by magic packet on that connection:
# nmcli c modify "wired1" 802-3-ethernet.wake-on-lan magic
Then reboot, possibly two times.
From version 1.2.0 Wake-on-LAN settings can be changed graphically using.
Trigger a wake up
To trigger WOL on a target machine, its MAC address and external or internal IP should be known.
To obtain the internal IP address and MAC address of the target computer, execute the following command:
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp1s0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000 link/ether 48:05:ca:09:0e:6a brd ff:ff:ff:ff:ff:ff inet 192.168.1.20/24 brd 192.168.1.255 scope global br0 valid_lft forever preferred_lft forever inet6 fe80::6a05:caff:fe09:e6a/64 scope link valid_lft forever preferred_lft forever
Here the internal IP address is
192.168.1.20 and the MAC address is
One program able to send magic packets for WOL is.
On the same LAN
If you are connected directly to another computer through a network cable, or the traffic within a LAN is not firewalled, then using Wake-on-LAN should be very easy since there is no need to worry about port redirects.
In the simplest case the default broadcast address
255.255.255.255 is used:
$ wol target_MAC_address
To broadcast the magic packet only to a specific subnet or host, use the
$ wol -i target_IP target_MAC_address
Across the internet
When the source and target computers are separated by a router, Wake-on-LAN can be used via port forwarding. There are two possible solutions:
- Configure the router to forward a different port to each target machine. (Requires any target machine to have a static IP address on its LAN)
- Configure the router to forward a single port to the broadcast address. (May not be possible on all routers)
In both cases to trigger the wakeup run:
$ wol -p forwarded_port -i router_IP target_MAC_address
Forward a port to the broadcast address
Most routers do not allow you to forward to broadcast, however if you can get shell access to your router (through telnet, ssh, serial cable, etc) you can implement this workaround:
$ ip neighbor add 192.168.1.254 lladdr FF:FF:FF:FF:FF:FF dev net0
(The above command assumes your network is 192.168.1.0/24 and use net0 as network interface). Now, forward UDP port 9 to 192.168.1.254. This has worked for me on a Linksys WRT54G running Tomato, and on the Verizon FIOS ActionTec router.
For notes on how to do it on DD-WRT routers, see this tutorial.
Battery draining problem
Some laptops have a battery draining problem after shutdown . This might be caused by enabled WOL. To solve this problem, disable it by using ethtool as mentioned above.
# ethtool -s net0 wol d
Example WOL script
Here is a script to automate WOL to several different machines:
#!/bin/bash # definition of MAC addresses monster=01:12:46:82:ab:4f chronic=00:3a:53:21:bc:30 powerless=1a:32:41:02:29:92 ghost=01:1a:d2:56:6b:e6 while true; do echo "Which PC to wake?" echo "p) powerless" echo "m) monster" echo "c) chronic" echo "g) ghost" echo "b) wake monster, wait 40sec, then wake chronic" echo "q) quit and take no action" read input1 case $input1 in p) /usr/bin/wol $powerless ;; m) /usr/bin/wol $monster ;; c) /usr/bin/wol $chronic ;; g) # this line requires an IP address in /etc/hosts for ghost # and should use wol over the internet provided that port 9 # is forwarded to ghost on ghost's router /usr/bin/wol -v -h -p 9 ghost $ghost ;; b) /usr/bin/wol $monster echo "monster sent, now waiting for 40sec then waking chronic" sleep 40 /usr/bin/wol $chronic ;; Q|q) echo "later!" break ;; esac done echo "this is the (quit) end!! c-ya!"
Users with Realtek 8168 8169 8101 8111(C) based NICs (cards / and on-board) may notice a problem where the NIC seems to be disabled on boot and has no Link light. See Network configuration#Realtek no link / WOL problem.
If the link light on the network switch is enabled when the computer is turned off but wake on LAN is still not working, booting the system using thekernel module at least once and then switching back to the r8169 kernel module included with the kernel seems to fix it at least in the following configurations:
- MSI B85M-E45 motherboard, BIOS version V10.9, onboard Realtek 8111G chipset
r8168 module you might need to set the
s5wol=1 module option to enable the wake on LAN functionality.
alx driver support
For some newer Atheros-based NICs (such as Atheros AR8161 and Killer E2500), WOL support has been disabled in the mainline
alx module due to a bug causing unintentional wake-up (see this patch discussion). A patch can be applied (or installed as a dkms module) which both restores WOL support and fixes the underlying bug, as outlined in this thread.
If the computer does not wake after suspend/hibernate when using TLP, set the
WOL_DISABLE value to