sWOLcmd version 1.0
sWOLcmd is a program used for remotely turning on (waking up) a computer by sending a special frame called a Magic Packet. This technology is known as Wake On LAN or Magic Packet Technology. The program operates from the command line, so it does not have a graphical interface, and you need to enter some parameters. The advantage is that it can be used in various scripts.
Waking up a computer usually works without problems within the same subnet. This application also works when the target computer is in a different subnet, theoretically even over the internet, but several conditions must be met (see below).
Download the application for 32-bit Windows sWOLcmd (compressed using ZIP).
The official page for the program is Samuraj Wake On LAN Command Line - sWOLcmd application
You can also check out:
- What everyone needs to know - using sWOLcmd
- What everyone needs to know - in which situations to enter which parameters
- For the curious - how sWOLcmd works
- For those who really want to understand - all about Wake On LAN
- License
Using sWOLcmd
The basic requirement is that the target station has Wake On LAN enabled and is in soft shutdown. This means that the network card is powered even when the computer is off and is set to Magic Packet mode. And of course, it must be connected via the network (Ethernet) to the station where we are running this application.

The application is run from the command line and can use one or more parameters. You always need to enter at least the MAC address of the station you want to wake up.
Note: The MAC address is used to identify the station because it is stored in the memory of the network adapter.
The application call looks like this:
swolcmd -m MAC_address [-i IP_address] [-s subnet_mask] [-p UDP_port] [-c compact_mode]
Possible parameters are:
- -m MAC_address [mandatory] MAC address of the target computer. It consists of 6 hexadecimal numbers (00 to FF), which can be separated by - : . or nothing.
- -i IP_address [optional] IP address of the target computer. Used if the computer is in a different subnet, in which case it needs to be entered together with the mask. It is entered as 4 decimal numbers (0 to 255) separated by dots.
- -s subnet_mask [optional] Subnet mask of the target computer, in dot-decimal form (4 decimal numbers separated by dots) or CIDR (/number_of_ones_bits).
- -p UDP_port [optional] The Magic Packet is sent as UDP, here you can enter any port 0-65536. The default is 9.
- -c compact_mode [optional] To increase the likelihood of waking up the computer, sometimes up to 3 different frames (packets) are sent. Setting -c 1 always sends only one. The default is 0 (off).
In which situations to enter which parameters
The basic distinction is whether the target station is in the same subnet as the station where we use sWOLcmd.
Stations are in the same subnet
Broadcast is used, just enter the MAC address of the target station.
D:\sWOLcmd>swolcmd -m 00:1f:c6:4f:63:f9
Stations are in different subnets
Directed broadcast is used to the target subnet, but this method must be enabled on the last router in the path. We can either calculate the broadcast address of the subnet ourselves and enter only the MAC address and IP address.
D:\sWOLcmd>swolcmd -m 00:1f:c6:4f:63:f9 -i 192.168.10.255
Or let the application calculate the address, then we need to enter the MAC address, IP address (which the target station last had, but any from the same subnet is sufficient), and the subnet mask.
D:\sWOLcmd>swolcmd -m 00:1f:c6:4f:63:f9 -i 192.168.10.15 -s 255.255.255.0
The mask can be entered not only in the traditional decimal notation with dots but also using CIDR (number of ones bits in the mask).
D:\sWOLcmd>swolcmd -m 00:1f:c6:4f:63:f9 -i 192.168.10.15 -s /24
Stations are in different subnets - special situation
In some cases, another method can be used, which is to send the Magic Packet using unicast. This bypasses the problem of allowing directed broadcasts on the router, but there is a problem with the expiration of the ARP cache on the router. When the ARP record for the station we want to wake up is deleted on the router, the method stops working. The call is made by entering the MAC address, IP address, but not the mask.
D:\sWOLcmd>swolcmd -m 00:1f:c6:4f:63:f9 -i 192.168.10.15
How sWOLcmd works
A few details about how sWOLcmd is programmed. First, it should be noted that this application is not very efficient, mainly in terms of file size. It is written in PHP and then converted to an executable file using the Bambalam PHP EXE Compiler/Embedder 1.21. PHP is not exactly a language for such purposes, but it is easy to use and the application works correctly.
The application constructs a packet for sending. The data content uses the target MAC address. Next, the IP addresses are set at the 3rd layer of the OSI model. The source is added automatically. The target is set to the broadcast address 255.255.255.255 in the local case. If the target IP address and mask are specified, the subnet broadcast address is calculated and used. If only the IP address is specified, the packet is sent as a unicast directly to this address.
MAC addresses within the frame (2nd layer of the OSI model) are set automatically at the lower network layer. In the case of a local broadcast, FF:FF:FF:FF:FF:FF is used. In the case of a directed broadcast or unicast, the MAC address of the router (gateway) is used. If the directed broadcast is aimed at the current subnet, it is immediately converted to a normal broadcast.
By default, the application tries to use as many methods as possible (unless the -c 1 switch is used) to increase the likelihood of waking up the station. So in the case of a directed broadcast, a local broadcast is also sent (in case the target station is in the same subnet), a unicast (if there is still an ARP record on the router, bypassing the problem of allowing directed broadcasts), and finally the planned directed broadcast.
All about Wake On LAN
I have described the entire Wake On LAN technology in detail, including all variants and many issues, on my website in the article Wake on LAN - local and remote subnet.
Related network theory can be found in the articles:
- TCP/IP - model, encapsulation, packet vs. frame
- TCP/IP and Ethernet - network path, active network elements
- TCP/IP - data transmission methods
- TCP/IP - addresses, masks, subnets and calculations
- TCP/IP - finding MAC address to IP - ARP
License
The sWOLcmd program is provided for free as freeware. It can be freely distributed and used in both commercial and private sectors. At the same time, this program is provided without any warranty.
Vzbudim pocitac s neverejnou IP adresou?
Zdravím, s probuzením počítače v jednom subnetu problem nemam, ale pokud ho chci probudit přes internet, protože je za routerem. Zkoušel jsem zadávat v parametrech příkazů různé MAC, IP i masky, ale nepodařilo. V nastaveni routeru jsem povolil port 9 pro příslušnou lan IP. Co je nutné ještě nastavit a jak. Protože když je počítač vypnutý delší dobu, adresa už není v tabulce a router neví, kam má vlastně paket přesměrovat. Díky za radu.
to Jiří, podle mého je dobré mít na routeru DHCP, pak tuto informaci bude mít stále. Mám nastaven port forwarding a wake-up funguje. MAC adresa musí být toho cílového PC.
Mam za routerem nastavenou pevnou IP ..na routeru (Dlink) nastaveno DMZ. Probudim pres net jen kratce po vypnuti jinak to nejde. Nasel jsem skulinu tak, ze pres webove rozhrani rebootnu router a PC se pak probudi. Stale hledam reseni. Prijde mi to jako ze router neudrzi napajeni do sitovky, jinak si to nedovedu vysvetlit.
Pokud se s tim nekdo setkal a vyresil pls napovezte :D
respond to [4]DJ:
Chvili po vypnuti.. to by mohl byt nejaky arp timeout. V pripade unicastu by pak router nevedel kudy to ma poslat ven? Nepomohlo by to zkusit uz v danem subnetu poslat jako multicast? - jen hadam
Na obyčejných SOHO routerech to obvykle nefunguje - chybí funkce statické ARP zápůjčky nebo možnost spouštět linuxové skripty a webserver. Pokud je Váš router podporován DD-WRT, můžete si vše potřebné přidat. Nejjednodušší je statické ARP a je na to oficiální návod. Alternativně je možné rozchodit webserver s PHP a ten použít jako "bránu" do místního segmentu. Ale to je daleko složitější.