# Wake-on-LAN

If your computer supports Wake-on-LAN (WOL), you can send a “magic packet” to wake it from a powered-down state. This is primarily supported on Ethernet connections.

---

1.  ## Identify network interface

    Find the name of your Ethernet adapter. Look for names starting with `e` (e.g., `eth0` or `enp3s0`).

    ```sh
    ip link show
    ```

2.  ## Install ethtool

    Install the utility required to manage network hardware settings.

    ```sh
    sudo apt update && sudo apt install ethtool -y
    ```

3.  ## Check support

    Verify if your hardware supports the magic packet. Look for `g` in the “Supports Wake-on” line.

    ```sh
    sudo ethtool $INTERFACE_NAME
    ```

4.  ## Enable WOL (temporary)

    Enable WOL manually to test the configuration. This setting will reset after a reboot.

    ```sh
    sudo ethtool -s $INTERFACE_NAME wol g
    ```

5.  ## Persist with systemd

    Create a service to ensure WOL is re-enabled automatically on every boot.

    ```sh title="/etc/systemd/system/wol.service"
    [Unit]
    Description=Enable Wake On Lan

    [Service]
    Type=oneshot
    ExecStart=/usr/sbin/ethtool -s $INTERFACE_NAME wol g

    [Install]
    WantedBy=basic.target
    ```

6.  ## Enable the service

    Reload systemd and enable the new service.

    ```sh
    sudo systemctl daemon-reload && sudo systemctl enable wol.service
    ```

7.  ## Send Wake-up packet

    From another device on the network, trigger the boot sequence using the target’s MAC address.

    ```sh
    wakeonlan $MAC_ADDRESS
    ```
