Power Management
Wake offline target PCs remotely using Wake-on-LAN.
Overview
Nefia's power management supports remote wake-up via Wake-on-LAN (WoL). You can wake target PCs that are asleep or powered off through an agent on the same subnet.
Wake-on-LAN
Basic Usage
nefia power wake web-01Flags
| Flag | Description | Default |
|---|---|---|
--proxy | Explicitly specify a proxy agent | Auto-selected |
--wait | Block until the host comes online | false |
--timeout | Timeout for --wait | 60s |
Automatic Proxy Selection
When --proxy is not specified, an online agent on the same /24 subnet as the target is automatically selected. The target host's local IP information is obtained from metadata collected during enrollment.
# Auto-selection
nefia power wake db-01
# Explicit specification
nefia power wake db-01 --proxy web-01Waiting for Online Status
When the --wait flag is used, WireGuard peer handshake status is polled at 5-second intervals until the host comes online.
nefia power wake db-01 --wait --timeout 120sA host is considered online if its handshake occurred within the last 3 minutes.
MAC Address Resolution
MAC addresses are resolved in the following priority order:
host.mac— Manually specified in the configuration filehost.meta.mac_addresses[0].mac— Automatically collected during enrollment
How It Works
nefia power wake <host>
1. Resolve MAC address
2. Select proxy agent (same /24 subnet)
3. Execute `nefia-agent wol --mac <MAC>` on the proxy via SSH
4. Broadcast Magic Packet (102 bytes) via UDP (255.255.255.255:9)
5. If --wait is set, monitor WireGuard handshakeMagic Packet Format
| Bytes | Contents |
|---|---|
| 0-5 | 0xFF × 6 (broadcast marker) |
| 6-101 | MAC address (6 bytes) × 16 repetitions |
Prerequisites
To use Wake-on-LAN:
- WoL must be enabled in the target PC's BIOS/UEFI
- The network adapter must support WoL
- At least one online agent must be on the same subnet
- The target's MAC address must be recorded in the configuration or metadata
Remote Reboot and Shutdown
In addition to waking hosts, Nefia can reboot or shut down remote hosts.
CLI
# Reboot a host
nefia power reboot --host my-pc
# Shut down a host
nefia power shutdown --host my-pcMCP Tools
| Tool | Description |
|---|---|
nefia.power.wake | Wake a sleeping host via Wake-on-LAN through a proxy agent on the same subnet. |
nefia.power.reboot | Reboot a remote host. Requires confirmation or --yes flag. |
nefia.power.shutdown | Shut down a remote host. Requires confirmation or --yes flag. |