Good day habravchane! It all started with the fact that working remotely in the terminal it was necessary to restart the server. Toli did not ask the day, thoughts were toli about something else and instead of the command:sudo shutdown -r nowsudo shutdown now Entersudo apt-get install ethtoolsudo ethtool <> | grep WakeSupports Wake-on: gThis suggests that the network card supports WOL and it is enabled. If
Wake-on: g
Supports Wake-on:a letter other than g , the network card does not support WOL. And if it is off
Wake-on: dthen enable it with the following command:
sudo ethtool -s <> wol g sudo bash -c "cat > /etc/init/wakeonlan.conf" <<'EOF' start on started network script for interface in $(cut -d: -f1 /proc/net/dev | tail -n +3); do logger -t 'wakeonlan init script' enabling wake on lan for $interface ethtool -s $interface wol g done end script sudo chmod +x /etc/init/wakeonlan.confsudo service wakeonlan startinterface Xip directed-broadcast!!ip nat inside source static udp abc255 7 interface Y 7 #!/usr/bin/perl -w # wol.pl, written 20031220 by Walter Roberson robe...@ibd.nrc-cnrc.gc.ca # this program constructs a WOL (Wake on Lan) packet suitable for # sending locally or over a net. The MAC of the system to be woken # is required. # # The IP address the user supplies should NOT be # the IP address of the system to be woken: instead it should be the # subnet directed broadcast IP (eg, 192.168.1.255) of any subnet # known to be present on the segment of the target system. This # would usually be the directed broadcast IP of the target system itself, # but need not be in cases of multiple subnets that aren't carefully # VLAN'd away from each other. # # To repeat: do NOT use the IP address of the target system. Not unless # you are on the same subnet and you are using a static ARP entry. # The target system is asleep, so it isn't going to answer an ARP # from a router trying to find that particular address. Use a # broadcast address, or some other packet forwarding trick. use strict; require 5.002; use Socket; use Sys::Hostname; my ( $hisiaddr, $hispaddr, $hisMACtext, $hisaddr, $hisport, $proto, @MACbytes, $hisMACbin, $magicbody ); die "Syntax: $0 MAC ipaddr [port]" if @ARGV < 2; $hisMACtext = shift @ARGV; $hisaddr = shift @ARGV; $hisport = shift @ARGV || 22357; # default 'WU', no significance $magicbody = "\xff" x 6; @MACbytes = split /[:-]/, $hisMACtext; die "MAC wrong size" unless @MACbytes == 6; $hisMACbin = pack "H*H*H*H*H*H*", @MACbytes; $magicbody .= $hisMACbin x 16; $proto = getprotobyname('udp'); socket(SOCKET, PF_INET, SOCK_DGRAM, $proto) || die "socket: $!"; $| = 1; print "WOL packet being sent to udp port $hisport of ip $hisaddr\n"; $hisiaddr = inet_aton($hisaddr) || die "unknown host $hisaddr"; $hispaddr = sockaddr_in($hisport, $hisiaddr); defined(send(SOCKET, $magicbody, 0, $hispaddr)) || die "send $hisaddr: $!"; chmod +x wol.pl./wol.pl <MAC XX-XX-XX-XX-XX-XX> < IP > < udp ( 7)>Source: https://habr.com/ru/post/184950/
All Articles