问题描述
我正在尝试使用UPnP打开端口,所以我正在尝试miniupnpc
。我观察到少数人使用并建议upnpc -a <internal ip> <internal port> <external port> <protocol>
打开指定的外部端口,并将其指向在指定的内部端口上运行的应用程序。
在继续之前,我将注意到路由器的设置中UPnP已打开,并且其中列出了一些连接,尽管当我用port checker检查它们时,我发现它们实际上都没有起作用吗?或至少没有一个是开放的。
当我尝试使用以下命令将内部端口5000
映射到外部端口7777
时:
upnpc -a 192.168.1.10 5000 7777 tcp
我发现它可以“正常工作”,没有任何明显的错误,但是 它映射到的外部IP根本不是真正的外部IP。以下是上面给出的命令的输出:
upnpc : miniupnpc library test client,version 2.1.
(c) 2005-2019 Thomas Bernard.
Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.1:5000/Public_UPNP_gatedesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
Found a (not connected?) IGD : http://192.168.1.1:5000/Public_UPNP_C3
Trying to continue anyway
Local LAN ip address : 192.168.1.10
ExternalIPAddress = 192.168.0.153
InternalIP:Port = 192.168.1.10:5000
external 192.168.0.153:7777 TCP is redirected to internal 192.168.1.10:5000 (duration=0)
很显然,192.168.0.153
不是一个外部IP地址,但似乎在对待它。为什么会这样?
编辑:经过进一步检查,似乎由于我设置了多路由器,因此这里的“外部ip”实际上是辅助路由器的内部ip。我不知道为什么会这样,是否可以绕开它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)