Akshay Mishra

Wake-on-LAN protocol

A computer can be awakened or turned on by a network message thanks to the Wake-on-LAN (WoL) Ethernet or token ring networking standard.

  • Usually, an application running on a mobile device attached to the same local area network as the target computer—such as a smartphone—sends the message to it.
  • Using subnet-directed broadcasts or a WOL gateway service, it is also possible to start the message from a different network.
  • Other terms are interchangeable, including wake on WAN, remote wake-up, power on by LAN, power up by LAN, resume by LAN, resume on LAN, and wake up on LAN.

Scope

  • This article defines the Wake-on-LAN protocol and magic packet.
  • This article also briefly explains Magic Packet.
  • The article also explains how to Enable Wake-on-LAN on Your System:
    In windows, In Linux, In Mac OS.

What Is Wake-on-LAN?

Wake-on-LAN (WoL or WOL) is an Ethernet or Token Ring computer networking protocol that enables a machine to be turned on or awakened by a network message.
An application running on a device connected to the same local area network often sends the message to the target machine. By utilizing subnet-directed broadcasts or a WoL gateway service, it is also possible to start the message from a different network.
Other terms are interchangeable, including wake on WAN, remote wake-up, power on by LAN, power up by LAN, resume by LAN, resume on LAN, and wake up on LAN. A second standard known as Wake on Wireless LAN (WLAN) must be used if the computer that needs to be awakened is communicating via Wi-Fi.
Vendors frequently add new features to the WoL and WoWLAN standards to offer protocol-transparent on-demand services, such as the Apple Bonjour wake-on-demand (Sleep Proxy) capability.
A specially created packet known as a magic packet is used to implement wake-on-LAN (or "WOL"), and it is transmitted to all computers in a network, including the one that needs to be awakened.
The network interface card ("NIC") or other ethernet devices in a computer are individually equipped with an identification number known as a MAC address that allows them to be uniquely identified and addressed on a network.
Network devices that can “listen” to incoming packets when the system is powered down are present on powered-down or off systems that support Wake-on-LAN. Like hitting the power button, the NIC notifies the computer’s power supply or motherboard to commence system wake-up if a magic packet is received that is addressed to the device’s MAC address. The magic packet is delivered using the data link layer (layer 2 in the OSI model) and, after being sent, is broadcast to all attached devices on a specific network using the network broadcast address; the IP address (layer 3 in the OSI model) is not used.

The Magic Packet: How Wake-on-LAN Works

Frames transferred between computers form the basis of Ethernet connections, which include wireless data networks, home, and office networks, and the Internet itself. A specially created frame known as a magic packet, which is distributed to every computer on a network, including the computer that has to be awakened, is used to implement WoL. The target computer’s MAC address, an identifying number built into each network interface card ("NIC") or another ethernet device in a computer that enables it to be specifically identified and addressed on a network, is contained in the magic packet.
Network devices on powered-down or off computers with Wake-on-LAN capabilities will be able to “listen” to incoming packets while the machine is powered down. In the same way as hitting the power button would, the NIC alerts the computer’s power supply or motherboard to commence system wake-up if a magic packet is received that is addressed to the device’s MAC address.
The magic packet is delivered using the data link layer (layer 2 in the OSI model) and, after being sent, is broadcast to all attached devices on a specific network using the network broadcast address; the IP address (layer 3 in the OSI model) is not used.
Wake-on-LAN can typically only be used within the present network subnet because it is based on broadcast technologies. Though there are few exceptions, Wake-on-LAN can function across any network with the proper hardware and settings, including remote wake-up via the Internet.
A portion of the network interface must remain on for Wake-on-LAN to function. In comparison to typical running power, this uses very little standby power. To conserve energy, the link speed is typically maintained at the lowest speed possible (a Gigabit Ethernet NIC, for example, only supports a 10 Mbit/s link). When not required, disabling wake-on-LAN can very slightly lower the amount of electricity used by computers that are turned off but still plugged into a power outlet.

Magic Packet

The magic packet is a frame that is typically sent as a broadcast and contains anywhere between 6 bytes of all 255 (FF FF FF FF FF in hexadecimal) in its payload, followed by 16 iterations of the destination computer’s 48-bit MAC address, for a total of 102 bytes.
Although it is typically sent as a UDP datagram to port 0 (reserved port number), port 7 (Echo Protocol), or port 9 (Discard Protocol), or directly over Ethernet as EtherType 0x0842, the magic packet can be sent as the payload of any network- and transport-layer protocol because it is only actually scanned for the above string and not parsed by a full protocol stack.
Since it necessitates creating an active connection before transferring user data, a connection-oriented transport-layer protocol like TCP is less suitable for this task.

