如何使网络唤醒在 Debian buster 中持久存在?

如何使网络唤醒在 Debian buster 中持久存在?

我使用的是 Debian 10 buster。输出sudo ifconfig -a

enp0s7: flags=xxxx<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.xx.xxx  netmask 255.255.xxx.x  broadcast 192.168.xx.xxx
        inet6 xxxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx  prefixlen xx  scopeid 0x0<global>
        inet6 xxxx::xxxx:xxxx:xxxx:xxxx  prefixlen xx  scopeid 0x20<link>
        inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx  prefixlen xx  scopeid 0x0<global>
        ether xx:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 68866  bytes 72160614 (68.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 33033  bytes 5158947 (4.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4  bytes 240 (240.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 240 (240.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

猫的输出cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

我尝试仅添加一行,如/sbin/ethtool -s enp0s7 wol g上面的文件。但重启后仍显示局域网唤醒d

之前的输出

Settings for enp0s7:
    Supported ports: [ MII ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    Supports Wake-on: g
    Wake-on: d
    Link detected: yes

输出后sudo /sbin/ethtool -s enp0s7 wol g

Settings for enp0s7:
    Supported ports: [ MII ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: MII
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    Supports Wake-on: g
    Wake-on: g
    Link detected: yes

我在 bios 中启用了局域网唤醒(pcie 唤醒)。
我想我需要添加更多行/etc/network/interfaces才能使其正常工作。建议修复。

答案1

您必须创建一个专用的服务,以便在启动时启用 WOL:

$ cat /etc/systemd/system/wol.service
[Unit]
Description=Configure Wake-up on LAN

[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s eth0 wol g

[Install]
WantedBy=basic.target

然后使用以下命令启用该服务:

sudo systemctl enable wol.service
sudo systemctl daemon-reload

最后,重新启动机器或服务器并使用检查配置sudo ethtool eth0

来源 :Debian WOL 的法语文档

答案2

cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

/sbin/ethtool -s enp0s7 wol g我尝试仅添加如上述文件中的一行。

不要添加上面那行,而是添加下面这行:

ethernet-wol g

答案3

为了使网络唤醒在 Debian buster 中持久存在,您需要编辑配置文件并更改包含“1”的行。

相关内容