I have two systems. One is my HTPC and the other is my notebook (both running slackware as usual). Both system are connected via my home router. My HTPC is connected directly via lan cable to my home router and my notebook is connected to my home router via wireless lan. In my case I want to wake up my HTPC from my notebook. To check if WOL is supported use the tool ethtool:
notebook# ethtool eth0
...
Supports Wake-on: pumbg
Wake-on: g
...
htpc# ethtool eth0
...
Supports Wake-on: g
Wake-on: g
...
Each letter stands for a specific mode but in most cases the g mode (Magic Packet) should be ok. In my case my HTPC only supports g while my notebook supports the modes p, u, m, b and g. I only use the g mode. If youe need to change the WOL mode then use ethtool again:
# ethtool -s eth0 wol p
The above command will set the WOL mode to p. If you recheck it then the mode should be set to p (if it is supported):
# ethtool eth0
...
Supports Wake-on: pumbg
Wake-on: p
...
The next thing you need to know is the mac address of your system you want to wake up. You can get mac address easily with ifconfig:
# ifconfig eth0
...
ether 00:11:22:33:44:55 txqueuelen 1000 (Ethernet)
...
The string 00:11:22:33:44:55 represents your mac address.
Before you can wake up your system you need a WOL capable tool. One is wol which I like to use. Depending on your distribution you can download and install it directly. With Slackware the source has to be compiled first. Before you can compile anything you need the source:
# cd /usr/src
# wget -c "http://downloads.sourceforge.net/project/wake-on-lan/wol/0.7.1/wol-0.7.1.tar.gz"
Then extract the source package and change into the new created directory:
# tar xf wol-0.7.1.tar.gz
# cd wol-0.7.1
Run the configure script (no changes are needed for 32/64bit system eg. libdir):
# ./configure --prefix=/usr
...
wol 0.7.1 configuration:
prefix: /usr
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
datadir: ${prefix}/share
mandir: ${prefix}/man
infodir: ${prefix}/info
ether_hostton support: yes
generate wol manpage: yes
EXTRA_LIBS:
ANSI emulation: no
Run make to compile the source and make install to install the compiled binaries:
# make && make install
Then check that the wol tool is available:
# which wol
/usr/bin/wol
Executing wol is a very simple task. Just type wol followed by the mac address to wake up the desired systems (of course make sure that the system that you want to wake up is turned off):
# wol 00:11:22:33:44:55
Waking up 00:11:22:33:44:55...
This works when I wake up my HTPC from my notebook over wireless lan. And there is no difference if my HTPC is turned off or in suspend to ram/disk mode.
No comments:
Post a Comment