关于IPFS p2p实验特性基础使用方法的技术问询
Let’s walk through your questions one by one to clear up the confusion:
1. What does "application" refer to in the address /ip4/127.0.0.1/tcp/10101?
The "application" here is any TCP-based service running locally on Node A—it’s not an IPFS附属 tool, but an independent service you’ve started on Node A’s machine. For example, this could be a local HTTP server, a database service, or a custom TCP program you wrote. IPFS p2p acts as a bridge to expose this local service to other IPFS nodes, even if your machine is behind a NAT or firewall that blocks direct external access.
2. What does "transfer p2p connections" mean, and is this address a standard host:port format?
- "Transfer p2p connections" essentially means IPFS creates an encrypted, peer-to-peer tunnel between nodes. Instead of external nodes trying to connect directly to your local
127.0.0.1:10101(which is usually inaccessible from outside your network), IPFS routes the connection through its global p2p network, forwarding traffic to your local service seamlessly. - Yes, this is a standard host:port format—just wrapped in IPFS’s multiaddr syntax.
/ip4/127.0.0.1/tcp/10101directly maps to the familiar127.0.0.1:10101; IPFS uses multiaddrs to standardize how network addresses are represented across different protocols.
3. How do I connect to Node A’s listener from another node?
Here’s the step-by-step process:
- On Node A, get its unique peer ID by running:
Copy theipfs idIDfield (it looks like a long string starting withQm...or12D3Koo...). - On Node B, run the dial command to create a local mapping to Node A’s listener:
Replaceipfs p2p dial <NODE_A_PEER_ID> p2p-test /ip4/127.0.0.1/tcp/20202<NODE_A_PEER_ID>with the actual peer ID you copied, and20202with any unused local port on Node B. - Now, any traffic Node B sends to
127.0.0.1:20202will be routed through the IPFS p2p tunnel straight to Node A’s127.0.0.1:10101service.
Note: If Node A is behind a NAT, you may need to ensure it’s reachable on the IPFS network—either by having a public IP, using an IPFS relay node, or enabling hole-punching features.
内容的提问来源于stack exchange,提问作者Vadim Filin

