Enabling wake on lan (WoL)

From Notes_Wiki

Home > CentOS > CentOS 6.x > Network configuration > Network interface configuration > Enabling wake on lan (WoL)

To enable wake on lan for a interface when it receives magic packet:

  • Open file '/etc/sysconfig/network-scripts/ifcfg-eth<n>'
  • Add following option to it
    ETHTOOL_OPTS="wol g"
  • Now restart machine and test wake on lan option.

Note that for Wake on LAN to work

  • Wake on LAN must be enabled in BIOS for LAN/PCI cards
  • The OS should not boot with Xen kernel which does not supports acpi wakeonlan
  • Machine being waked up should be in same VLAN and machine trying to wake it up
  • Manageable switch port should be enabled. (That is if we have just powered off the machine, we might have to wait up to 30 seconds before we can power it on again).


Testing Wake on LAN

To test Wake on LAN

  • Open file /etc/ethers. Syntax of this file is explained in 'man ethers'. Sample ethers file is
    00:07:e9:B0:27:74 10.3.3.64
  • Now use command
    ether-wake -b -i <interface_name> 10.3.3.64

to wake machine whose mac we wrote against IP 10.3.3.64 in /etc/ethers file


Troubleshooting Wake on LAN

Check following things if Wake on LAN is not working

  • If machine to be waked up is connected to manageable switch make sure the port is active
  • Check that both machines are in same VLAN
  • The light of ethernet port of machine to be waked up should glow when it is shut.
  • When machine is on 'ethtool eth<n>' should give detailed output and not just link 'Link detected: yes'
  • Check if wake on LAN is enabled in BIOS
  • Check if interface supports Wake on LAN with 'g' option.
  • Check if start-up files have ETHTOOL_OPTS properly set for wake on lan.

Until above conditions are met wake on lan is not going to work.

Read more about Wake on lan from http://centos.org/modules/newbb/viewtopic.php?topic_id=24326&forum=37


Wake on LAN packet structure

A wake on LAN packet would consist of following data in exactly same order

  1. Destination MAC address - 6 bytes - (FF:FF:FF:FF:FF:FF)
  2. Source MAC address - 6 bytes - mac address of source machine
  3. Wake on LAN protocol number - 2 bytes - (0x0842)
  4. Destination MAC address - 6 bytes - (FF:FF:FF:FF:FF:FF)
  5. MAC of machine to be waked up repeated 16 times - 96 bytes - mac address of machine to be waked up

Total length of packet comes out to be 116 bytes. Wireshark can recognize such packets as Wake On LAN packets properly.


Home > CentOS > CentOS 6.x > Network configuration > Network interface configuration > Enabling wake on lan (WoL)