dongniuxia8650 2018-06-23 19:09
浏览 513

如何在NAT后面的两个节点之间通信?

I have some nodes. Each node belongs to other network. Each node has private IP like 192.168.0.2 and stays behind NAT.

Is there any possibility to communicate between Nodes? Actually, I need to transfer files between these independent nodes.

I try to use this project - https://github.com/libp2p/go-libp2p. But libp2p has some limitations:

  1. Both nodes have private IP address (same network)
  2. At least one of them has a public IP address.

But I have nodes with private IP address, and they belongs to different network.


Update.

There are such solutions:

  • 写回答

3条回答 默认 最新

  • dqy92287 2018-06-23 21:38
    关注

    Max, I make it an answer to your question.

    Which computers you can reach configured on a network or cannot reach, cannot be overridden by software on a computer. That would be a security-breach, and it could be a cause for address conflicts, because in different NAT-areaś the same IP addresses can be in use.

    So, You cannot see computers behind a router, if that router uses NAT. The router does not advertise these addresses.

    The purpose of NAT is to have a special island of IP-addresses which no-one outside the NAT section can see. In this way, a company can use fewer unique IP-addresses to have a good functioning network. Another purpose is security. The router also hides the MAC-addresses of the computers inside the NAT area. A router can hide many things.

    Computers inside a NAT-area can initiate contact to computers outside the NAT ((if permitted) the router will remember the computer and keep a address-translation for it), but there is no way a computer outside the NAT can address a computer inside the NAT. It can only reply to a computer from inside. It does that by replying to the router, and the router will know to which computer in the NAT area to forward the reply.

    Go does not provide libraries which can solve these external limitations. Live with it. There is nothing you can do.

    As JBuchel explains the skype model can work if there are some extra provisions, like open UDP ports, and extra server/computer, etc. This is in fact a rearrangement of the network configuration, which cannot be done without the help of system/network administrators.

    But if there is support on that level, the solution is so much easier, just remove the computer from the NAT and give it an IP address that is visible for the other computer.

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?