使用nas唤醒其他PC主机

参考:

https://kb.synology.com/en-ph/DSM/help/Docker/docker_network?version=6

https://stackoverflow.com/questions/33101603/send-a-wake-on-lan-packet-from-a-docker-container

https://www.cnblogs.com/freeaihub/p/13197292.html

https://blog.csdn.net/matrix273/article/details/104661015/

 

最近之前买的向日葵开机棒坏了,没法唤醒家里局域网里的主机了,然后在网上看看能不能用命令唤醒其他主机。

 

下面是我的做法:

在Ubuntu下有一个名为wakeonlan的命令,在nas里面启动一个运行ubuntu的docker容器,需要注意的是,创建容器的时候,需要将容器的网络设置为host,这样容器和主机使用同一个网络命名空间。

 

 

安装wakeonlan:

sudo apt install wakeonlan

 用法:

root@ubuntu_host_net:~# wakeonlan
Usage
    wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]

Options
    -h
        this information
    -v
        displays the script version
    -i ip_address
        set the destination IP address
        default: 255.255.255.255 (the limited broadcast address)
    -p port
        set the destination port
        default: 9 (the discard port)
    -f file
        uses file as a source of hardware addresses

See also
    wakeonlan(1)

 

测试:

wakeonlan 2C:F0:5D:A0:AB:5B

 

完。

posted @ 2021-07-03 00:11  摩斯电码  阅读(554)  评论(0编辑  收藏  举报