wol
Wake computers using Wake-on-LAN
TLDR
Send a WoL packet to a device
Send a WoL packet to a device in another subnet based on its IP
Send a WoL packet to a device in another subnet based on its hostname
Send a WoL packet to a specific port on a host
Read hardware addresses, IP addresses/hostnames, optional ports and SecureON passwords from a file
Turn on verbose output
SYNOPSIS
wol [options] <MAC-address>
PARAMETERS
-i
Specifies the network interface through which to send the magic packet. For example, eth0 or enp0s3. Useful when a system has multiple network adapters.
-p
Defines the UDP port number to send the magic packet to. The default and standard port for Wake-on-LAN is 9. Other common ports include 0 or 7.
-b
Sets the target broadcast address instead of the default (usually 255.255.255.255 or the subnet's broadcast address). This can be useful in specific network configurations.
-s
Specifies a SecureON password if the target NIC requires one. This is a hexadecimal string. Note: Not all WoL implementations support or require this.
-v
Enables verbose output, providing more details about the packet being sent and the process.
-h
Displays a help message, listing available options and usage information.
DESCRIPTION
The wol command is a utility used to send a "magic packet" over a local area network to wake up a powered-off or sleeping computer. This functionality, known as Wake-on-LAN (WoL), allows a network administrator or user to remotely power on a machine without physical access. The magic packet is a special broadcast frame containing the MAC address of the target network interface card (NIC) repeated 16 times, preceded by a 6-byte synchronization stream of all ones (FF FF FF FF FF FF). When a WoL-enabled NIC receives this packet, and if it's configured correctly, it triggers the system to power on. wol simplifies this process by constructing and sending the packet to the specified MAC address, often broadcasting it to ensure it reaches the target even if its IP address is unknown or unavailable. It's an indispensable tool for remote management, especially in environments where servers or workstations need to be brought online outside of business hours.
CAVEATS
Network Configuration: Wake-on-LAN typically only works within the same broadcast domain (subnet). Waking a computer across different subnets or over the internet usually requires specific router/firewall configurations (e.g., port forwarding, static ARP entries, or configuring "IP helper" addresses for directed broadcasts), which can pose security risks if not managed carefully.
Hardware Support: The target computer's network interface card (NIC) and motherboard (BIOS/UEFI) must support Wake-on-LAN and have it enabled in the firmware settings. Some power management settings in the operating system might also need to be configured.
Security: Unless using a SecureON password (which is not widely supported or used), the magic packet itself is not encrypted or authenticated, meaning anyone on the local network can potentially send a wake-up command if they know the MAC address.
MAGIC PACKET STRUCTURE
The magic packet is a broadcast frame consisting of 6 bytes of FF (hexadecimal), followed by 16 repetitions of the target computer's 6-byte MAC address. This 102-byte payload is typically sent over UDP to port 7 or 9. The specific structure allows the NIC to easily detect and process the wake-up signal even when the main system is powered off or in a low-power state.
PREREQUISITES FOR WAKE-ON-LAN
For wol to successfully wake a machine, several conditions must be met on the target system:
1. The network card must support WoL (most modern cards do).
2. WoL must be enabled in the computer's BIOS/UEFI settings. This often involves options like "Power On By PCI-E/PCI", "Wake on LAN", or similar.
3. The operating system's power management settings might need adjustment to allow the NIC to receive wake-up calls (e.g., "Allow this device to wake the computer" in Windows device manager).
4. The computer needs to be connected to the network via an Ethernet cable (WoL over Wi-Fi is less common and often requires specific hardware/driver support).
HISTORY
The concept of Wake-on-LAN was developed by AMD and IBM in 1995. It was integrated into various motherboard and network card chipsets starting in the late 1990s as a feature for remote system management. The wol utility, along with alternatives like etherwake and wakeonlan, emerged in the Linux ecosystem to provide command-line access to this hardware capability, allowing administrators to easily send the required magic packets. Its development paralleled the increasing need for remote administration tools in networked environments.