Using the tuxgraphics embedded web server for Wake on Lan (WOL)
This is article was written on request of a customer who wanted
a little web server connected to his DSL router and use it
to wake up a different PC on the same LAN._________________ _________________ _________________
Instead of switching on or off a PC via a relay connected
to the tuxgraphics avr web server we use Wake on Lan (WOL) to
"switch it on".
The tuxgraphics web server takes only about
0.5 Watt of power. That is much less than a common PC which needs between
50 and 100 Watt. So instead of having the PC all the time running we put
it to sleep when it is not needed. To have it unavailable and sleeping improves also the security for devices which
are not really meant for the general public.
To use it we need to wake that PC up.
Normally one needs to go to the PC and touch a key to wake it up. If
it want to use it from remote then we something else to wake it up.
That is then the tuxgraphics web server with Wake on Lan functionallity.
Welcome to Wake on Lan (WOL)
Wake on LAN is a special UDP packet that contains the MAC address of the
PC to wake up. The sleeping PC is not completely powered down. It still
listens to some network packets. If it finds a WOL packet with it's own
MAC address then it powers up.
All new Apple computers running Mac OS X support this WOL feature. It is
controlled via System Preferences-> Energy Saver-> Options tab.
Marking the "Wake for Ethernet network administrator access" check-box enables
Standard PCs support WOL via the Bios. Generally you need a PC
with an Ethernet chip on the motherboard to have that option in the Bios.
I have used it with IBM Thinkpad laptops.
WOL with the tuxgraphics web server
A WOL packet is a simple UDP packet containing 16 times the MAC address of
the to be woken up machine. It is quite easy to implement. We add
a little web interface with a password protection and you have a solution
to remotely wake up a machine connected to the same LAN. This is how
the web-interface looks like:
The web interface for WOL.
The web interface has also a configuration page where one can change
some settings of the tuxgraphics web server itself:
The web interface for configuration changes.
Finding the MAC address of the PC to wake-up
The easiest way to see the MAC address on both a Linux PC as well
as a MAC is the command /sbin/ifconfig.
Although ifconfig is not in the search PATH of an ordinary user you can
still run it for the purpose of making printouts. The first ethernet interface
on a Apple is e.g:
Under windows you select in the start menu the "Run..." field and you enter
cmd to get a "dos shell". On the dos prompt you use ipconfig:
The number under "Physical Address" is the MAC address. Windows
separates the 6 digits of the MAC with minus signs. Everybody else
uses a colon sign. Make sure you look at the right network adapter.
Using WOL over the internet and a DSL router
To use it via a DSL router from outside the local Lan you need a
router that supports forwarding of services to specific IP-addresses
on the local lan. Many DSL routers can do that.
Your DSL connection has to the outside world only one IP address.
If you want to have more than one web server reachable via that
external address then you need to use different port numbers (=services).
Only one of the web servers is then reachable via the standard
port 80 (http). For the other server you will have to use a different external port
number (e.g 88). Example:
This could be your PC once it is woken up:
This could be the tuxgraphics WOL web server:
WOL over the Internet to a LAN behind a DSL router
© Guido Socher, tuxgraphics.org
2009-04-14, generated by tuxgrparser version 2.56