Autonat Enabled in Source Code but Port Forwarding Still Required

Issue Report

I’m not very familiar with libp2p, and I’m encountering an issue in the Subspace project.

I noticed that in the source code of the Subspace project, the Autonat feature for libp2p configuration has already been enabled (you can check the code at this link).

However, when starting the Subspace node, it is still necessary to enable router port forwarding as described in this guide. If port forwarding is not enabled, the number of connected peers is extremely small(only about 3 to 4 peers).

I’m wondering why, even though the Autonat feature is enabled, port forwarding is still required. Could someone please provide some insights on this issue? Thanks!

Environment

  • Operating System:
    Ubuntu22.04
  • Space Acres/Advanced CLI/Docker:
    Advanced CLI

Autonat is a feature that helps identifying whether client is behind NAT or not.
It doesn’t do hole punching or anything that would make port forwarding unnecessary.

Can we leverage Hole-punching to eliminate the need for router port forwarding?

It may reduce the need for port forwarding, but it is far from 100% effective, especially in many-to-many scenario, and will not be able to eliminate the need for router port forwarding.

Having a fixed port is also helpful for long-term network connectivity since they remain reachable long after previous use, while hole punching is ephemeral and if such address is persisted, it’ll quickly become useless.

Thank you for your explanation!

Although, as you said, “It may reduce the need for port forwarding, but it is far from 100% effective, especially in many-to-many scenario, and will not be able to eliminate the need for router port forwarding.”, I believe that to some extent, it can solve the problems of users who are unable to forward ports without affecting the normal use of users who forward fixed ports.

Moreover, I’ve found that many blockchain projects have adopted the Holepunching technology. For example:

Can we enable Holepunching for autonomys?

It is not as easy as just “enabling”, it is a bit more involved. We did look into it in the past and decided it wasn’t something we wanted to invest resources into, see Research the hole-punching solution for DSN. · Issue #2111 · autonomys/subspace · GitHub for detailed rationale.

2 Likes