- WakeOnLan
- Introduction
- Setting Up Wake-on-LAN
- Enabling WoL in the BIOS
- Using an Integrated NIC
- Using a Non-Integrated NIC
- Enabling WoL in the NIC
- Determining whether the NIC supports WoL
- Enabling WoL in the NIC
- Testing Wake-On-LAN
- Command-line tools
- GTK+ tool
- Configure other operating systems
- Troubleshooting
- External Links
- Настройка wake on lan linux
- How to Enable Wake-on-LAN in Ubuntu 22.04? [SOLVED]
- Does you Network Card support Wake on Lan?
- Enable Wake on Lan Feature
- Auto Wake-On-Lan Activation at Startup
- Remote Ubuntu Server Wake Up
- Summary
- References
WakeOnLan
This page explains how to enable use of Wake-on-LAN (WoL) in systems that have Ubuntu installed.
Introduction
Wake-on-LAN enables users to turn on a computer across a network from another network device. It can be very useful in situations where computers are not all next to each other or there are a lot of machines. WoL works by sending a packet of data called a Magic Packet™ to the target machine. When the packet is received, the target machine’s network device (Network Interface Controller or NIC) wakes-up the rest of the machine.
Setting Up Wake-on-LAN
In order to use WoL it must be supported and enabled as necessary in the BIOS, NIC and other network hardware (routers, switches etc). You may also need to configure some software if things don’t work out-of-the-box.
Enabling WoL in the BIOS
This section may differ depending on whether or not you have a NIC integrated into your motherboard.
Using an Integrated NIC
To enable WoL in the BIOS, enter the BIOS setup and look for something called «Wake up on PCI event», «Wake up on LAN» or similar. Change it so that it is enabled. Save your settings and reboot.
Using a Non-Integrated NIC
If your NIC is not integrated into your motherboard, you will still have to configure your BIOS to allow devices to wake up your computer. Boot your computer and enter the BIOS settings menu. In one of the sub-menus there will hopefully be the option to allow USB and/or PCI devices to wake-up the computer. Enable the setting that is appropriate for your NIC. Save your settings and reboot.
PCI NICs sometimes require a cable connection to the power supply in order to stay awake when the computer is off/asleep. Check your manual to see if yours does and install if necessary.
Enabling WoL in the NIC
Determining whether the NIC supports WoL
First, determine which NIC will be used, and then check whether it supports the Magic Packet™ using
where is the device name of your NIC, e.g. eth0. This command will output some information about your the capabilities of your NIC. If this output contains a line similar to the following:
where contains the letter g, the NIC should support the WoL Magic Packet™ method (for the other letters look at man ethtool).
Enabling WoL in the NIC
To check whether WoL is enabled in the NIC, one could use
If contains g and not d, then Magic Packet™ is enabled. However, if does contain d, WoL needs to be enabled by running the following command:
On most systems, issuing this command is required after each boot. If the system's networking is configured via ifupdown, then it is easy to add the line up ethtool -s wol g below the interface's configuration stanza in /etc/network/interfaces. For example:
shahar@shahar-backup:~$ cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 10.0.0.1 netmask 255.255.255.0 gateway 10.0.0.138 up ethtool -s eth0 wol g
This will ensure that WoL is enabled in the NIC on each boot. Fore more information see the interfaces manual.
Testing Wake-On-LAN
Test WoL by powering off the system and trying to send it the magic packet using:
Command-line tools
GTK+ tool
Configure other operating systems
If the system dual-boots with other operating systems, they should be configured to also enable or, at least, not disable WoL in the NIC. This is beyond the scope of this document but here's a starting point for Microsoft's OS's.
Troubleshooting
- Check that the power management options for your BIOS and NIC support WoL and are enabled as described above.
- Verify that the packets sent to wake the target computer are indeed reaching their intended desination.
- You may be able to verify the presence of packets by watching the network activity indicator LED on your switch or router. This is easier to see if you send multiple packets as you can count them.
External Links
- Magic Packet Technology - A white paper describing the specification and implemenation of Magic Packet™ technology from AMD, one of its two co-developers.
WakeOnLan (последним исправлял пользователь 217-175-223-46 2015-08-31 14:29:10)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for detailsНастройка wake on lan linux
опять перейдёт в состояние "d" и, если вам нужно, добавьте приведённую выше
команду куда-нибудь в /etc/rc.local.Это может не работать (или не сработать второй раз), если выполнялся сброс (переинициализации) карты (в том числе - на ноутбуках после "сна").
Если на компьютере несколько сетевых карт обязательно нужно указать в параметр -i адрес
Например, если нужно разбудить комп с адресом 192.168.2.34 в сети 192.168.2.0/24 то можно так и указать например широковещательный адрес сети
Добавить заметку Версия для печати Последние заметки - 18.04 Перевод шифрованного раздела на LUKS2 и более надёжную функцию формирования ключа - 31.03 Пример правил nftables с реализацией port knoсking для открытия доступа к SSH - 27.02 Обновление сертификатов oVirt - 20.11 Решение проблемы со шрифтами в Steam после выставления времени после 2038 года - 18.11 Раскладка клавиатуры для ввода символов APL - 10.09 Настройка СУБД Postgresql для аутентификации пользователей через Active Directory - 09.09 Настройка СУБД PostgreSQL 13 под управлением Pacemaker/Corosync в Debian 11 - 08.09 Создание виртуальных машин с помощью Qemu KVM - 25.07 Создание программ под SynapseOS - 24.07 Случайная задержка в shell-скрипте, выполняемом из crontab (без башизмов) RSS | Следующие 15 записей >> How to Enable Wake-on-LAN in Ubuntu 22.04? [SOLVED]
Wake-on-LAN is a feature that allows you to turn on your computer from another device over the network. It does this by sending a data packet. The receiving computer's network driver processes this data packet and wakes the computer.
In this article we will tell you how to enable Wake-on-LAN in Ubuntu and example usage.
Does you Network Card support Wake on Lan?
Your ethernet card must support this feature for Wake-on-Lan to work. To find out if your Ethernet card supports this feature, you must first learn the name of your Ethernet interface. In the following sections, it is recommended to register the mac address for packet sending.
In Terminal, the ip address and other information are displayed with the following command:
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp2s0: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 30:5a:3a:0d:ac:0d brd ff:ff:ff:ff:ff:ff inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic noprefixroute enp2s0 valid_lft 67502sec preferred_lft 67502sec inet6 fe80::40ab:d219:c23e:abfb/64 scope link noprefixroute valid_lft forever preferred_lft forever
Mac address: 30:5a:3a:0d:ac:0d and enp2s0 is the computer's network interface name. To view and change the Wake-On-Lan settings, the "ethtool" package must be installed:
foc@ubuntu22:~$ sudo apt install ethtool -y
Next, find out if the network card supports wake-on-LAN:
foc@ubuntu22:~$ sudo ethtool enp2s0
Settings for enp2s0: . Duplex: Full Auto-negotiation: on master-slave cfg: preferred slave master-slave status: slave Port: Twisted Pair PHYAD: 0 Transceiver: external MDI-X: Unknown Supports Wake-on: pumbg Wake-on: d Link detected: yes
The expression “ Wake-on:d ” indicates that the wake-on-lan feature of the network card is supported but deactivated.
Enable Wake on Lan Feature
Run the following commands to enable wake-on-lan on your network card:
foc@ubuntu22:~$ sudo ethtool -s enp2s0 wol g
Settings for enp2s0: . Speed: 1000Mb/s Duplex: Full Auto-negotiation: on master-slave cfg: preferred slave master-slave status: slave Port: Twisted Pair PHYAD: 0 Transceiver: external MDI-X: Unknown Supports Wake-on: pumbg Wake-on: g Link detected: yes
Some motherboard manufacturers require you to change the settings in the BIOS to enable this feature. If there is no change when you check after entering the command, it is recommended to look at the BIOS settings.
Auto Wake-On-Lan Activation at Startup
If the Wake-on-Lan settings are deactivated when the server is restarted; you should solve this problem with systemd.
foc@ubuntu22:~$ sudo --preserve-env systemctl edit --force --full wol-enable.service
[Unit] Description=Enable Wake-up on LAN [Service] Type=oneshot ExecStart=/sbin/ethtool -s enp2s0 wol g [Install] WantedBy=basic.target
Replace the enp2s0 value with your own network interface value. Then reload and enable the service:
foc@ubuntu22:~$ sudo systemctl daemon-reload foc@ubuntu22:~$ sudo systemctl enable wol-enable.service Created symlink /etc/systemd/system/basic.target.wants/wol-enable.service → /etc/systemd/system/wol-enable.service.
Remote Ubuntu Server Wake Up
The above steps were the steps to do for Ubuntu to wake up. Now, let's talk about the steps to be done on the server that will do the wake-up task.
One of the following package must be installed on the server in question:
foc@ubuntu22:~$ sudo apt search wakeonlan wakeonlan/jammy 0.41-12.1 all Sends 'magic packets' to wake-on-LAN enabled ethernet adapters
Install wakeonlan package:
foc@ubuntu22:~$ sudo apt install wakeonlan -y
Wake up remote server using this package:
foc@ubuntu22:~$ sudo wakeonlan 30:5a:3a:0d:ac:0d Sending magic packet to 255.255.255.255:9 with 30:5a:3a:0d:ac:0d
Remote server mac address should be written after wakeonlan command.
Summary
In this article we have explained the steps for remote wake up Ubuntu server remote. The manual page about what you can do with wakeonlan will help:
foc@ubuntu22:~$ man wakeonlan
NAME wakeonlan - Perl script to wake up computers SYNOPSIS wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] . ] . EXAMPLES Using the limited broadcast address (255.255.255.255): $ wakeonlan 01:02:03:04:05:06 $ wakeonlan 01:02:03:04:05:06 01:02:03:04:05:07 Using a subnet broadcast address: $ wakeonlan -i 192.168.1.255 01:02:03:04:05:06 Using another destination port: $ wakeonlan -i 192.168.1.255 -p 1234 01:02:03:04:05:06 Using a file as source of hardware and IP addresses: $ wakeonlan -f examples/lab001.wol $ wakeonlan -f examples/lab001.wol 01:02:03:04:05:06
References
Didn't find what you were looking for? Perform a quick search across GoLinuxCloud
If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.
For any other feedbacks or questions you can either use the comments section or contact me form.
Thank You for your support!!