Recent Posts

Archives

Topics


« | Main | »

Using the ReadyNAS as a Wake-on-LAN Device

By dbott | January 30, 2010

At work, I occasionally have the need to do some computer updates at remote locations.  Under normal circumstances, I can use Windows Group Policy to update/install software, however, not every application supports installation via GPO. There are commercial products that you can pay for and license that makes managing a number of devices at multiple locations quite easy, but of course, it requires something that we don’t have a lot of: money.

Additionally, many of our public access terminals have security software installed that prevents software from being installed or automatically rolls-back the machine to a known state after each reboot. In order to allow software to be installed/updated, the security software must be disabled.

Using the ReadyNAS as a wake-on-lan device requires a few things:

At work, I have written a few scripts that allow me to wake the PCs at my remote sites.  The basic process is as follows:

1. SSH into branch NAS:

- ssh root@192.168.129.2 for Grantham-NAS
- ssh root@192.168.131.2 for Merritt-NAS

2. At the command prompt type:

wakeonlan -f /backup/utilites/wakeonlan/grantham.wol
wakeonlan -f /backup/utilites/wakeonlan/merritt.wol

The grantham.wol and merritt.wol files are just text files that I wrote up that contain the MAC address (00:13:72:xx:xx:xx), subnet broadcast address (192.168.129.255) and port number (7) as well as some comments (#) for each PC on the network:

Epsilon:/backup/utilities/wakeonlan# cat grantham.wol

# Mac Address       IP-Address  Computer Name
# GRAN_CIRC1
00:13:72:xx:xx:xx       192.168.129.255 7
# 192.168.129.59
# GRAN_CIRC2
00:13:72:xx:xx:xx      192.168.129.255 7
# 192.168.129.62
# GRAN_CIRC3
00:13:72:xx:xx:xx   192.168.129.255 7
# 192.168.129.65

Other notes:

I also use the ReadyNAS as a DHCP server.  I have another write-up here that offers some insight on how to do it, as well as add additional options, such as static leases.  If you’re already using the ReadyNAS as a DHCP server, you can utilize some commands to get useful information for your script, such as the MAC address:

1. Viewing active leases to get the MAC address:

Grantham-NAS:~# dumpleases -f /var/lib/misc/udhcpd.leases
Mac Address       IP-Address      Expires in
00:13:72:xx:xx:xx 192.168.129.55  6 days, 20 hours, 31 minutes, 0 seconds
00:13:72:xx:xx:xx 192.168.129.53  6 days, 18 hours, 34 minutes, 16 seconds
00:13:72:xx:xx:xx 192.168.129.54  6 days, 6 hours, 10 minutes, 39 seconds
00:13:72:xx:xx:xx 192.168.129.67  6 days, 18 hours, 51 minutes, 49 seconds
00:13:72:xx:xx:xx 192.168.129.56  6 days, 18 hours, 41 minutes, 46 seconds
00:13:72:xx:xx:xx 192.168.129.71  6 days, 18 hours, 53 minutes, 48 seconds
00:13:72:xx:xx:xx 192.168.129.61  6 days, 23 hours, 52 minutes, 47 seconds
00:13:72:xx:xx:xx 192.168.129.73  6 days, 23 hours, 45 minutes, 6 seconds
00:13:72:xx:xx:xx 192.168.129.58  6 days, 23 hours, 36 minutes, 4 seconds
00:13:72:xx:xx:xx 192.168.129.69  6 days, 23 hours, 13 minutes, 45 seconds
00:13:72:xx:xx:xx 192.168.129.70  6 days, 23 hours, 32 minutes, 28 seconds
00:13:72:xx:xx:xx 192.168.129.50  6 days, 18 hours, 40 minutes, 26 seconds
00:13:72:xx:xx:xx 192.168.129.51  6 days, 18 hours, 40 minutes, 3 seconds
00:13:72:xx:xx:xx 192.168.129.66  6 days, 6 hours, 31 seconds
00:13:72:xx:xx:xx 192.168.129.63  6 days, 18 hours, 41 minutes, 17 seconds
00:13:72:xx:xx:xx 192.168.129.52  6 days, 1 hours, 34 minutes, 0 seconds
00:13:72:xx:xx:xx 192.168.129.57  6 days, 20 hours, 9 minutes, 46 seconds
00:13:72:xx:xx:xx 192.168.129.62  6 days, 23 hours, 4 minutes, 5 seconds
00:00:00:00:00:00 192.168.129.59  expired
00:00:00:00:00:00 192.168.129.60  expired
00:13:72:xx:xx:xx 192.168.129.64  expired
00:13:72:xx:xx:xx 192.168.129.65  6 days, 23 hours, 24 minutes, 4 seconds

2. I also temporarily updated the udhcpd.conf file with auto_time 60 to update the lease file to every minute while testing.

Grantham-NAS:~# cat /etc/udhcpd.conf
# This file is auto-generated.  Do not modify!
auto_time       60
interface       eth0
option wins     192.168.128.25
option dns      192.168.128.25
option dns      192.168.128.35
option domain   mydomain.ca
option lease    604800
option subnet   255.255.255.0
option router   192.168.129.1
start   192.168.129.50
end     192.168.129.199

3. Getting MAC addresses from within Windows:

From command line type “getmac /s computername

C:\>getmac /S gran_circ1

Physical Address    Transport Name
=================== ==========================================================
00:13:72:xx:xx:xx   \Device\Tcpip_{0E96113B-5F1C-4200-8F81-4D0E83E39AE1}

At this point, the computers will begin to boot and I use open-source tools such as VNC and iTALC to remotely control the computers and disable any security software.

Topics: Ramblings | 3 Comments »

3 Responses to “Using the ReadyNAS as a Wake-on-LAN Device”

  1. Hacking the ReadyNAS DHCP Server | The Bott Blog Says:
    January 30th, 2010 at 12:13 pm

    [...] Using the ReadyNAS as a Wake-on-LAN Device [...]

  2. Using the ReadyNAS as a Wake-on-LAN Device | The Bott Blog | Drakz Free Online Service Says:
    January 31st, 2010 at 3:42 pm

    [...] here: Using the ReadyNAS as a Wake-on-LAN Device | The Bott Blog Share and [...]

  3. Unofficial ReadyNAS Getting Started Guide | The Bott Blog Says:
    February 2nd, 2010 at 1:01 pm

    [...] Using the ReadyNAS as a Wake-on-LAN Device [...]

Comments

Spam Protection by WP-SpamFree