- Wake on lan linux gui
- Ubuntu Documentation
- 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
- Ubuntu Linux: Install Wake On Lan Client For Server
- Ubuntu wake on lan client installation
- How do I use wakeonlan client?
- Examples
- WOL: Приключения «Волшебного Пакета» в Linux
- Приступим
- Enabling Wake-On-LAN (In Ubuntu 20.10)
- Table of Contents
- Beginning
- Middle
- Ethtool
- Checking the Interface
- Turn It On Temporarily
- Test It Out
- Take Two
- Making It Permanent
- Set It Up
- Enable The Service
Wake on lan linux gui
Как настроить Wake On Lan в Linux-01
Всем привет сегодня расскажу как настроить Wake On Lan в Linux.
WakeOnLan (WOL) — это технология позволяющая включить компьютер, методом отправки на него специального пакета данных, называемыми Magic Packet. Принцип работы этой технологии таков, что при выключении компьютера он переходит в дежурный режим и переводит сетевую карту в режим пониженного потребления, просматривая все поступающие пакеты из сети. Если сетевой адаптер обнаружит Magic Packet, он выдаст сигнал на включение компьютера. Примечание: для использования данной технологии необходима поддержка данной функции (технологии) сетевым адаптером, почти все современные сетевые адаптеры поддерживают данную технологию.
В данном посте мы рассмотрим настройку данной функции на примере ОС Linux.
1. В первую очередь мы просмотрим список наших сетевых интерфейсов используя утилиту ethtool:
ifconfig
В ответ получим список наших используемых сетевых интерфейсов (в моём случае он 1):
eth0 Link encap:Ethernet HWaddr 6c:62:6d:f0:ce:b4
inet6 addr: fe80::6e62:6dff:fef0:ceb4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4528 errors:0 dropped:0 overruns:0 frame:0
TX packets:491 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:686281 (670.1 KiB) TX bytes:61590 (60.1 KiB)
Нам необходим интерфейс который имеет доступ к внешней сети (в моём случае eth0). Теперь проверим поддерживает ли сетевой адаптер данную технологию и настроим её используя утилиту ethtool. Устанавливаем её:
apt-get install ethtool — для Debian
yum install ethtool — для CentOS
и запустим её, для просмотра информации о сетевом интерфейсе:
ethtool eth0
В ответ мы получим всю информацию о нашем сетевом интерфейсе:
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pg
Wake-on: d
Current message level: 0x0000003f (63)
drv probe link timer ifdown ifup
Link detected: yes
Где Supports Wake-on: pg — означает что наш сетевой интерфейс поддерживает технологию Wake On Lan, Wake-on: d — но она отключена.
Wake On Lan можно включить вручную 1 командой, но при каждой перезагрузке нашей машины он будет деактивироватся, для этого мы создадим и будем использовать специальный скрипт.
Для этого выполняем следующее:
cd /etc/init.d/
nano wakeonlanconfig
Добавляем в скрипт строки:
#!/bin/bash
ethtool -s eth0 wol g
exit
Даём права скрипту:
chmod a+x wakeonlanconfig
Создаём символическую ссылку и делаем наш скрипт исполняемым:
update-rc.d -f wakeonlanconfig defaults
Проверяем что всё нормально вводим команду:
/etc/init.d/wakeonlanconfig
Если ничего в ответ не получили, значит всё хорошо и можно проверить на практике.
Вот так вот просто настроить Wake On Lan в Linux
Источник
Ubuntu Documentation
This page explains how to enable use of Wake-on-LAN (WoL) in systems that have Ubuntu installed.
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.
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:
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
If WoL is not working as expected, there are a number of lines of investigation to follow:
- 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.
Ensure that no other network configuration software is interfering with WoL activity. network-manager may interfere with WoL activity in certain situations; removing it and configuring your network manually may solve some issues.
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 (последним исправлял пользователь g1orgosp 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
Источник
Ubuntu Linux: Install Wake On Lan Client For Server
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | None |
Est. reading time | N/A |
Ubuntu wake on lan client installation
Open a terminal and type the following command:
$ sudo apt-get install wakeonlan
Sample outputs:
How do I use wakeonlan client?
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Examples
Type the following command to wakeup a nas server called nas01 with 00:08:9b:c4:30:30 as mac address, enter:
$ wakeonlan 00:08:9b:c4:30:30
Sample outputs:
To use a subnet broadcast address:
$ wakeonlan -i 192.168.1.255 00:08:9b:c4:30:30
You can use another destination port:
$ wakeonlan -i 192.168.1.255 -p 2345 00:08:9b:c4:30:30
Finally, you can use a file as source of hardware and IP addresses:
$ wakeonlan -f
See also
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
WOL: Приключения «Волшебного Пакета» в Linux
Совсем недавно LeeMiller описал как воспользоваться посылкой «волшебного пакета» для удаленного включения компьютера под управлением Windows, большое ему спасибо.
Очень странно, что ни кто не спросил в комментариях, — А как же быть с Линуксом? Ничего не получается, у него нет, как минимум, Пуск — Панель Управления — Сетевые Подключения!
Либо все и так всё знают, либо это никому не надо, но я, всё же, рискну об этом написать.
Пост будет творческой переработкой моего стародавнего HowTo, опубликованного на forum.ubuntu.ru, написанного, в свою очередь, после чтения англоязычных мануалов.
UPD: перенёс в «Железо», поближе к топику-мотиватору. Смотрится странно, выслушаю пожелания на перенос в другое место.
Всю теорию и настройку BIOS’а я опускаю, её замечательно разобрал LeeMiller.
Нашей задачей будет заставить сетевую карту оставаться в ждущем режиме после выключения компьютера. Если в Windows для этого достаточно поставить одну галку, то в Linux настройки сетевой карты не запоминаются и надо их производить при каждом запуске системы. Для этого понадобится сделать скриптик и поставить его на загрузку ОС.
Опыты ставились над Ubuntu, но я думаю что с «другими линуксами» проблем возникнуть не должно.
Приступим
Наблюдаем результат наподобие
eth0 Link encap:Ethernet HWaddr 01:23:45:67:89:ab
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::215:f2ff:fe6f:3487/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:71495 errors:0 dropped:0 overruns:0 frame:0
TX packets:76190 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23164212 (22.0 MiB) TX bytes:7625016 (7.2 MiB)
Interrupt:217 Base address:0xd400
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1290 errors:0 dropped:0 overruns:0 frame:0
TX packets:1290 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:161182 (157.4 KiB) TX bytes:161182 (157.4 KiB)
В данном примере у нас одна сетевая карта, eth0. Если карт несколько, то их несколько 🙂
— Теперь создаем сам скрипт, для этого сначала необходимо получить права администратора:
Здесь я хочу обратить внимание на параметры: -s eth0 wol значит «заставить WOL карточки eth0» g — «ждать волшебного пакета». У WOL есть еще пяток вариантов чего ждать, но к данной теме это не относится.
Если никакого вывода не последовало и показалась следующая строка ввода — значит всё прошло гладко.
— Проверяем на практике.
Распечатываем данное руководство, выключаем первый компьютер и идём ко второму 🙂
Шлём пакет одним из предложенных LeeMiller’ом способов. Если способы не нравятся — рекомендую свой любимый, простенький веб-сервис, которым можно воспользоваться даже при помощи браузера в сотовом телефоне.
Хочу обратиться к тем, кто умнее меня, — если есть (наверняка есть) более красивый способ реализации — сообщайте, будем обновлять знания!
И благодарю LeeMiller’a за то что отсыпал кармы из волшебного пакета, без этого ничего бы не вышло.
Источник
Enabling Wake-On-LAN (In Ubuntu 20.10)
Table of Contents
Note: The systemd configuration here isn’t quite right, but since this post is kind of long and convoluted I made a standalone update about the systemd configuration file in this post.
Beginning
These are my notes on getting Wake-On-LAN working in Ubuntu 20.10. I have a server that I use to run most of the computation on when I use emacs/jupyter but I have it in a corner upstairs and although it’s only a little walk, I find that the fact that I have to stop what I’m doing and go upstairs to push that little button on the front makes me lazy and so it ends up running more than it has to so I thought I’d enable Wake-On-LAN so I can suspend it and wake it up whenever I need to. I’m only going to use suspend (APM S3). When I tried to use hibernate (S4) it ended up shutting down my machine (S5). Interestingly, my BIOS menu has an option to enable waking up from shutdown, but since my disk is encrypted, and I didn’t set up a separate SSH server, I have to go enter the passphrase to unlock the disk before the operating system can boot up, so it kind of defeats its own purpose.
Middle
Ethtool
The command I used to set up Wake-On-LAN on the remote machine is called ethtool. It’s in the Ubuntu repositories but wasn’t installed on my machine so I had to add it.
Checking the Interface
From what I’ve read, not all ethernet interfaces support Wake-On-LAN (although I’ve never seen one that doesn’t) so a quick check might be useful. First, find the name of your ethernet interface.
My machine shows four interfaces so I’ll just show the output for the interface I’m interested in rather than the whole output for the command.
Ethtool uses the name of the interface, in this case it’s enp4s0 , so we’ll need to note that. Additionally, the machine that I used to wake up the machine needs the MAC address ( 38:d5:47:79:ab:0b ) so it’d be useful to write that down someplace. I’m waking it up from the LAN so the IP address isn’t so important, and to be able to SSH into it I need to know it anyway, so it’s really those two pieces of information that I need. Now to check if it supports Wake-On-LAN.
Ethtool will give you some information if you don’t run it as root but for Wake-On-LAN you need to run it as root. The important lines in the output is near the bottom and it looks something like this if it supports Wake-On-LAN.
The man-page for ethtool tell you what that cryptic pumbg means — the letters are different options that this interface supports for Wake-On-LAN. In this case they are:
Option | Description |
---|---|
p | Wake on PHY activity |
u | Wake on unicast messages |
m | Wake on multicast messages |
b | Wake on broadcast messages |
g | Wake on MagicPacket messages |
There’s an additional option which is what the interface was set on – d – as you can see in the last line of the output. This means Disable (wake on nothing). This option clears all previous options. I don’t have many devices on my network, so I don’t know that there’s a lot of broadcasts, multicasts, etc. that would be waking it up all the time, but since one feature of Wake-On-LAN is that it only wakes the machine when it gets the «Magic Packet», only the g and d options matter. Now that I knew it was supported, it was time to try it out.
Turn It On Temporarily
The ethtool will turn on Wake-On-LAN, but (supposedly) everytime you reboot the machine it will reset to disabled. I haven’t really tested this out, but I’ll document how to make it permanent later, anyway.
So, as you might guess, we changed the Wake-On-LAN setting to listen for MagicPacket messages. You can check using the ethtool again.
The Wake-on line should have changed to:
Now to suspend the machine so we can test it out.
Test It Out
Now, on my local machine I needed to install wakeonlan. There’s a surprising number of programs to send the Magic Packet, but this just happened to be the one I used.
The default way to use wakeonlan is apparently to just pass it the MAC address of the computer to wake up, and it will send the Magic Packet out as a broadcast, so that’s what I did.
And then I pinged the machine and I waited. And I waited. And I waited… Eventually I went upstairs and saw that it was still sleeping so I pushed the power button to wake it up and went back downstairs.
Take Two
Something wasn’t right so I SSHd into the server and started up tcpdump to see if the packets were going through.
Which gave me this output:
And then I sent the Magic Packet again.
…And nothing happened. For some reason the packets weren’t getting picked up by the machine. Luckily, wakeonlan lets you pass in an IP address as an option. The man page recommends using a broadcast address, but I have the IP addresses of my machines on the LAN reserved on my router/access-point so I just passed in the full address (I did try the LAN broadcast and it worked too).
I have my machine’s IP address aliased in my /etc/hosts file so erebus is just an alias for the machine’s IP address. The subnet broadcast version looked like this.
The output from tcpdump for the first packet looked like this.
So, something was different. I suspended the machine again and sent the Magic Packet and this time it worked. Go figure.
Making It Permanent
Set It Up
The reasons that I said earlier that the Wake-On-LAN setting «supposedly» is temporary is that:
- I haven’t really re-booted that machine to test it out (I have rebooted, but I haven’t disable the systemd service that I’m documenting here).
- The machine that I’m typing this on had Wake-On-LAN enabled and it doesn’t have a systemd service enabled.
But, really, I don’t remember even enabling Wake-On-LAN on this machine so maybe it just was the default and I didn’t realise it… another thing I should look into one of these days. Anyway, to make a service that always enables Wake-On-LAN the first step is to find the path to ethertool .
In my case the path was /sbin/ethtool , so once you know this you can create a file at /etc/systemd/system/wol.service (I think you can use another systemd sub-folder, and you can name the file anything you want, within reason, but this one seems to work well enough). In this file you put settings that look something like this:
The only thing specific to my machine is enp4s0 , the name of the ethernet interface, although it’s possible that the path to the ethtool executable might be different too… but it should be the same on Ubuntu 20.10, anyway.
Enable The Service
To enable it you can do this:
Where wol.service is the name of the file you created with the settings. You can check its status if you want.
So, that’s how I got one machine working with Wake-On-LAN. Hopefully I won’t have to look so hard the next time. Here’s the pages that I stole this from.
- TechRepublic on using ethtool and setting up a systemd service for this (don’t use the systemd file here, though).
- Stack Overflow on how to suspend and hibernate from the command-line
- Stack Overflow on what the difference is between suspend and hibernate
- Stack Overflow on using tcpdump to look for the Magic Packets on the remote machine
- Stack Overflow on editing remote files as root with emacs (not documented here, but maybe later)
- Stack Overflow on editing a local file as root with emacs (not used here, but I can never remember the syntax)
Источник