WOL持久化配置

  1. 保证bios和网卡支持WOL唤醒,并关闭低功耗模式
  2. 此命令仅在Ubuntu20.04LTS上测试通过,其余发行版同理,请自测

参考链接
https://www.techrepublic.com/article/how-to-enable-wake-on-lan-in-ubuntu-server-18-04/
https://help.ubuntu.com/community/WakeOnLan#External_Links

WOL开启设置

~ sudo  apt-get install ethtool #安装管理工具
~ ip a #查询网络状态等信息。。。
~ sudo ethtool  -s enp1s0 wol g #使能WOL功能
~ sudo ethtool enp1s0  #查询是否使能成功        
Settings for enp1s0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: Symmetric
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: pumbg
	Wake-on: g  #标志位为 g 即已开启WOL, d 则相反
	Current message level: 0x00000033 (51)
			       drv probe ifdown ifup
	Link detected: yes

WOL持久化设置(保证重新开机仍然开启网卡的WOL功能)

创建一个WOL开机进程

sudo nano /etc/systemd/system/wol.service

写入内容

[Unit]
Description=Configure Wake On LAN

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

[Install]
WantedBy=basic.target

使systemd知道新的WOL脚本

sudo systemctl daemon-reload

使能WOL脚本

sudo systemctl enable wol.service

启用WOL脚本

sudo systemctl start wol.service

posted @ 2020-07-28 14:22  橘子国王  阅读(609)  评论(2编辑  收藏  举报