RouterOS version: 6.39.2
要從 Internet 喚醒區網內的電腦有三個部份要設對,分別是電腦要啟動 WOL,RouterOS 要建立相關規則,WOL clinet 軟體要設定正確。
RouterOS 部份只需建立兩條規則即可,以下是可以喚醒區網中兩台電腦的範例。
規則1: 防火牆設定
/ip firewall nat add action=dst-nat chain=dstnat comment="Computer1" dst-address-type=local dst-port=9000 protocol=udp to-addresses=192.168.1.250 to-ports=9 add action=dst-nat chain=dstnat comment="Computer2" dst-address-type=local dst-port=9001 protocol=udp to-addresses=192.168.1.251 to-ports=9
- 其中
dst-port
要跟你使用的 WOL clinet 軟體設定相同,而to-addresses
則要設在同一個網段,並且避開 RouterOS 使用的 dhcp 範圍。 - 例如我的 dhcp 設定範圍從 192.168.1.150 ~ 192.168.1.199,所以 to-addresses 我使用 192.168.1.250 與 192.168.1.251。
這是我的 dhcp 設定:
/ip pool print # NAME RANGES 0 dhcp 192.168.1.150-192.168.1.199
規則2: 設定靜態ARP轉送
/ip arp add address=192.168.1.250 comment="Computer1" interface=bridge mac-address=FF:FF:FF:FF:FF:FF add address=192.168.1.251 comment="Computer2" interface=bridge mac-address=FF:FF:FF:FF:FF:FF
address
必須跟前面防火牆設定使用的 to-addresses 相同。interface
則選擇要喚醒電腦的 interface name,在這裏我使用的是 MikroTik RB3011UiAS-RM 這台機器,因為它內建兩個硬體 switch 與 sfp 介面,所以機器預設建立了一個軟體 bridge 來橋接兩個硬體 switch與 sfp,所以 interface 這裏我是設 “bridge“。如果使用的是像 RB450G 之類只有一個硬體 switch 的機器,預設是不會有軟體 bridge 的規則,所以要設成 “ether2-master“。
這是 RB3011UiAS-RM bridge 預設:
/interface bridge add admin-mac=6C:3B:6B:EF:46:2E auto-mac=no comment=defconf fast-forward=no name=bridge /interface bridge port add bridge=bridge comment=defconf interface=ether2-master add bridge=bridge comment=defconf interface=ether6-master add bridge=bridge comment=defconf interface=sfp1
mac-address
則固定設成 FF:FF:FF:FF:FF:FF (boardcast address) 即可。
以上是 RouterOS 的設定部份,而 client 端的 WOL 軟體我是使用 iOS 上 “Mocha WOL” 這個 apps。
IP Address 填要喚醒電腦 IP 或 domain name
- MAC Address 填要喚醒電腦 LAN 卡的 MAC address
- WOL Port 跟 RouterOS 防火牆設定 中使用的 Port 相同 ( Computer1 port: 9000, Computer2 port: 9001)
電腦端確定 LAN WOL 有啟動。