找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 14403|回复: 7

[其它] 分享我的ROS自动唤醒NAS电脑

[复制链接]
发表于 2019-11-6 10:30:23 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
一、我的nas是1037u小电脑一台
系统是win7
自动休眠时间是 2分钟
平时不关机。
.

二、
平时NAS电脑自动休眠
我这样实现 :
当我使用的时候 ros自动唤醒NAS
方法如下:
scheduler自己填写,我设定3分钟运行一次
RB191105.jpg
三、
外网远程桌面访问
四、
内部局域网共享
五、
这个NAS给一个单独的网段
.
routeros
发表于 2019-11-6 21:15:40 | 显示全部楼层
本帖最后由 47771885 于 2019-11-6 21:52 编辑

...支持下。。。

假设已知 mac 未知 ip 和 interface
NAS 可ping
!!! 需求 定期检测ARP项目 已知MAC 项目状态 未查找到、直接全向唤醒
如项目存在 (可能是静态的或者缓存)进行IP ping 检测,失败定向唤醒
!!!有需要可以加入一些 log 信息自动无条件唤醒NAS
  1. {
  2. ###www.ros.sh
  3. /ip arp
  4. :local testmac "20:19:47:77:18:85"
  5. :local test [find mac-address=$testmac !invalid]
  6. :local testip
  7. :local testit
  8. :if ([:len $test] > 0)  do={
  9. :set testip [get $test address]
  10. :set testit [get $test interface]
  11. :if ([/ping $testip count=5 interface=$testit]=0) do={
  12. /tool wol mac=$testmac interface=$testit
  13. }
  14. } else={
  15. /tool wol mac=$testmac
  16. }
  17. }
复制代码
##依据PC启动NAS不在线时唤醒NAS!!!也可以做一下PC ping 检测 不过感觉不是很有必要
!!!本例为PC 为非静态ARP 如为静态ARP 需要增加ping 或其他方式检测 也可以在别的地方 使用触发程序比如 dhcp
testmaca NAS mac
testmacb PC mac

  1. {
  2. ###www.ros.sh
  3. /ip arp
  4. :local testmaca "20:19:47:77:18:85"
  5. :local testmacb "20:18:47:77:18:85"
  6. :local testa [find mac-address=$testmaca !invalid]
  7. :local testb [find mac-address=$testmacb !invalid]
  8. :local testip
  9. :local testit
  10. :if ([:len $testb] > 0 )  do={
  11. :if ([:len $testa] > 0 )  do={
  12. :set testip [get $testa address]
  13. :set testit [get $testa interface]
  14. :if ([/ping $testip count=5 interface=$testit]=0) do={
  15. /tool wol mac=$testmaca interface=$testit
  16. }
  17. } else={
  18. /tool wol mac=$testmaca
  19. }
  20. }
  21. }
复制代码



ros 就是这么自由 这么任性
脚本量身定制-->www.ros.sh

routeros
回复 1 0

使用道具 举报

发表于 2019-11-7 11:58:41 | 显示全部楼层
高手就是高手
routeros
回复

使用道具 举报

 楼主| 发表于 2019-11-8 08:56:16 | 显示全部楼层
本帖最后由 xuxi3201 于 2019-11-8 08:57 编辑

昨天修改了一下,1 从arp检测 改为 list检测
2 单独网段
   NAS接ether2  地址锁定192.168.2.180
3 防火墙加一行
   add action=add-src-to-address-list address-list=2-180-9m address-list-timeout=9m chain=forward connection-state=new dst-address=192.168.2.180
4 WOL脚本自己写
5 每2分钟运行这个.
   rb191108.jpg

.
6

routeros
回复

使用道具 举报

发表于 2019-11-8 16:23:53 | 显示全部楼层
本帖最后由 cspm333 于 2019-11-8 16:26 编辑

netwatch是很方便的工具。假設
桌機ip:192.168.2.100
NAS ip:192.168.2.180(mac-address:00:F1:F3:1D:09:3B )

Snap14.png

Snap15.png

透過netwatch檢查桌機(192.168.2.100)有否在線,有的話再檢查NAS(192.168.2.180)有否在線。
若NAS沒在線,再喚醒NAS(mac-address:00:F1:F3:1D:09:3B)即可。


routeros
回复

使用道具 举报

 楼主| 发表于 2019-11-9 10:13:18 | 显示全部楼层
cspm333
我的设定:
1、当我不使用,NAS在半小时内“休眠”  --- 电源断电,我的目的是省电;
2、当我使用的时候,2分钟内,自动唤醒(不需要用手 按开机按钮)。我已经做到了。
routeros
回复

使用道具 举报

发表于 2019-12-3 13:08:14 | 显示全部楼层
不错~!用时才唤醒,不过一般公司用是24小时开着,不考滤休眠问题
routeros
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-4-16 18:49 , Processed in 0.080584 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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