~

Setting up Wake-on-LAN on Ubuntu/Debian Linux

Learn how to set up Wake-on-LAN on Ubuntu or any Debian-based Linux distribution, ensuring it automatically starts after a system restart.

Have you ever wished you could power on your computer remotely without physically being near it? Maybe you want to access files or applications, or you simply need to perform some maintenance tasks on your machine. Well, the good news is that you can achieve this using Wake-on-LAN (WoL). In this blog post, we will explore how to set up Wake-on-LAN on Ubuntu or any Debian-based Linux distribution, ensuring it automatically starts after a system restart.

What is Wake-on-LAN?

Wake-on-LAN is a networking standard that allows you to send a special network packet, called a magic packet, to a computer's network interface card (NIC) to wake it up from a powered-off or sleeping state. The magic packet contains the MAC address of the target computer's NIC, which enables it to recognize the packet and power on.

[Top]

Enabling Wake-on-LAN on Ubuntu/Debian Linux

Before we begin, it's important to ensure that your computer's hardware and network card support Wake-on-LAN. Most modern computers and NICs provide this functionality, but it's always worth double-checking your specific hardware specifications or consulting the manufacturer's documentation.

Now, let's proceed with enabling Wake-on-LAN on your Ubuntu or Debian Linux system:

  1. Install the ethtool package: Open a terminal and execute the following command to install ethtool, a handy utility for managing network interfaces:
sudo apt-get install ethtool
  1. Identify your network interface: In the terminal, enter the following command to list your network interfaces:
ifconfig -a

Identify the network interface you want to enable Wake-on-LAN for. It is usually named eth0 or enpXsY, where X and Y represent numbers.

  1. Check the current Wake-on-LAN status: Run the following command to check the current Wake-on-LAN status of your network interface:
sudo ethtool <interface_name> | grep Wake-on

Replace <interface_name> with the name of your network interface.

  1. Enable Wake-on-LAN: To enable Wake-on-LAN, execute the following command:
sudo ethtool -s <interface_name> wol g
  1. Make the changes persistent: To ensure that Wake-on-LAN settings persist after a system restart, we need to create a custom systemd service. Create a file with a .service extension, such as wol.service, in the /etc/systemd/system/ directory. Open the file using a text editor and add the following content:
[Unit]
Description=Wake-on-LAN

[Service]
ExecStart=/sbin/ethtool -s <interface_name> wol g
Type=oneshot

[Install]
WantedBy=default.target

Remember to replace <interface_name> with the name of your network interface.

  1. Enable and start the systemd service: Run the following commands to enable and start the systemd service:
sudo systemctl enable wol.service
sudo systemctl start wol.service

That's it! You have successfully enabled Wake-on-LAN on your Ubuntu or Debian Linux system and ensured it will automatically start after a restart.

[Top]

Sending the Magic Packet

To wake up your computer using Wake-on-LAN, you need to send a magic packet to its network interface. There are various ways to achieve this, including using dedicated Wake-on-LAN tools or even mobile apps. Most of these tools require you to provide the target computer's MAC address and IP address or hostname.

Keep in mind that Wake-on-LAN packets can only reach computers within the same local network, so make sure you are connected to the same network as the target machine.

Once you have the necessary information (MAC address, IP address/hostname), launch the Wake-on-LAN tool or app of your choice, fill in the required details, and send the magic packet. If everything is set up correctly, your computer should power on.

[Top]

Conclusion

Wake-on-LAN is a powerful feature that allows you to remotely wake up your computer from a powered-off or sleeping state. By following the steps outlined in this blog post, you can enable Wake-on-LAN on your Ubuntu or Debian-based Linux system and ensure it automatically starts after a restart. This way, you can conveniently access your machine remotely and perform necessary tasks without being physically present.

So go ahead and give Wake-on-LAN a try. Experience the convenience and flexibility it offers, and say goodbye to those instances where you wish you had access to your computer when you're away. Happy waking!

Note: Wake-on-LAN functionality might not work on every hardware and network card configuration. If you encounter any issues or your system does not support Wake-on-LAN, refer to your hardware or system documentation for further assistance.

[Top]

References

[Top]

Story Time

I have multiple computers at home, and I often need to access them remotely. I used to leave them powered on all the time, but I realized that this was not the most efficient approach. So I decided to enable Wake-on-LAN on all my machines and set up a Wake-on-LAN server on my Raspberry Pi. Now, I can conveniently wake up any of my computers remotely and access them whenever I need to.

The thing is now I can save a lot of energy by keeping my computers powered off when I'm not using them. I can also perform maintenance tasks on them remotely, which is very convenient. It's a win-win situation!

So, this is how I set up Wake-on-LAN on my Ubuntu and Debian Linux systems. I hope you found this blog post useful and that it helps you set up Wake-on-LAN on your system as well.

[Top]

Special Thanks

Photo by Markus Spiske on Unsplash

debian.org

[Top]

Comments

Feel free to share your thoughts, feedback, or questions about setting up Wake-on-LAN on Ubuntu or Debian Linux in the comments section below. Let's engage in meaningful discussions and explore the endless possibilities of remote computer access!

Please Note: Sometimes, the comments might not show up. If that happens, just refresh the page, and they should appear.

Address

Shyanuboganahalli

Bengaluru

Karnataka 560083

India

Email

Contact: admin@nekonik.com

Feedback: feedback@nekonik.com

Support: nik@nekonik.com

Social
© 2024 Neko Nik · All rights reserved.