Linux Magic Packet Command Generator
Generate a native bash or zsh command that sends a Wake on LAN magic packet from Linux. Uses Python 3, Perl or bash /dev/udp, so you do not need to install wakeonlan or etherwake.
Input
Output
Readme
What is a Wake on LAN magic packet?
Wake on LAN turns on a sleeping or switched off computer over the network. Its network card stays powered and listens for a magic packet: 6 bytes of FF followed by the computer's MAC address 16 times, 102 bytes in all. It's usually sent as a UDP broadcast to port 9 or 7, so every machine on the local network gets it and only the matching one wakes up. Wake on LAN has to be turned on in the computer's BIOS or UEFI settings first.
Tools like wakeonlan and etherwake send it, but they aren't always installed, and on a server or NAS you may not want to add them.
Tool description
This tool writes a one line command that sends the packet with what Linux already has. Enter the MAC address of the computer to wake, as 00:11:22:AA:BB:CC, 00-11-22-AA-BB-CC, 0011.22AA.BBCC or 12 hex digits in a row, and pick how to send it under Send with:
- Python 3 or Perl, which work in bash and zsh, need no root access and can broadcast
- Bash /dev/udp, which needs nothing installed but only works in bash, not zsh, and can't broadcast
The Broadcast or IP address starts on 255.255.255.255 and the UDP port on 9. Linux answers "Permission denied" when bash sends to a broadcast address, so the tool warns you if you pick Bash with an address ending in .255. Use the computer's own IP address there instead.
The command is built in your browser. Copy it and run it on any Linux machine in the same network.
Examples
For 00:11:22:AA:BB:CC, Python 3 broadcasting on port 9:
python3 -c 'import socket;s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM);s.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1);s.sendto(bytes.fromhex("ff"*6+"001122aabbcc"*16),("255.255.255.255",9))'Bash, sent straight to the computer at 192.168.1.20:
printf "$(printf '\\xff%.0s' {1..6})$(printf '\\x00\\x11\\x22\\xaa\\xbb\\xcc%.0s' {1..16})" > /dev/udp/192.168.1.20/9Features
- Python 3, Perl and bash versions of the command
- Takes MAC addresses with colons, dashes, dots or no separators
- Warns when the bash version can't reach a broadcast address