Remote Wake on LAN (Wake on WAN) with the G1100 quantum gateway [SOLVED]

DoubleDoc
Newbie

 

I have finally found a solution for implementing remote WOL  (ie Wake on WAN) through a G1100 quantum gateway using an Arduino powered through a cloud accessible smart plug.  See the comments in the Arduino sketch below for details.  This worked on G1100 firmware 02.03.00.14.  There is no need to set up port forwarding on the G1100 and no need for an additional router so no Fios functionality is impacted.  You do need to make sure the Bios and OS on the target machine are set up to accept WOL requests.  In case anyone has issues getting this to work, this is the hardware I used:  Elegoo Arduino Uno (~$16), Seeed Studio W5500 Ethernet shield (~$30), tp-link Kasa smart wi-fi plug mini (~$10).  For those of you looking to get into Arduino programming, this is a good starter project.

Alternatively, one could leave the Arduino powered all the time and avoid buying a smart plug. To do it this way assign a static IP address to the arduino, port forward telnet connections to the Arduino, setup a telnet server in the Arduino sketch, send a Magic Packet on successful telnet connection from say a phone telnet app, terminate the telnet session and await another connection.  Sometimes after sitting idle for hours, the arduino would hang refuse to accept connections.  This was not ideal as I did not have a way to restart/resset the Arduino remotely.

Cheers

//****************************************************************************************

// Arduino WOL

// Intended user: Anyone with home router (like Verizon G1100 Quantum gateway) that
// 1) is not remotely accessible or is remotely accessible
// but can't send Magic Packets from the interface
// 2) blocks WOL requests from the WAN
// 3) blocks broadcast packets from the WAN
// 4) has no provision for static ARP entries and flushes dynamic ARP entries on machine shut down.
// The last one is irrelevant to those with machines that respond to WOL only from the sleep or hibernate states.

// Minimum requirements:
// Arduino, Ethernet shield, Arduino power supply,
// Ethernet cable, Cloud accessible smart switch (eg TP-link KASA, GE Cync, etc),
// target machine capable of responding to WOL requests (usually need to change some settings
// in the BIOS and OS allow WOL)
// Optional: Enclosure for the Arduino
// The target machine must be connected to the LAN by Ehernet cable. Wifi will not work but not tested.

// Load this script into the Arduino and disconnect USB cable.
// Connect the Ethernet cable to the Arduino and to an empty LAN port on your router or other LAN connected ethernet switch.
// Download the phone app for your smart switch and setup the smart switch on your LAN.
// Turn off the smart switch. Connect the power supply to the Arduino and plug it in to the smart switch.
// Use the app on your phone to power the Arduino and automatically send the Magic Packet.
// Power down the Arduino from the phone app after ~30 seconds.

 

// network configuration. setup below is for DHCP.
// the media access control (MAC) address for the shield
// change the line below to the corresponding MAC address.
// look for sticker on the ethernet shield.
byte mac[] = { 0xZZ, 0xZZ, 0xZZ, 0xZZ, 0xZZ, 0xZZ };

//The broadcast IP of our network
byte broadCastIp[] = { 192 , 168, 1, 255 };

//MAC address of the machine we want to wake up
byte remote_MAC_ADD[] = { 0xZZ, 0xZZ, 0xZZ, 0xZZ, 0xZZ, 0xZZ };

//UDP WOL port
int wolPort = 9;

//Magic Packet
byte magicPacket[102];

EthernetUDP Udp;

int i,c1,j=0;


void setup()
{

// Open serial communications and wait for port to open:
Serial.begin(9600);

// initialize the ethernet device
Ethernet.begin(mac);

// print your local IP address:
Serial.print("My IP address: ");
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
Serial.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(".");
}
Serial.println("");
Serial.println("Initialization complete.");

// create the Magic Packet
// 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, followed by the target MAC address repeated 16 times
for(i = 0; i < 6; i++){
magicPacket[j] = 0xFF;
j++;
}
for(i = 0; i < 16; i++){
for(c1 = 0; c1 < 6; c1++) {
magicPacket[j] = remote_MAC_ADD[c1];
j++;
}
}
// Send the Magic Packet 5 times. Sending once would often fail to wake the taeget machine.
for (i=0; i<5; i++) {
Udp.begin(wolPort);
Udp.beginPacket(broadCastIp, wolPort);
Serial.println(Udp.write(magicPacket, sizeof magicPacket));
if (Udp.endPacket() == 1) {
Serial.println("Wake on LAN was successfully sent. ");
}
else {
Serial.println("Error: Wake on LAN not sent. ");
}
delay(3000);
Udp.stop();
}
}

void loop()
{


}

//****************************************************************************************

Labels (1)
0 Likes
Reply
1 Solution
Cang_Household
Community Leader
Community Leader

Note the key pieces on technology in your setup (Kasa and smart plugs) use NAT slipstreaming to gain inbound access to your LAN. NAT slipstreaming is as vulnerable as port forwarding.

WOL is restricted to the broadcast domain. The more secure way should be hosting a VPN server in the LAN and sends WOL magic cookies on behalf of the requester.

View solution in original post

1 Reply
Cang_Household
Community Leader
Community Leader

Note the key pieces on technology in your setup (Kasa and smart plugs) use NAT slipstreaming to gain inbound access to your LAN. NAT slipstreaming is as vulnerable as port forwarding.

WOL is restricted to the broadcast domain. The more secure way should be hosting a VPN server in the LAN and sends WOL magic cookies on behalf of the requester.