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!
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.
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.
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: