Wake On LAN(WOL)とは
Wake On LAN(WOL)とは停止したパソコンを遠隔操作で起動できる技術のことです。最近は停止したPCをスマフォで起動させるのがぼく的ブームになっております。
これまでML110G5にHDDをどっさりのせて(最大4基のる)、ファイルサーバとして常時起動で使っていましたが、政府の節電要請がありましたので、停止することにしました。あまり使っていないネットブックがあったので、それをファイルサーバにして、サーバはお役御免・こいつは晴れてデスクトップマシンとして使うことになりました。
ただ、もともと常時起動のため、起動停止を考慮しない設置になっておりまして、ようはタンスの上に設置してあり、電源を手動でつけたり消したりがとても面倒なのです。ここでWOLの出番! とても快適に電源ONができるようになりました。
iphoenやAndroidアプリからマジックパケットを飛ばしてやると、コンマ数秒でPCがブオーンと爆音をたて起動しだします。インターネット経由(WiMAXのポケットWifiでテスト)でも1秒もかからず起動できた。すごい、便利過ぎる。
外出先からでもできる(インターネット経由)ってのが便利すぎる。仕事から帰ってすぐパソコン使いたい時とか、家の前についたらアプリで「ピッ」とやれば、家に入ったころには起動が済んでおり、リビングのドアをあければ、いつもの魔法少女たちがお出迎えというわけです。素晴らしすぎる!
環境
手順
- PCのBIOS確認
- 起動時にF10を押してBIOSに入る
- デフォルトで「Wake on LAN ENABLE」になってた
- OSの設定確認
- MACアドレスの確認
- ifconfig eth0 で確認(表示例)
- MACは後ほどアプリ側で必要になるので控えておく。
- ルータでポート開ける(ルータによってやり方違うと思う)
- Ubuntuを停止(ハイバネート)
- Ubuntu停止ボタンでハイバネートを押すか
- コマンドで 「sudo pm-hibernate」と打つ(pm-hibernateのman抜粋)
- 完全に沈黙するまで待つ
- 以下のアプリで遠隔起動のテスト
注意事項
動作確認したアプリ(Android)
- WoL Wake On Lan Wan(無料) : android market
- LAN内、インターネット越しでもOK。完璧
- WOLショートカット(無料): android market
- LANOK,インターネット越しはなぜかうまく行かなかった。
動作確認したアプリ(iPhone)
動作確認したアプリ(Windows7のノートPC)
- MagicSend-1_01:http://www.ex-group.jp/newpage/software00.html
- LAN内でのみ確認
コマンド実行例
saber:/# ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: g Wake-on: g Current message level: 0x000000ff (255) drv probe link timer ifdown ifup rx_err tx_err Link detected: yes
- ifconfig eth0 (ハードウェアアドレスがMACです)
kk@saber:~$ ifconfig eth0 eth0 Link encap:イーサネット ハードウェアアドレス 00:22:64:XX:XX:XX inetアドレス:192.168.XXX.XXX ブロードキャスト:192.168.XXX.XXX マスク:255.255.XXX.XXX UP BROADCAST RUNNING MULTICAST MTU:1500 メトリック:1 RXパケット:982 エラー:0 損失:0 オーバラン:0 フレーム:0 TXパケット:980 エラー:0 損失:0 オーバラン:0 キャリア:0 衝突(Collisions):0 TXキュー長:1000 RXバイト:881233 (881.2 KB) TXバイト:188020 (188.0 KB) 割り込み:17
NAME
pm-action - Suspend or Hibernate your computer
SYNOPSIS
pm-hibernate [--help]
pm-suspend [--quirk-*] [--help]
pm-suspend-hybrid [--quirk-*] [--help]
DESCRIPTION
This manual page documents briefly the pm-action, pm-hibernate, pm-suspend
and pm-suspend-hybrid commands. This manual page was originally written for
the Debian(TM) distribution and has been adopted by the pm-utils project.
These commands can be used to put the machine in a sleep state. The precise
way how this is done can be influenced by installing executables and
configuration snippets. For some options external programs are needed.
These commands will usually be called by UPower or hald when triggered to do
so by a program in a desktop session such as gnome-power-manager. Calling
them from the command line is also possible, but it is not guaranteed that
all programs in your desktop session keep working as expected.
pm-suspend
During suspend most devices are shutdown, and system state is saved in
RAM. The system still requires power in this state. Most modern systems
require 3 to 5 seconds to enter and leave suspend, and most laptops can
stay in suspend mode for 1 to 3 days before exhausting their battery.
pm-hibernate
During hibernate the system is fully powered off, and system state is
saved to disk. The system does not require power, and can stay in
hibernate mode indefinitely. Most modern systems require 15 to 45 seconds
to enter and leave hibernate, and entering and leaving hibernate takes
longer when you have more memory.
pm-suspend-hybrid
Hybrid-suspend is the process where the system does everything it needs
to hibernate, but suspends instead of shutting down. This means that your
computer can wake up quicker than for normal hibernation if you do not
run out of power, and you can resume even if you run out of power.
s2both(8) is an hybrid-suspend implementation.