Setting up the feature of WoL – meaning: Wake on Lan – on a QNAP server, can sometimes be difficult for people.
Several years ago, a guy named Pete Thomas, wrote a nice script for the exact purpose of WoL’ing. I just changed the variables as described here:
1. First of all, enable WoL in the “System Settings” menu tab “Power” and shut down the server.
2. Download the php source for the wake-up script here and rename it from .txt to .php (press here)
3. Edit the script so it match your specific system (see further down below).
You need the following info for the server:
A) MAC address
B) LAN IP address
C) WoL port number (for QNAP it is port 7)
D) A Port number for checking if the server is awake (I recommend 8080 on QNAP)
E) A descriptive name for the sleeping server.
Now execute the script from anywhere in the LAN and your server will boot.
##################################################
## php WoL with port check – PRThomasUK. ##
## blog.pete-thomas.me.uk ##
##################################################
//
// ################## user variables… ##################
// Friendly name for device, example “My Computer”.
$device = “Write a name identifying your server”;
// IP address of device, example “x.x.x.x”.
$deviceip = “the internal LAN ip address of your server”; e.g. “192.168.1.1”
// TCP Port on device to check, example “3389” = RDP, “80” = WebServer.
$deviceport = “port no.”; e.g. “8080”
// MAC address of NIC1 on device, example “00:00:00:00:00:00” or “00-00-00-00-00-00”.
$devicemac1 = “The MAC address of the LAN card in your server”; e.g. “00:08:9a:8a:12:01”;
// MAC address of NIC2 on device, example “00:00:00:00:00:00” or “00-00-00-00-00-00”. – Optional set to “” if NIC2 not required.
$devicemac2 = “”;
// Number of times to attempt to connect to port on device after magic packet sent, example “10”
$maxtries = “10”;
// Broadcast address of network, example “”x.x.x.x”. (“255.255.255.255” works in most cases.)
$broadcast = “255.255.255.255”;
// ICMP port number, default “7”.
$udport = “7”;
// Timeout value for re-tries (in seconds), default “10”.
$timeout = “15”;
// #######################################################
Do not change anything else….