I'm in a similar situation to you. Using Ubuntu 16.04 LTS as a web server.
The server and a Raspberry Pi are both connected to the router via ethernet cable.
The RPi is running continuously. I have installed and configured fail2ban for extra security. The router is configured to allow SSH access from the internet to the RPi. When I want to start my power hungry IBM server. I SSH connect (mosh actually) to the RPi and run the following Python program:
""" Send a WoL packet to the specified MAC address NB: Won't work on OS/X. The AF_PACKET is specific to Linux. Needs to be run with sudo. """ import socket PREAMBLE = bytearray((0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF)) # Need to configure the following for the correct MAC of the target MAC = bytearray((0x00, 0x14, 0x85, 0xa1, 0x43, 0xde)) pkt = PREAMBLE + 16*MAC sock = socket.socket(socket.AF_PACKET, socket.SOCK_RAW) # Configure the correct interface name sock.bind(('enp2s1', 0)) sock.sendall(pkt) sock.close()
If you don't have a static IP address, then you probably need to configure dynDNS or something similar and your domain addresses.