Kodama's home / tips.

Wake On Lan(WOL) tool/class for Ruby

Download: wakeonlan.rb.

Wake On Lan(WOL) means to wake up or power on remote PCs with LAN access using Magic Packet technology. The Maic Packet is a broadcast packet containing MAC address of PCs. See Magic Packet for more details. We need a list of MAC address(or Ether address) to make Magic Packets. See "making a list of ether address". See also "Wake On Lan(WOL) with ping comand".

Usage(as a command)

$ ruby wakeonlan.rb [broadcast_address] < data_text
Each line of data text is of the form "ip_address host_name MAC_address".
For example:
10.20.30.40 host1  101:102:103:104:105:106
10.20.30.50 host2  201:102:103:104:105:106
10.20.30.60 host3  301:102:103:104:105:106

Usage(as a class)

require "wakeonlan"
wol=WakeOnLan.new
wol.wake("101:102:103:104:105:106", "10.255.255.255", "10.20.30.40")
# args: MAC_address Broadcast IP_address
wol.close

C tool

See also Wake On Lan(WOL) with ping comand. This describes how to generate magic packet using "ping" command.

Send magic packet to other segment

See Send Magic packet to other segment.

Remote off

remote off tool
The followings are Japanese descriptions.
Ruby 言語で Wake On Lan が手軽に出来るクラスとツールを作成してみました. 手抜きな C 版もあります.(Wake On Lan(WOL) with ping comand)
Kodama's home / tips.