- Wake on lan linux terminal
- 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
- How To Wake Up Computers Using Linux Command [ Wake-on-LAN ( WOL ) ] By Sending Magic Packets
- Client Software
- Linux Install etherwake Under Debian / Ubuntu Linux
- Installing a tool to send a Wake-On-LAN “Magic Packet” on RHEL/CentOS Linux
- Installing wakeonlan on macOS Unix
- How Do I Send WOL Magic Packets Under Linux?
- Examples
- How Do I Verify That Remote Linux Server Supports Wake-on-LAN (WOL)?
- How to use the wakeonlan in your backup scripts
Wake on lan linux terminal
Как настроить 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
Источник
How To Wake Up Computers Using Linux Command [ Wake-on-LAN ( WOL ) ] By Sending Magic Packets
W ake-on-LAN (WOL) is an Ethernet networking standard that allows a server to be turned on by a network message. You need to send ‘magic packets’ to wake-on-lan enabled ethernet adapters and motherboards to switch on the called systems. Make sure you connect the NIC (eth0 or eth1) with the motherboard and enable the BIOS’s WOL function. This is a quick guide to enable WOL under RHEL / Fedora / CentOS / Debian / Ubuntu Linux.
Client Software
It would be best if you used software to send WoL ( Wake-on-LAN ) magic packets to the target system. You will find various tools for all modern operating systems, including MS-Windows 8/10, Apple macOS & OS X, all modern Linux distros, FreeBSD, OpenBSD, NetBSD and many smartphones.
Linux Install etherwake Under Debian / Ubuntu Linux
We use the etherwake command to send a Wake-On-LAN “Magic Packet” under Linux operating systems. Type the following apt-get command/apt command to install the same under Debian / Ubuntu Linux desktop:
## apply all patches on Debian/Ubuntu ##
$ sudo aptitude install etherwake
## OR ##
$ sudo apt install etherwake
Session:
Installing a tool to send a Wake-On-LAN “Magic Packet” on RHEL/CentOS Linux
There is also Perl script to wake up computers. We can install it as follows on Debian/Ubuntu Linux:
sudo apt-get install wakeonlan
Type the following dnf command/yum command on your Fedora/RHEL/CentOS system. For instance:
$ sudo yum install net-tools
Outputs from my RHEL 8 box:
Red Hat Linux and friends users should use the net-tools package, which may be installed by default. The command name is ether-wake.
- 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 ➔
Installing wakeonlan on macOS Unix
How Do I Send WOL Magic Packets Under Linux?
Type the following command:
# wakeonlan MAC-Address-Here
OR
# etherwake MAC-Address-Here
# etherwake -D MAC-Address-Here
RHEL / Centos / Fedora Linux user, try:
# ether-wake MAC-Address-Here
If your MAC address were xx:yy:zz:11:22:33, you would type:
# wakeonlan xx:yy:zz:11:22:33
OR
# etherwake xx:yy:zz:11:22:33
Where,
- xx:yy:zz:11:22:33 is remote servers mac address. You can obtained mac address using combination of the ping command and arp command:
ping -c 4 server3 && arp -n
Examples
Here is how to use the limited broadcast address (255.255.255.255):
$ wakeonlan mac
$ wakeonlan mac-1 mac-2
Using a subnet broadcast address:
$ wakeonlan -i 192.168.1.255 mac
We can use another destination port too
$ wakeonlan -i 192.168.1.255 -p PORT mac
$ wakeonlan -i 192.168.1.255 -p 4242 mac
We can use a file as source of hardware and IP addresses:
$ wakeonlan -f homelab.wol
$ wakeonlan -f homelab.wol mac
The following is an example of a text file containing hardware addresses (macs). Let us display it using the more command or cat command/less command:
more homelab.wol
Sample config file:
How Do I Verify That Remote Linux Server Supports Wake-on-LAN (WOL)?
First, reboot the remote server and go to BIOS > Power Management > “Wake On LAN”. Please turn WoL on. Next, save and close the bios settings. After activating Wake On LAN (WoL) in your BIOS hardware option for the network interface card, it is also necessary to activate it using ethtool. The ethtool command will configure eth0 to respond to the magic packet:
# ethtool -s eth0 wol g
Where,
- -s eth0 : Your NIC. Feel free to replace eth0 with your actual network interface device name.
- wol g : Sets Wake-on-LAN options using MagicPacket.
Type the following command to see current status of wol for eth0:
# ethtool eth0
Output from my NAS server:
If you are using RHEL / SL / Fedora / CentOS Linux, edit /etc/sysconfig/network-scripts/ifcfg-eth0:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Add / modify the following line:
Save and close the file. If you are using Debian / Ubuntu Linux, edit /etc/network/interfaces:
# vi /etc/network/interfaces
Append the following to eth0:
How to use the wakeonlan in your backup scripts
Here is a sample shell script that will wake up my laptop (IP 192.168.2.25 and mac 48:2a:e3:5c:16:bc) from my rsnapshot Linux backup server:
Источник