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 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?