【问题标题】:Why the magic packet can wake_on_lan via lan instead of wan?为什么魔术包可以通过 lan 而不是 wan 唤醒?
【发布时间】:2021-01-19 07:24:25
【问题描述】:

我的简单家庭网络环境:modem(pppoe) + router + pc。 调制解调器是光纤到户 (FTTH) 的 FTTH 设备,通过光纤传输通信信号。
在 BIOS 中设置:

Advanced--Realtek Lan Controller--enabled
        --Realtek Pxe Option Rom--enabled
Advanced--APM--Power on by PCI-E 

在路由器中设置:

the ip (192.168.31.52) and mac address are binded together

我 android 的 qpython3 中的 start_lan.py 脚本:

from wakeonlan import send_magic_packet
send_magic_packet('mac address of my pc') 

在我的android手机上打开wifi并从android的qpython3运行start_lan.py,我的电脑通过局域网在局域网上唤醒,成功!
然后我想通过WAN(外部互联网环境)唤醒局域网,有两种状态要讨论,一种状态保持路由器在网络结构中,另一种状态不。
状态一:

modem(pppoe) + pc
#Remove router 

状态 2:

Keep the web structure as same as wake_on_lan via lan.

Set port forwarding on my router:  

    name  protocol      external port        inner ip address   inner port
    wan   TCP and UDP   30000                192.168.31.52       9
    #the default port for wake on lan is 9.

When request my pc's public ip on the port 30000,it will be forwarded into 192.168.31.52 on the port 9. 

这两种状态都在我的 android 的 qpython3 中使用几乎相同的 start_wan.py 脚本: 对于状态 1:

from wakeonlan import send_magic_packet
send_magic_packet('mac address of my pc',ip_address='public ip') 

对于状态 2:

from wakeonlan import send_magic_packet
send_magic_packet('mac address of my pc',ip_address='public ip',port=30000) 

执行脚本,我的电脑无法唤醒!FTTH设备重要吗? 如何解决?

【问题讨论】:

  • 您是否转发了 UDP 端口 9?典型的端口转发是 TCP。

标签: python-3.x router wake-on-lan


【解决方案1】:

有些ISP只为用户开放知名端口,把端口nmuber改小一点。

在我的路由器上设置端口转发:

name  protocol      external port        inner ip address   inner port
wan   TCP and UDP   9                     192.168.31.52       9

已验证两种状态都可以使用相同的代码sn-p如下:

from wakeonlan import send_magic_packet
send_magic_packet('mac address of my pc',ip_address='public ip',port=9) 

【讨论】:

    猜你喜欢
    • 2022-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多