Over the past month, our development team has been hard at work delivering a host…
MikroTik WoL – Wake on Lan Magic Packet
Hey guys, if you’ve never heard of WoL, or Wake on LAN, it’s a very cool protocol that allows you to turn on – or wake up – a computer from sleep mode over the network with a special packet, sometimes referred to as a magic packet.
In this post we’ll show you how to use your MikroTik to send a magic packet to wake up your machine and turn it on, just like if you’d hit the power button yourself. And don’t worry – it’s incredibly easy!
How it works
When you tell your MikroTik to send a WoL packet to the network, it sends a broadcast frame out on the wire of the interface you tell it to filled in with the MAC address of the device you want to wake up. Then a packet gets generated and sent onto the network where your devices will see that packet/frame. All the devices that aren’t the destination MAC just silently ignore the frame, but the computer whose MAC address matches their network interface will hit the virtual power button and wake up, power on and resume operations (as long as the WoL feature exists in the BIOS and hardware and is enabled – oftentimes it is by default).
How to use it
Open WinBox and navigate to TOOLS — WOL and the Wake on LAN dialogue will open. At this point, just plug in the MAC address you want to wake up, pick the interface that the MAC is attached to (usually this is something like “bridge”) and hit the Wake on LAN button. That’s it! Within seconds your machine should be turning on and resuming operation – pretty cool, right?
CLI
/tool wol interface=bridge mac=F8:28:19:9A:59:2F
TIPS
If you’re not sure what MAC address you want, a couple of tricks I use are:
- Check the ARP table
- Check DHCP leases
- Google the OUI (First 6 digits of the MAC)
As an example, let’s say I wanted to wake up my laptop named Marc-Nitro5, seen below in the ARP table. Navigate to IP — ARP and then double-click on the row that has the host (or computer) you want to wake up. You’ll get the MAC address (which you can highlight and copy) and the INTERFACE you need to send the correct WoL – fantastic!
Using IP — DHCP SERVER you can click on LEASES, find the record for the machine you want to wake up, and double-click it to highlight and copy the MAC address. Depending on your version of ROS and whether you’ve made your leases static or have a long (or short) lease duration, this one may or may not be as helpful.
Finally, I like to use the Wireshark OUI lookup tool here: https://www.wireshark.org/tools/oui-lookup.html, but you can use whatever OUI lookup tool you’d like. An OUI is the first half of a MAC address, and every network interface vendor has registered their OUI with IEEE so you can get a good guess on what a device is if you really have no clue whether F8:28:19… is the right MAC to send a packet to.
Here’s an example from a few devices on my network. You just copy and paste some MAC addresses into the text box, hit FIND and then the OUI lookup will tell you who that OUI is registered to. Note: the results on this lookup tool show up in reverse order!
Using Admiral Platform WoL
Admiral Platform can help!
One of our customers loses power regularly because of brownouts as well as planned blackouts of power and asked us to make an easy button in our dashboard so that customer service folks would be able to remotely and virtually push the WoL button to turn on various computers and screens without the risk (or training) of access to Winbox.
In addition, because Admiral management tools work even behind NAT and with private IPs, no public IPs are needed for this functionality. If you want to use the WoL feature in Admiral, head over to ROUTER HEALTH and pick the MikroTik you want to generate your magic packet and click the WoL tab in the middle.
When you click the row – highlighted in grey here – the MAC address will automatically fill in for you. Then you can verify or manually enter the MAC, verify the bridge (or change it by clicking the dropdown) and finally hit SEND when you want to wake up your device.