Wol
Prerequisites for Wake-on-LAN (WoL):
- Motherboard & BIOS Support: Enable WoL in BIOS/UEFI settings.
- Network Interface Card (NIC) Support: NIC must support WoL; enable it in device properties.
- Ethernet Connection: WoL typically requires a wired Ethernet connection.
- Power Supply: System should provide standby power (S5 state) to the NIC.
- Network Configuration: Correct MAC address, subnet, and port settings for the Wake-on-LAN packet.
- Software: Tool to send the “magic packet” (e.g., Depicus, WakeMeOnLan).
Ensure proper configuration on the OS (e.g., Windows, Linux).
- Enable WoL on Target Device:
- Access BIOS or OS settings of the target device.
- Enable “Wake on LAN” (WoL).
- Install Required Package on OpenWRT:
opkg update opkg install etherwake - Send WoL Packet from OpenWRT:
etherwake -b <MAC_ADDRESS>Replace
<MAC_ADDRESS>with the target device’s MAC address. - Automate WoL Using OpenWRT Web UI (Optional):
- Go to System > Startup.
- Add a new script to send WoL command on startup. Example:
/usr/bin/etherwake -b <MAC_ADDRESS>
- Ensure Network Setup:
- Target device must be connected to the same subnet.
- Proper forwarding/routing if WoL is sent across subnets.
- Alternative: Web Interface WoL Plugin
- Install
luci-app-wol:opkg install luci-app-wol - Access via Services > Wake on LAN on the OpenWRT web UI.
- Install
To execute the etherwake command via SSH, you can set up an alias or use the ProxyCommand option in the .ssh/config file. Here’s how:
- Edit
.ssh/config:vim ~/.ssh/config - Add the Following Configuration:
Host wol-alias HostName <OpenWRT_IP> User <OpenWRT_Username> RemoteCommand /usr/bin/etherwake -b <MAC_ADDRESS> ExitOnForwardFailure yes - Usage:
ssh wol-alias
Explanation:
Host wol-alias: Create a custom alias (wol-alias) for the command.HostName: IP address of your OpenWRT device.User: Username to log in to OpenWRT.RemoteCommand: Executes theetherwakecommand when you SSH intowol-alias.ExitOnForwardFailure: Ensures the session exits after the command runs.
Note: Replace <OpenWRT_IP>, <OpenWRT_Username>, and <MAC_ADDRESS> with actual values.