Удаленное включение компьютера linux

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.

Читайте также:  Запуск консоли linux mint

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.

Читайте также:  Usb stick with linux

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.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

Удаленное включение компьютера 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 записей >>
Читайте также:  Broadcom bcm43227 driver linux

Источник

Оцените статью
Adblock
detector