Turn on remote computer via Wake-On-LAN [CentOS 6]
Here’s how you can wake up (turn on) a remote pc using the Wake-On-LAN function of its network card: you just have to issue a command against the remote machine MAC Address.
Required packages: ethtool on the machine you want to turn on from remote net-tools on the local machine you want to use to wake the remote one plus, your network card MUST support Wake-on-LAN
- Steps to be performed on the REMOTE MACHINE [to be waked up]:
Install the ethtool package
yum install ethtool
Set Wake-On-LAN option to “Wake on MagicPacket(TM)” on your network interface (in my case p33p1, PCI add-in card named following the “p
ethtool -s p33p1 wol g
Append the above option on interface config file for persistence after reboot:
echo "ETHTOOL_OPTS=\"wol g\"" >> /etc/sysconfig/network-scripts/ifcfg-p33p1
Finally, take note of the remote machine MAC Address, then shutdown the system (NOT TO DO ON PRODUCTION SYSTEMS!):
ip link show p33p1 | awk '/ether/ {print $2}'
DE:AD:BE:EF:CA:FE (sample fake MAC Address)
- Steps to be performed on the LOCAL MACHINE [from where we will turn on the remote one]:
Install the net-tools package
yum install net-tools
Wake Up Dead Man!
ether-wake DE:AD:BE:EF:CA:FE
Usage:
ether-wake ${MAC Address of the machine to Wake-On-LAN}