Introduction
Wake-on-LAN (WoL) is a network management protocol that allows administrators to power on and off network devices remotely. It is particularly useful when managing servers or other network devices that are not always in use. In this article, we will discuss how to enable Wake-on-LAN for a Windows PC running in a Docker container, which is on a different subnet than the Wake-on-LAN server.
Prerequisites
Before we begin, ensure that the following prerequisites are met:
- A Windows PC running in a Docker container
- A Wake-on-LAN server with an accessible network interface
- Both the Windows PC and the Wake-on-LAN server are connected to the same physical network or have routable IP addresses
Configuring the Windows PC in the Docker Container
To enable Wake-on-LAN on the Windows PC in the Docker container, follow these steps:
-
Enable Wake-on-LAN in the BIOS
Restart the Windows PC and enter the BIOS setup utility. Look for the "Power Management" or "Wake-up from Power Save Mode" option and enable Wake-on-LAN. Save and exit the BIOS setup utility.
-
Install the Wake-on-LAN driver in the Docker container
Open a terminal window in the Docker container and install the Wake-on-LAN driver using the following command:
sudo apt-get install ethtoolThis command installs the ethtool package, which includes the Wake-on-LAN driver.
-
Configure the network interface for Wake-on-LAN
Use the following command to configure the network interface for Wake-on-LAN:
sudo ethtool -s eth0 wol gReplace "eth0" with the name of the network interface.
Configuring the Wake-on-LAN Server
To configure the Wake-on-LAN server, follow these steps:
-
Enable Wake-on-LAN on the network interface
Use the following command to enable Wake-on-LAN on the network interface:
sudo ethtool -s eth0 wol gReplace "eth0" with the name of the network interface.
-
Install and configure the Wake-on-LAN client
Install and configure a Wake-on-LAN client on the Wake-on-LAN server. There are several open-source Wake-on-LAN clients available, such as WakeMeOnLan and Magic Packet Wake-on-LAN Utility.
Testing Wake-on-LAN
To test Wake-on-LAN, follow these steps:
-
Power off the Windows PC in the Docker container
Use the terminal window in the Docker container to power off the Windows PC:
sudo shutdown -s -t 0 -
Send a Wake-on-LAN magic packet from the Wake-on-LAN server
Use the Wake-on-LAN client on the Wake-on-LAN server to send a magic packet to the IP address of the Windows PC:
wol 10.0.0.10Replace "10.0.0.10" with the IP address of the Windows PC.
-
Verify that the Windows PC has been woken up
Use the terminal window in the Docker container to check the status of the Windows PC:
systeminfo | findstr /B /C:"Windows Version"
In this article, we discussed how to enable Wake-on-LAN for a Windows PC running in a Docker container, which is on a different subnet than the Wake-on-LAN server. We covered the steps to configure the Windows PC in the Docker container and the Wake-on-LAN server. We also tested the Wake-on-LAN functionality and verified that the Windows PC was woken up remotely.