保證bios和網卡支持WOL喚醒,並關閉低功耗模式 此命令僅在Ubuntu20.04LTS上測試通過,其餘發行版同理,請自測 參考鏈接 https://www.techrepublic.com/article/how-to-enable-wake-on-lan-in-ubuntu-server-18 ...
- 保證bios和網卡支持WOL喚醒,並關閉低功耗模式
- 此命令僅在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
完