如何找到 LAN 上另一台无法公开访问的计算机的正确 IP 地址?
我正在编写一个分布式 Java 应用程序,但网络方面的问题困扰着我。由于某种原因它无法正常工作。我认为这是因为我通过 ipconfig /all 获得的 IP 地址无法从 LAN 外部访问。我很感激任何提示或建议。
I am writing a distributed Java app, but the networking side of things is stumping me. For some reason it's not working correctly. I think it's because the IP address I get through ipconfig /all is not accessible from outside the LAN. I appreciate any tips or advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
概述
您需要通常称为的“NAT 穿越”,或ICE。当今互联网上使用两种主要协议:TCP 和 UDP。 TCP 套接字中携带了大量的会话状态信息;因此,它是一种比 UDP 更难用于 P2P 的协议。
UDP 隧道
以下列表是更通用的 STUN 协议 (RFC 5389) 您可以使用它来实现基于 UDP NAT 遍历的 P2P 服务...
建立 UDP 连接后,您可以使用 OpenVPN 之类的工具在两个客户端之间形成 UDP SSL VPN;这将为您提供一个简单的通道来启动客户端之间的 TCP 连接。然而,在此连接模型中需要考虑一些重要的安全和信任问题;它不太可能在互联网上的随机用户之间有用。
TCP
如果需要 TCP 连接,我建议查看此互联网草案 MMUSIC-ICE-TCP: 具有交互式连接建立 (ICE) 的 TCP 候选
Overview
You need what is commonly-known as "NAT Traversal", or ICE. There are two primary protocols used on the internet today TCP and UDP. TCP sockets carry a significant amount of session state information in them; consequently it is a significantly more difficult protocol to use for P2P than UDP.
UDP Tunneling
The following list is a simplified outline of the more general STUN Protocol (RFC 5389) that you could use to implement a P2P service based on UDP NAT Traversal...
After you have established UDP connectivity, you could form an UDP SSL VPN between the two clients using something like OpenVPN; this would give you a trivial channel to initiate a TCP connection between the clients. However, there are non-trivial security and trust issues to consider in this connectivity model; it is unlikely to be useful between random users on the internet.
TCP
If TCP connectivity is required, I suggest looking at this internet draft, MMUSIC-ICE-TCP: TCP Candidates with Interactive Connectivity Establishment (ICE)
某些 IP 地址不可路由: http://en.wikipedia.org/wiki/IP_address -如果您有其中之一,您将无法从局域网外部直接访问它。您可以从该 LAN 上的地址访问该 LAN 上的其他地址。
如果您在 LAN 之外,则无法启动与 LAN 上特定计算机的 tcp 连接,但该计算机可以与您启动一个 TCP 连接:http://en.wikipedia.org/wiki/Network_address_translator
some ip address are not routable: http://en.wikipedia.org/wiki/IP_address - if you have one of those, you wont be able to access it from outside the lan directly. you can access the other addresses on your lan from one that is on that lan.
if you are outside the lan, you can not start a tcp connection to a specific machine on the lan, but that machine can start one with you: http://en.wikipedia.org/wiki/Network_address_translator