PVE 局域網喚醒支持


第一步:

是要把bios里面遠程喚醒功能和PCI啟動打開

第二步:

在PVE里面的SHELL或者SSH安裝 ethtool 工具,安裝命令:

apt-get install ethtool

第三步:

用ethtool工具查看網卡信息,如果是多網卡的話,需要先搞清楚哪個是鏈接外網的管理口,舉例網卡為enp3s0

ethtool enp3s0

找到網卡信息中的supports wake-on和wake-on兩個參數,如果supports值為pumbg,表示網卡支持遠程喚醒,wake-on的值d表示禁用、g表示開啟,默認為d。

第四步:用ethtool開啟網卡遠程喚醒,把wake-on值改為g

ethtool -s enp3s0 wol g

因為每次重啟后會失效,所以我們需要把開啟命令寫入開機自動執行腳本。

第五步:

編輯  /etc/rc.local文件,寫入開機自動執行開啟遠程喚醒的腳本。

nano /etc/rc.local

插入以下代碼后保存重啟all done

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/sbin/ethtool -s enp3s0 wol g 

exit 0

 

比較新的Linux發行版已經沒有rc.local文件了。因為已經將其服務化了。

解決方法:

1、設置rc-local.service

1
2
3
4
5
6
7
8
9
10
11
12
13
sudo vim /etc/systemd/system/rc-local.service
[Unit]
  Description=/etc/rc.local Compatibility
  ConditionPathExists=/etc/rc.local
[Service]
  Type=forking
  ExecStart=/etc/rc.local start
  TimeoutSec=0
  StandardOutput=tty
  RemainAfterExit=yes
  SysVStartPriority=99
[Install]
  WantedBy=multi-user.target

2、激活rc-local.service

1
sudo systemctl enable rc-local.service

3、添加啟動服務

手工創建或者拷貝已有的/etc/rc.local,並賦予執行權限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
 
# 下面這條是要開機啟動的命令
/home/selfcs/anaconda3/bin/python /home/selfcs/t.py > /home/selfcs/auto.log
 
exit 0
#給予腳本執行權限
sudo chmod +x /etc/rc.local


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM