2020-05-07

广域网中远程唤醒计算机故障排查

作者 关文津

自从家里的路由器清空配置升级以后,本来可以通过广域网远程唤醒的服务器变得不可用。周六有空终于把该问题解决。Openwrt安装有etherwake,该工具在局域网可以正常唤醒服务器。

1, 查看arp信息,注意Flags

[root@Openwrt:/root]#arp
IP address       HW type     Flags       HW address            Mask     Device
192.168.1.2      0x1         0x2         00:0b:2f:xxxxxx     *        br-lan

2, arp状态有permanent | noarp | stale | reachable,将服务器的arp信息更改成永久即可解决。

[root@Openwrt:/root]#ip neigh help
Usage: ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ]
          [ nud { permanent | noarp | stale | reachable } ]
          | proxy ADDR } [ dev DEV ]
       ip neigh {show|flush} [ to PREFIX ] [ dev DEV ] [ nud STATE ]

[root@Openwrt:/root]#ip neigh change 192.168.1.2 lladdr 00:0b:2f:xxxxxxxx nud permanent  dev br-lan

3, 再次查看arp信息,注意Flags

[root@Openwrt:/root]#arp
IP address       HW type     Flags       HW address            Mask     Device
192.168.1.2      0x1         0x6         00:0b:2f:xxxxxx     *        br-lan

4,局域网etherwake唤醒服务器,成功。

[root@Openwrt:/root]#etherwake help
usage: ether-wake [-i <ifname>] [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55
   Use '-u' to see the complete set of options.
[root@Openwrt:/root]#etherwake -i br-lan 00:0b:2f:xxxxxx 

5,广域网使用android平台“Wake On Lan”唤醒,成功。

图片无替代文字

6,最后将arp绑定命令添加进开机启动脚本。

[root@Openwrt:/root]#cat /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
/usr/bin/ip neigh change 192.168.1.2 lladdr 00:0b:2f:xxxxxxxx  nud permanent  dev br-lan
 
exit 0