There is a cool protocol to boot machine remotely called Wake on LAN. Considering i am using RPI as gateway, This allows me to start my machine remotely and poweroff if not needed.
Enable WOL in BIOS/UEFI Link to heading
This has to be supported by hardware and it’s usually disabled by default. On my mobo, It’s named “Power On by PCIE”. So, that has to be enabled first.
Enable WOL in ethernet driver Link to heading
following the steps page, we need ethtool to change the ethernet driver from d (default) to g(magic).
ethtool -s <NETWORK INTERFACE> wol g
Make WOL persistent Link to heading
from page, interfaces resets the WOL flag on boot. so, we need to create a systemd service to set it back to magic after boot.
vi /etc/systemd/system/wol.service
use the following service
[Unit]
Description=Configure Wake On LAN
[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s INTERFACE wol g
[Install]
WantedBy=basic.target
Restart systemd
sudo systemctl daemon-reload
sudo systemctl enable wol.service
sudo systemctl start wol.service
Booting the machine Link to heading
To start a machine, we need the MAC of that machine and connection a machine on the same network.
sudo etherwake <MAC> -i <INTERFACE>