The following fundamental restrictions apply to a normal magic packet:

  • MAC address of the destination computer is necessary (also may require a secure password)
  • Omits to give a delivery confirmation
  • The local network may not be compatible with it.
  • Needs the destination computer’s hardware to support Wake-on-LAN.
  • The majority of 802.11 wireless interfaces are unable to maintain links while in low power states and cannot accept magic packets.

Magic Packet Structure

The magic packet is a broadcast frame with a payload of up to 6 bytes of all 255 (FF FF FF FF FF in hexadecimal) at any point in its payload, followed by 16 iterations of the target computer’s 48-bit MAC address for a total of 102 bytes.
It is generally sent as a UDP datagram to port 0, 7, or 9, or directly over Ethernet as EtherType 0x0842, but as the magic packet is only checked for the aforementioned string and not parsed by a full protocol stack, it can be sent using any network and transport layer protocol.

Basic restrictions on a typical magic packet include the following:

  • Needs the MAC to address the destination computer (also may require a secure password).
  • No delivery confirmation should be given.
  • Outside of the local network, it might not function.
  • Requires the target machine to have Wake-On-LAN hardware capability.
  • The majority of 802.11 wireless interfaces are unable to receive magic packets and do not sustain a link in low-power situations.

The network interface card’s circuitry is designed to process the Wake-on-LAN implementation rapidly and with the least amount of power consumption possible. The need for a MAC address results in the meaninglessness of IP addresses and DNS names because Wake-on-LAN operates underneath the IP protocol layer.

The network interface card’s circuitry is built with the Wake-on-LAN implementation in mind, and it is intended to be very straightforward and rapid to process. The need for the MAC address arises from the fact that Wake-on-LAN functions below the IP protocol layer, where IP addresses and DNS names have no practical value.

Troubleshooting Magic Packets

Wake-on-LAN can be a challenging technology to install because it needs a compatible BIOS/UEFI, network card, and occasionally an operating system and router to work properly. Hardware may wake up from some low-power states but not from others in particular circumstances. This indicates that, as a result of hardware problems, the computer may wake up from the “soft off state” (S5) but not from sleep or hibernation, or vice versa. Additionally, it is not always obvious what kind of magic packet a NIC anticipates seeing.
In such a situation, software tools like a packet analyzer can assist with Wake-on-LAN troubleshooting since they enable verifying (while the PC is still on) that the magic packet is visible to a specific computer’s NIC. The computer can then be detected using the same magic packet to see if it comes online after being offline. This makes it possible to separate hardware problems from networking problems. In some circumstances, they can also display the packet’s internals and establish that the packet was sent to a broadcast address or was intended for a specific PC.
All wake sources are recorded by the operating system in the “System” event log as of Windows Vista. They can be retrieved using the Event Viewer and the powercfg.exe / last wake command.

How to Enable Wake-on-LAN on Your System

The OS sends signals to all the hardware to turn off when it shuts down. The network adapter must be kept on by the operating system for it to receive Magic Packet and start the computer. The process for doing so on Windows, Mac OS X, and Linux will be covered in this section.

Windows setup

The Device Manager in more recent iterations of Microsoft Windows incorporates WoL capability. This is accessible on the Power Management tab of the driver properties for each network device. Installation of the complete driver suite from the manufacturer of the network device may be required as opposed to the bare driver offered by Microsoft or the machine manufacturer to fully enable a device’s WoL features (such as the ability to wake from an ACPI S5 power off state). Correct BIOS/UEFI settings are typically also necessary for WoL to work.

window-setup
  1. Open Device Manager
  2. Locate your network adapter, then click Properties;
  3. Select Advanced;
  4. Locate Wake on Magic Packet and select Enabled (the option’s name may differ);
  5. Next, select the Power Management tab and turn on (if applicable) the following options:
  • Only permit a magic packet to wake the computer; permit this device to wake it.
  • Find the MAC address by running ipconfig /all and then looking for the Mac after the Physical Address (a tip if you don’t use Windows much). Be careful to check the settings of the appropriate physical network adapter.

Settings in Windows 8, 8.1, and 10

The Fast Startup function is available to users in the most recent versions of Windows. This functionality needs to be disabled because it is incompatible with WOL.
Launch Control Panel and select Power Options. Select the functions of the power buttons. Adjust the settings that aren’t working right now and disable Click Save changes after turning on rapid startup.

Mac OS X setup

