网络唤醒问题(Ubuntu 16.04)

网络唤醒问题(Ubuntu 16.04)

抱歉,又发了一个关于局域网唤醒的问题,但浏览了我找到的其他帖子(包括本网站和其他网站上的帖子),我似乎无法解决我的问题。我正在尝试为 Ubuntu 16.04 机器设置局域网唤醒,尽管花了半天时间,但在发送魔术包后,我仍然无法让它唤醒。到目前为止,我已经做了以下事情:

  1. 在我的 BIOS 中启用局域网唤醒
  2. 在 NIC 中启用 LAN 唤醒(持久)
  3. 更改了 /etc/default/halt 和 /etc/default/tlp 设置(见下文)。
  4. 确认我发送的“魔术”数据包已经到达机器。

我希望有人能发现我做错的事情,或者能提出一些建议,以开辟一条新的调查途径;目前我已经没有主意了。谢谢你的帮助!

母板:配备板载 LAN 的 Asrock Xtreme4

调试/详细信息的长列表(命令上方的注释解释了我想要展示/做的事情):

#
# Networking devices; trying to wake-on-lan from the main ethernet 
# device 'enp0s31f6'
#
root@Ruby:/var/log# ifconfig
enp0s31f6 Link encap:Ethernet  HWaddr 70:85:c2:5e:48:c7
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::57be:f8e8:ad34:811d/64 Scope:Link        
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2018 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1036 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:296222 (296.2 KB)  TX bytes:171521 (171.5 KB)
          Interrupt:16 Memory:df200000-df220000

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:65536  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:234 (234.0 B)  TX bytes:234 (234.0 B)


#
# Ubuntu release information for machine being configured for WOL.
#
root@Ruby:/var/log# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"

#
# Detail information on the main ethernet device.  The 'g' character shows
# in both 'Supports Wake-on' and 'Wake-on' lines.  This same output is 
# consistent across system reboots (i.e., I don't have the issue with 'Wake-on'
# being changed to something like 'd' after reboot; this always shows up as
# 'g').
#
root@Ruby:/var/log# ethtool enp0s31f6
Settings for enp0s31f6:
        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:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: on (auto)
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000007 (7)
                           drv probe link
        Link detected: yes


#
# Modified the halt defaults and added 'NETDOWN=no' as seen below.
#
root@Ruby:/var/log# cat /etc/default/halt
# Default behaviour of shutdown -h / halt. Set to "halt" or "poweroff".
HALT=poweroff
NETDOWN=no


#
# Updated the power settings configuration to NOT disable WOL.  Not sure if
# this is really needed or not as this computer is not a laptop (simply following
# recommendations from online posts).
#
root@Ruby:/var/log# cat /etc/default/tlp | grep WOL
WOL_DISABLE=N


#
# Verified that magic packets are being received on the expected network device
# when sent from another linux machine.  Output from the command used to send the
# packets was:
#
#    $ wakeonlan -i 192.168.1.255 '70:85:c2:5e:48:c7'
#    Sending magic packet to 192.168.1.255:9 with 70:85:c2:5e:48:c7
#
# I ran this 3 times and produced the capture output below on the target machine (i.e.,
# the computer I'm trying to start up via WOL):
#   
root@Ruby:/var/log# tcpdump -i enp0s31f6 'udp and port 9'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp0s31f6, link-type EN10MB (Ethernet), capture size 262144 bytes
13:23:53.869476 IP hackpi.57568 > 192.168.1.255.discard: UDP, length 102
13:23:55.384924 IP hackpi.59471 > 192.168.1.255.discard: UDP, length 102
13:23:57.214933 IP hackpi.49245 > 192.168.1.255.discard: UDP, length 102


#
# When testing the wake-on-LAN settings I stop the machine with 
# 'shutdown -h now' then after the lights turn off I try to send the magic
# packet with the command previously shown (see tcpdump capture comments
# above).  No dice, machine never boots.
#
root@Ruby:/# shutdown -h now

Bios WOL 已启用:

BIOS 配置图

答案1

我百分之百确定你有不是启用了 LAN 唤醒。
您向我们展示的选项是PXE 启动.
在您的手册上母板第 77 页您需要启用 PCIE/PCI 设备电源
同样在同一手册的第 88 页中保持 PXE 启动。

因此,您需要更改 BIOS/UEFI 中的设置,然后一切就都正常了。
如果不行,请再读一遍这个 Ubuntu 手册并检查systemd没有关闭 WOL 位。

如果没有帮助,请发布新的信息。

答案2

Arch Linux 圣经中关于 WOL 的章节很多。在询问 Ubuntu答案:

systemd.link

/etc/systemd/network/50-wired.link

[Match]
MACAddress=aa:bb:cc:dd:ee:ff

[Link]
NamePolicy=kernel database onboard slot path
MACAddressPolicy=persistent
WakeOnLan=magic

系统服务

/etc/systemd/system/[email protected]

[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target

[Service]
ExecStart=/usr/bin/ethtool -s %i wol g
Type=oneshot

[Install]
WantedBy=multi-user.target

udev

/etc/udev/rules.d/81-wol.rules

ACTION=="add", SUBSYSTEM=="net", NAME=="enp*", RUN+="/usr/bin/ethtool -s $name wol g"

计划任务

@reboot /usr/bin/ethtool -s interface wol g

TLP 可以默认禁用 WOL

当使用 TLP 进行挂起/休眠时,WOL_DISABLE应将设置设为N允许/etc/default/tlp使用 WoL 恢复计算机。

相关内容