SystemNetwork

Set up your Linux for Wake On LAN (WOL)

Wake on LAN starts a server using a command sent over the network from another machine. Configuration has two parts: the server that receives the power-on command, and the client that sends it.

Install and use Wake on LAN (WOL)

  1. Enable Wake on LAN in the machine’s BIOS.
  2. Create a script named wakeonlan in /etc/init.d/ containing:
<strong>## /etc/init.d/wakeonlan
#
# chkconfig: 2345 99 99
# description: Wake On Lan
#</strong>

ethtool -s eth0 wol ugmb exit

  1. Change the file permissions with:

#chmod a+x wakeonlan

  1. Run the following command to register the script with System V so it runs whenever the machine starts or stops.

    • For Debian, Ubuntu, and other Debian-based systems, run:

    #update-rc.d wakeonlan defaults

    • For Red Hat, Fedora, and other Red Hat-based systems, run:

    #chkconfig —add wakeonlan

  2. Check and record the machine’s MAC address for use as a Wake on LAN command parameter, using:

#ifconfig | grep HW

  1. Run:

#halt

  1. Install wol from http://dag.wieers.com/rpm/packages/wol/.
  2. Create poweron.sh containing:
<strong>#!/bin/bash</strong>
<strong>count="0"
while [ $count -lt 3 ]
 do
  ping -nqc 3 -w 5 $3 > /dev/null && break
  /usr/sbin/arp -d $1
  /usr/sbin/arp -s $1 $2
  sleep 3
  /usr/local/bin/wol -i $3 $2
  sleep 90
  ping -nqc 3 -w 5 $3 > /dev/null && break
  count=$[$count+1]
done</strong>
  1. Run a command to test poweron.sh. The command pattern is: poweron.sh hostname MAC-address IP-address For example, suppose the machine configured above is named wol.ezylinux.com, with MAC address 01:23:45:67:89:ab and IP address 10.0.0.1. Run:

#sh poweron.sh wol.ezylinux.com 01:23:45:67:89:ab 10.0.0.1

EOF.← Back to articles

Archived comments (2)

Preserved from the original blog for reference.

scwy

I would like instructions for installing CentOS 5.5 on an HP ML110 G6.

Tum.

Sorry, I do not have that machine.