When a Mac computer is shut off, it cannot be awakened. However, WoL functionality is supported by modern Mac hardware when the computer is in a sleep state.
The OS X System Preferences Energy Saver panel’s Options tab is where the feature is controlled. Wake-on-LAN is activated by checking the box labeled Wake for network connectivity.
There are shareware and freeware Mac OS X applications available, as well as Apple’s Apple Remote Desktop client management system, which can be used to transmit Wake-on-LAN packets.
The service is also known as Bonjour Sleep Proxy or Wake on Demand and is the same as the Sleep Proxy Service in Mac OS X Snow Leopard and later. In older operating systems, the service had to be turned on in the System Preferences Energy Saver pane; however, it is turned on by default. Service may be able to run exclusively via Wi-Fi, exclusively over Ethernet, or both depending on the network interface card.

To make WOL available on a Mac:

  1. Access the System Preferences;
  2. Access Energy Saver
  3. Allow network access by enabling wake. depends on the particular system because different systems can have different network adapters.
wol-on-mac

The MAC address can be found by:

  1. Open the System Preferences window;2. 22
  2. Find a network and start it;
  3. Select Hardware and then Ethernet or Wi-Fi adapter;
  4. Select Hardware from the menu, then copy the MAC address.
mac-address

GNU/Linux setup

A subfunction of the ethtool command can be used to modify wake-on-LAN support.
Generally speaking, Linux configuration can differ between distributions. Most of our suggestions will only be effective up until the first reset. They will assist you in testing this feature and determining whether your network adapter supports WOL. Following the official or community documentation for a particular Linux flavor and environment is the best way to make it permanent.

Requirements:

  • having root access; 
  • having a tool installed (typically by default); and – having an Ethernet identification like eth0 or enp3s0.

To check support for your card, open the terminal emulator and type:

#ethtool eth0 | grep Wake-on
Supports Wake-on: pg
Wake-on: d

Supports The supported modes are listed by wake-on. G is a necessary choice. The network adapter’s current state is displayed by wake-on. Type the following command to enable WOL:
‘# ethtool -s eth0 wol go

To find out the MAC address, type ifconfig and find it:

mac-address-by-ifconfig

Wake on wireless LAN

Except for the fact that Windows XP does not support this function, Intel Centrino-compliant network devices offer Wake on Wireless LAN (as explained in the drivers’ area on the official Intel website).
This functionality is compatible with Windows 7, Linux, and Mac OS X, and the installation process is the same as above. Just make sure the right device has Magic Packet enabled.

WOL over the Internet

WOL generally operates via the Internet. In many instances, everything depends on a certain network configuration, which naturally entails router settings.
Stock firmware frequently lacks advanced functionality and offers a small number of features. Firmwares that are customized and advanced offer more settings.
For firmware like DD-WRT or OpenWRT, we suggest adhering to official or community recommendations.

In general, WOL via the Internet will need:

  • Static IP address setup for your device; port forwarding setup to access the device behind NAT; 
  • setting a static IP address for your device; configuring port forwarding to access the device behind NAT;
  • configuring the router’s public IP address or dynamic DNS settings to access the router from the Internet.

As an alternative, it is feasible to connect to the router through SSH and then use the router’s WOL program to wake up the device;

Sending the Magic Packet

You can use a programming tool to send a Magic Packet. Users of Linux can use WOL (also possible to run on a router, but through an SSH channel).
Users of Windows may want to give WakeMeOnLan a try.
After everything has been set up, send the Magic Packet to test wake on LAN. Make sure you include the following details:

  • MAC address, 
  • IP or domain address,
  • subnet mask, and if required, port number.

Conclusion

  • Sending a Magic Packet to the designated address or addresses on the designated subnet enables you to wake up one or more hosts that are connected to a network but are currently in suspended mode.
  • Wake-on-LAN capability is built into the network interface card and motherboard of a computer, therefore it is not reliant on the operating system that is running on the hardware.
  • It can be confusing because the software that sends a WoL magic packet is referred to as both a “client” and a “server” in various contexts. While it’s debatable whether WoL hardware or firmware plays the part of a “server,” users frequently refer to Web-based interfaces that serve as a gateway so they can send WoL packets without downloading a local client as “The Wake On LAN Server.”
  • Wake-on-LAN is often disabled by default on most systems, however, on some, like Apple computers, it can be enabled in the Power Management section of the BIOS/UEFI setup program of a PC motherboard.
  • Wake-on-LAN can be a challenging technology to deploy since, to work properly, it needs the right BIOS/UEFI, network card, and, occasionally, operating system and router support.
  • The circuitry on the network interface card is designed to process the Wake-on-LAN implementation fast and with the least amount of power possible. IP addresses and DNS names are useless since Wake-on-LAN runs underneath the IP protocol layer, hence the MAC address is necessary.

Author