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[root@remote ~]# 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<slot>p<port>” naming convention. See https://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming for further info)[root@remote ~]# ethtool -s p33p1 wol g
Append the above option on interface config file for persistence after reboot:[root@remote ~]# 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!):[root@remote ~]# ip link show p33p1 | awk '/ether/ {print $2}' (sample fake MAC Address)
DE:AD:BE:EF:CA:FEĀ
* Steps to be performed on the LOCAL MACHINE [from where we will turn on the remote one]:
Install the net-tools package[root@local ~]# yum install net-tools
Wake Up Dead Man![root@local ~]# ether-wake DE:AD:BE:EF:CA:FE
Usage: ether-wake [MAC Address of the machine to Wake-On-LAN]
