Enabling Wake-on-LAN for Xenserver

Overall, I’m a huge supporter of utilizing consumer, or commodity hardware, v.s. enterprise grade or server class equipment for relatively small scale or homelab environments.

I’m a firm believer in being able to use regular hardware, for labbing, especially since in a lab environment, you should be able to experiment around with different hardware configurations. Also, for many beginner homelabers many aren’t able to commit to the requirements of server grade equipment like power cost, space requirements, noise, monetary cost, etc… due to either their lifestyle, spouse, disposable income, living situation or whatever.

In many situations, if you try hard enough, you can put together a lab configuration with a good amount of the features you want without having to fully commit to purchasing “server” equipment, or the “choose two” matrix.

One thing server-grade equipment does bring, is way better remote management capabilities. Things like Dell Remote Access Controller (DRAC), Hewlett-Packard Integrated Lights-Out (iLO), IPMI etc…

Imagine this, you are somewhere halfway across the world (in my case I was somewhere in the Netherlands), and my apartment got hit with a short duration power-outage (around 5 hours), and all of your equipment dies including my little server with anything connected to it. I had no way of powering it back on, and I needed to keep those ratios up.

If you have something like IPMI you can just connect to your server over the internet power it back on. But really you’re sol until you get back home. We can remedy this on our consumer hardware since most modern computing equipment has something called Wake-on-LAN which basically is a mechanism that allows you to power on a device, that’s been “powered off”. The network adapter is in a standby state, examining all packages sent to its MAC address, but doesn’t respond. If a Magic Packet is sent to the network adapter, it will signal to wake the device.

Couple this with some sort of remote network access into your home/lab network, and you have a pretty simple, low-effort way of ensuring your devices are able to come online while you are away in the event something occurs.

Enabling Wake-on-LAN is pretty simple in Xenserver, but first you need to enable Wake-on-LAN in your respective bios. Usually the Wake-on-LAN option is under some sort of power management configuration settings.

Now onto enabling WOL for your Xenserver Center…

  1. SSH into your Xenserver or console into it via the XenCenter GUI Application
  2. Type in following two commands: Modify eth0 to match whatever the management interface to your Xenserver to be. In this case eth0. We are setting the wol to g, because it stands for wakeup with Magic Packet. (Setting it to d is turn WoL off). The second command is for making sure wol is re-enabled at startup in case the system powers off or reboots.
[root@xenserver-gensokyo ~]# /usr/sbin/ethtool -s eth0 wol g
[root@xenserver-gensokyo ~]# echo "/usr/sbin/ethtool -s eth0 wol g" >> /etc/rc.d/rc.local

To verify it was successful, check to see if the Wake-on flag is set to g.

[root@xenserver-gensokyo ~]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: off (auto)
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes

WoL should now be enabled, and operational for your Xenserver. To verify that WoL is working, you can use a utility like etherwake to send the magic packet. Get the MAC address of your management interface, power off your Xenserver host, and run the following commands:

  1. sudo apt-get install etherwake
  2. wakeonlan <MAC ADDRESS>


wakeonlan FF:FF:FF:FF:FF:FF
Sending magic packet to with FF:FF:FF:FF:FF:FF

Your Xenserver host should have powered on, if everything was properly configured.Additionally, I also recommend on enabling the Wake-on-LAN in the Xenservers properties panel. For some reason this feature is disabled in the XenCenter GUI if your Xenserver hosts aren’t running in a cluster (you won’t get the right click power on within in XenCenter.)

Hope this helped you in your labs remote server management :)