Wake on LAN wol設定

http://d.hatena.ne.jp/pochio_pochiyama/20110620/p2
http://d.hatena.ne.jp/ichiro_tanaka/20090505/1241530936
https://help.ubuntu.com/community/WakeOnLan
http://www.intel.com/jp/support/motherboards/desktop/sb/CS-022309.htm

WOLで起動したいマシンに設定を行う
1.BIOS等で"Wake On LAN(WOL)"を有効にする
2.Ubuntuを起動しインターフェースの設定を行う
"ethtool"のインストールをして、WOLを有効にしたいNIC/Portの設定に "ETHTOOL_OPTS="wol g"" という設定を追記する
$ sudo apt-get install ethtool
$ sudo ethtool -s wol g
$ sudo gedit /etc/network/interfaces

        • -

auto eth0
iface eth0 inet static
address 10.0.0.1
netmask 255.255.255.0
gateway 10.0.0.138
up ethtool -s eth0 wol g

        • -

3.NIC再起動
$ sudo service networking restart
$ sudo ethtool ethX
Supports Wake-on: pumbg <- こんな感じのそれっぽい出力がある事を確認
Wake-on: g
4.MACアドレスを確認しておく
リモートから起動する際に"MACアドレス"を指定する必要があるので確認しとく
$ ifconfig eth0
=> ハードウェアアドレス XX:XX:XX:XX:XX:XX という出力内容をメモしとく
5.シャットダウンする
$ sudo shutdown -h now
又は
適当にGUIからシャットダウン

リモートからWOL設定済みのPCを起動する端末に設定を行う
"wakeonlan"パッケージを導入して起動テストする。MACアドレスは先にメモしてものを指定する
$ sudo apt-get install wakeonlan
$ wakeonlan -i 192.168.1.255 00:1a:2b:3c:d4:e5
Sending magic packet to 192.168.1.255:9 with 00:1a:2b:3c:d4:e5
wakeonlan -i Bcast MACアドレス

WANの場合

wakeonlanコマンドは特に指定がない場合のデフォルト値ではUDPの9番が使われているらしいのでこの9番(か指定の空いているポート)を192.168.1.255にポートフォワードしてもらう。

対象をブロードキャストアドレスではなく、グローバルIP(が設定してあるドメイン)宛に。

$ wakeonlan -i mydomain.com 00:1a:2b:3c:d4:e5
Sending magic packet to mydomain.com:9 with 00:1a:2b:3c:d4:e5

                                                                                                                                                              • -

上記設定はnetworkmanagerがインストールされている場合上手く行かないことが有る。

https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/317303

The Wake On LAN function is set on with:

sudo ethtool -s eth0 wol g

After some test, the only way to make Wake On LAN work is to set "NETDOWN=no" in /etc/init.d/halt and to kill the NetworkManager processus before halting the system.

Without that, the ethernet adapter is completly shut down and can't receive the "wol magic packet".



https://mail.gnome.org/archives/networkmanager-list/2007-June/msg00293.html


Wake On LAN has to be enabled in the BIOS for all this to work anyway,
right. But you still have to enable it from software, because it is
disabled by default with most cards AFAIC. The actual handling of the WOL
signal, and the waking up is still handled by the hardware itself.

What the methods do are actually just frontending ethtool. They just
enabling WOL on the network card. Another system has to send the so called
MagicPacket to wake up the system afterwards.

getWakeOnLanEnabled --> ethtool eth0 | grep "Wake-on"
getWakeOnLanSupported --> ethtool eth0 | grep "Supports Wake-on"
setWakeOnLanEnabled --> ethtool -s eth0 wol umbg


Right, this doesn't entirely has something to do with "managing networks",
it's just something that has to be done with each network interface the
system has.

                                                                                                                          • -

古いMotherBoard(特にIntel D865GLC)BIOSの設定の中に「Wake up on Lan」ではなく「Wake up on PCI PME」しかない場合

ハマりました:ポイントは「Wake up on PCI PME」自体の設定ではなく、

1.Advaced→Plug and Play OSをYesに設定
2.Power→ACPI(Wake up on PCI PME寄り先に)→ACPI Suspend Mode [S5 state] && Wake up on LAN [Power on]
を選択する。

すると、「Wake up on PCI PME」は自動的にPower onになります。