获取NAT转换的IP和某些本地端口的端口 [英] Get the NAT translated IP and port of some local port

查看:385
本文介绍了获取NAT转换的IP和某些本地端口的端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NAT后面的计算机上的端口50885上运行了一些软件

I have some software running on port 50885 on a computer behind a NAT

如何从互联网访问此端口? 我可以在启动应用程序时从计算机启动一些操作.

How can I access this port from the internet? I can initiate something from the computer as I have to launch the app.

如果我没错:用我的本地地址:端口,可以说:192.168.0.10:50885 如果某些内容通过计算机启动的NAT,则应该自动创建某种类型的端口转发,并且应该存在某种公用IP:PORT,该IP:PORT应该会敲打NAT后面计算机上的50885端口.我说的对吗?

If I get it correctly : with my local address:port, lets say : 192.168.0.10:50885 If something goes trough the NAT initiated by the computer, Then there should be some sort of port forwarding created automatically and there should be some sort of publicly IP:PORT that should knock on the 50885 port on the computer behind the NAT. Am I right?

如果是这样,不可能询问类似php的服务器端脚本,嘿,告诉我这个公开的IP是什么?端口是?

If so, wouldn't it be possible to ask a server-side script like in php, Hey, tell me what this publicly IP & Port are?

我对端口转发有些困惑.

I'm a bit confused about Port Forwarding.

推荐答案

根据我的理解,假设您使用套接字local_ip:local_port连接remote1_ip:remote1_port.在NAPT设备之后,local_ip:local_port变为translation_ip:translated_port. remote1可以获取translation_ip:translated_port,但我没有找到这样的服务.下次您使用相同的客户端local_ip:local_port与remote2_ip:remote2_port建立新连接时,translation_ip:translated_port会保持不变吗?通常,NAPT服务器将保留它一段时间,例如5分钟.因此,如果某个人从remote3:remote3_port在5分钟内连接了translation_ip:translated_port(因为最后一个数据包已发送到translation_ip:translated_port),则NAPT服务器会将流量定向到local_ip:local_port.如果remote3_port = remote1_port,尽管remote1_ip!= remote1_ip,则连接将被本地套接字接受.如果信息过期,则NAPT服务器将分配一个新的translation_ip2:translated_port2.

Per my understanding, assuming you use socket local_ip:local_port to connect remote1_ip:remote1_port. After NAPT device local_ip:local_port becomes translated_ip:translated_port. remote1 can get translated_ip:translated_port but I have not found such service. Next time you establish a new connection with remote2_ip:remote2_port with the same client local_ip:local_port, will translated_ip:translated_port be kept unchanged? Normally NAPT sever will reserve it for some time, say 5 minutes. So if someone from remote3:remote3_port to connect translated_ip:translated_port within 5 minutes (since the last packet sent to translated_ip:translated_port), NAPT server will direct traffic to local_ip:local_port. If remote3_port=remote1_port, though remote1_ip!=remote1_ip, the connection will be accepted by the local socket. If the information expired, NAPT sever will allocate a new translated_ip2:translated_port2.

这篇关于获取NAT转换的IP和某些本地端口的端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