I'm testing a P2P node running on Android/Termux behind CGNAT.
For testing, I used a temporary Pinggy tunnel to expose one node.
The remote node discovered the peer and successfully synced the chain. The "/chain" response from the public endpoint matched both local nodes (3 blocks).
POST /add_peer → 200
GET /peers → 200
GET /chain → 200
Public endpoint → 3 blocks
127.0.0.1:5000 → 3 blocks
127.0.0.1:8080 → 3 blocks
Is this a reasonable approach for testing P2P connectivity behind CGNAT, or is there a better approach?
Yeah - for a smoke test that is a success.
Tunneling the termux node through Pinggy only provides an ephemeral public address with which an other peer can reach out to your node - pairing on 3 blocks both locally and the public exposed connection indicates that your app-layer connection between the nodes has been established (peer add, discover and sync).
This not in fact a real CGNAT setup yet (the connection with pinggy is simply routing inbound traffic over your own, outbound connection), so not "punching trough" the carrier's CGNAT - but it works for the purpose of testing the network path. You more normally see a fixed public seed(later on maybe STUN/TURN/relay) so that the phone just establishes the outer dial.
But for what your were trying it out seems like good result!
Thanks, that makes sense. The Pinggy test was mainly useful for checking the application-layer peer discovery and synchronization.
I'll keep in mind that it doesn't demonstrate actual CGNAT traversal. Thanks for the clarification.
Yeah, to top off Cinexa here a little. If you are looking to get "does my node handle CGNAT ok", this test does not really give everything you need, as Pinggy is basically doing the hard bit for you. It does not necessarily have awareness, or active behind a translated IP, it is simply communicating with a "holed" tunnel.
To test it, try running 2 nodes (using docker networks or VMs is perfectly fine here, and one does not need real hardware), and do not have either of them complete a tunnel or give any relay to each other. Then test to see, they are able to locate each other at all. That is more the real problem with CGNAT.
If things do not matter, it will help you with something you already did, you can use peer discovery/sync/all this app level stuff. Not the same as it will survive CGNAT though.
Thanks for the additional explanation. I'll try the two-node test without a tunnel and see whether the nodes can discover each other directly.
Also, if you're interested, would you be willing to help test Queen? Even just running a node and reporting any bugs or networking issues would be very helpful.