找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 3372|回复: 6

[虚拟机相关] 网络唤醒pve主机

[复制链接]
发表于 2022-6-20 11:55 | 显示全部楼层 |阅读模式
本帖最后由 hyr111 于 2022-7-5 17:34 编辑

原理 pve主机root权限下将网卡唤醒命令添加自启项(默认会使用ethtool命令,不会的请自行参考pve官方手册网络欢配置主机系统管理 (proxmox.com)
具体操作方法如下(把BIOS里面远程唤醒功能和PCI启动打开,硬件不支持就GG了)
          一、查找rc-local.service 文件如果你的版本没有这个文件,可以自己创建一个,然后把内容添加上去。
     vim /lib/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



二、创建 rc.local 文件

vim /etc/rc.local

#!/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.
#用ethtool开启网卡远程唤醒
/sbin/ethtool -s enp3s0 wol g

exit 0
我的网卡是enp3s0,将你的网卡替换上去
启动加载网卡唤醒自启服务
systemctl start rc-local
显示systemd[1]: Started /etc/rc.local Compatibility.即成功!
此方法还可以把需要开机启动的命令添加到 /etc/rc.local 文件,丢在 exit 0 前面即可,并尝试重启以后试试是否生效了


唤醒工具可以是APP也可以是路由自带网络唤醒,自行测试
如果有公网IP或者内网穿透,可实现远程唤醒pve(拓展远程唤醒任意一台主机







我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2022-6-20 16:18 | 显示全部楼层
本帖最后由 hyr111 于 2022-6-29 14:54 编辑

我是小白,有哪些不足的地方请各位及时指出.嘿嘿额
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-7-21 15:23 | 显示全部楼层
pve都是always online,反复开关机有什么意义呢?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-7-23 12:43 | 显示全部楼层
想添加实现远程关机开机功能而已,有时候为了体验折腾的乐趣。想always online,可以忽略哈
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-7-23 12:49 来自手机 | 显示全部楼层
不用这么麻烦,安装ethtool后,定时运行一下 0 16        * * *          root         /sbin/ethtool -s enp2s0 wol g
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2022-7-23 22:34 | 显示全部楼层
重启也生效?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-10-26 11:14 | 显示全部楼层
赞一个,回去试验一下;
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-26 08:44

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表