Mikrotik Cool Stuff HOW TO
Mikrotik RB750GL Running Package version 6.0rc11
If you have an L2TP/IPSec VPN setup or SSTP how about writing a script to Wake up your Workstation at your office or home or how about waking up your ESXi 5.x Hypervisor Server or how about waking up your NAS so you can pull a few files from it and shut id down when done.
I run test servers and real servers on my VMWare ESXi 5.x Hypervisor. Recently I setup a Windows 2012 Server and one Exchange 2013 server on it. Instead of leaving my ESXi server running 24/7 I thought… why not just use WOL (Wake on Lan) to wake it up, start the test servers or servers I need access to so I can test the Exchange or test an Ubuntu server or whatever I need from the internet.
Well VOILA in comes Mikrotik scripting.
Since I have L2TP setup and SSTP I can logon with my phone or use SSTP or L2TP if I am at a windows 7 station. I log into my Mikrotik via the VPN and use the Mikrotik Scripts to Wake up whatever server, workstation or NAS that I need to get access to. Lets face it. I wish I could run my NAS, ESXi Server and my Workstations and all my other servers 24/7 but since I work out of a home office the power bill gets a bit high these days.
Here we go:
Log into your Mikrotik and in the left side menu click on System
From the Pop up list chose Scripts
From the Scripts TAB
Name: type in the name of your script here
Keep this short and sweet as if you will be using this on a phone using something like the iSSH app on an IPhone running the script will take less typing 😉
NOTE: you can also run the script by its number but I use descriptive names so I never have to print the list to see what number a certain script is.
When making up the name I use names like wakemyws to mean Wake My Workstation or wakeesxi to Wake my ESXi server or wakemynas to Wake My NAS.
After creating the name leave the Policy settings alone or change to what you want. Down below in the Source: is where the magic happens.
In the Source: box create a line like this:
tool wol interface=ether2-master-local mac=00:00:00:00:00:00
Lets go over it:
tool wol – Is the Mikrotik WOL TOOL command line command
interface=ether2-master-local – interface is the Interface on your Mikrotik that you want the WOL to be sent from
mac=00:00:00:00:00:00 – mac will be the MAC address of YOUR Server, NAS or device that you want to send a WOL packet to so that you can start it up from a powered off state.
Note: Your system or device must be enabled or able to use WOL to wake up. See your BIOS or device documentation for these settings or support.
Now that your device is booted up and you have a VPN connection running to your office or home you can open a windows explorer box and connect to a servers share, RDP to a server, or make connections to devices on your home or office network via the VPN as if your were locally there.
Silly… is that what VPNs are for…. hmmmm…
Example of Connecting to a windows share over the VPN:
Open windows explorer if you are on a windows box
Type in the IP address and share name of a windows box you have something shared out
Type this in the address bar in windows explorer. After a bit you should be prompted for a username and password. Use your windows username and password that you use on that machine to sign into it.
Hope you enjoyed this Tutorial