If you put your Ubuntu Linux desktop to sleep at the end of the day, you might occasionally walk into your office the next morning to find the computer powered on, fans spinning, and the lock screen fully illuminated. One of the most common culprits for a computer mysteriously waking itself up from suspend is a network protocol called Wake-on-LAN (WoL).
When Wake-on-LAN is enabled, your computer’s network interface card (NIC) remains partially active even while the rest of the system is asleep. It listens for a specific “magic packet” sent over the network. If it receives one, it sends a hardware interrupt that forces the motherboard to instantly wake the computer up. Unfortunately, overly aggressive network routers or misconfigured devices on your local network can occasionally send stray packets that accidentally trigger this wake event.
If you do not remotely manage your Ubuntu machine, you should completely disable Wake-on-LAN to ensure the computer remains deeply asleep until you physically press the power button.
How to Disable Wake-on-LAN in Ubuntu
You must use the ethtool utility to change the behavior of your network interface card.
- Open your terminal application (
Ctrl+Alt+T). - First, identify the name of your ethernet interface by running:
ip a(Look for a name starting withen, such asenp3s0oreth0). - Check the current Wake-on-LAN status of that interface using
ethtool(replaceenp3s0with your actual interface name):
sudo ethtool enp3s0
- Look for the line that says
Wake-on: g. (The ‘g’ means it is listening for magic packets). - To disable it, run the following command to set the status to ‘d’ (disabled):
sudo ethtool -s enp3s0 wol d
The network interface card will immediately stop listening to the network while the computer is suspended. Your Ubuntu machine will now remain perfectly asleep, completely immune to rogue network activity.