Dell T5500 CentOS 7 Wake on LAN

After setting up the Server, I wanted to be able to turn it off from the command line after I was done using it, and to be able to remotely start it. This is how I imagine that a SysAdmin would work with their devices.

Also, this is in my bedroom, and although it isn’t screaming loud like a rack server is, it still makes noise. I have no where else to put it, so I though that getting this functionality to work would be extremely useful

Ethtool comes pre-installed on CentOS 7
ethtool [eth0] | grep Wake-on #Where eth0 is the name of your NIC interface found from the “$ ip link” command
My wol settings are “g” which uses “magic packets” sent to the Network Interface Card, which then is able to send signals to the motherboard about power states.
cat /sys/class/net/[eth0]/address #This command outputs the mac address of designated nic interface to the console

Test it! $ systemctl hibernate
Now the ssh session will stop responding for the remote computer that was just hibernated

etherwake was already on my system.
copy the mac address from the remote interface
$ sudo etherwake [mac address]
The terminal will respond “Network is down

After the computer comes up from hibernation the remote ssh session will respond again!

A Linux SysAdmin Blog – (Far more advance than me)
Etherwake documentation page

Issues!!

After implementing all of the changes, the machine clearly hibernates (i.e. powers down) and after the magic packet is sent it powers up. It also responds to ping and ARP, BUT I can’t log in via ssh. The process just hangs now with no results. I tested this and it will hang overnight with no results/output.

Google search “packet_write_wait: Connection to 192.168.0.120 port 22: Broken pipe”
Best result: https://askubuntu.com/questions/127369/how-to-prevent-write-failed-broken-pipe-on-ssh-connection/354245#354245
When changing all of these read-only files and you encounter the E212 error when using vi or nano:
https://stackoverflow.com/questions/14948441/vim-cant-save-file-e212/14948510
command: $ w !sudo tee % then type L for load
To correct the broken pipe error I made changes on my SSH clients and the SSH Server config files as well.

Google Searching:
Generic explanation of Wake on LAN for all OSes: https://www.howtogeek.com/70374/how-to-geek-explains-what-is-wake-on-lan-and-how-do-i-enable-it/
Search Terms: “magic packet wake on lan centos 7”, “enable wol centos 7”
Another site like this one trying to document fixes: https://frank.sauerburger.io/2019/09/25/wake-on-lan-on-centos-7.html
Link to another site pointed out by Frank above: https://blog.yucas.mx/2018/02/03/add-systemd-service-to-start-wake-on-lan/
CentOS 7 specific mention of a WoL problem: https://forums.centos.org/viewtopic.php?t=71861
Cool PDF of Redhat SysAdmin guide: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/pdf/system_administrators_guide/Red_Hat_Enterprise_Linux-7-System_Administrators_Guide-en-US.pdf

Alright so I rebooted the server and logged in to the GUI to make all of these changes

Command history [use command –> $ history | less]
44 ls
45 cd /etc/
46 ls
47 cd ./udev/
48 ls
49 rpm -qa | grep gnome-shell-browser-plugin
50 yum repolist
51 yum-config-manager –enable
52 sudo yum-config-manager –enable
53 sudo yum-config-manager –enable rhel-7-server-optional-rpms
54 yum -y install gnome-shell-browser-plugin
55 sudo yum -y install gnome-shell-browser-plugin
56 sudo ethtool enp6s0
57 man ethtool
58 cat /pro/net/dev
59 cat /proc/net/dev
60 cd /etc/dev/rules.d
61 ls
62 cd /etc/udev/rules.d
63 vi 99-wakeonlan
64 sudo vi 99-wakeonlan
65 sudo vi /usr/lib/systemd/systemd-wakeonlan
66 ls
67 vi 5
68 rm 5
69 sudo rm 5
70 ls
71 cd /usr/lib/systemd/systemd-wakeonlan
72 cd /usr/lib/systemd/
73 ls
74 chmod +x /usr/lib/systemd/systems-wakeonlan
75 chmod +x /usr/lib/systemd/systemd-wakeonlan
76 sudo chmod +x /usr/lib/systemd/systemd-wakeonlan
77 sudo vi /usr/lib/systemd/system/wakeonlan.service

clearly some mistakes are visible (that’s why you see that rm 5 in there)
But I implemented the solution found in:

And then the service wouldn’t start!!!
I found one issue by following the error message prompts. That was a typo.
Then I looked at one other source to follow which was exactly the same, except that I included the #/usr/lib/systemd/systemd-wakeonlan creation line in the file when it should have started with #!/bin/sh

I need to know more about services and scripts to understand why this is an error.

So I found that the service script that was written didn’t change the way that my system behaved when waking up from hibernate (Save to disk before powering down). But! When I suspend (save to RAM and keep RAM powered on) or if I completely power down the Magic packet powers the system on and I am able to access the system through ssh (or the GUI if I have a monitor plugged in).

I researched system power states and found helpful information, but I will need to look up more information on both my specific hardware and how the OS interacts with it, to see why $ systemctl hibernate is not functional, but $ systemctl suspend and $ systemctl poweroff put the server into a state that I can bring it back from.