How to set up my own bootstrap nodes to enable discovery and connection between nodes with public IP and nodes on a local network?

My private IPFS setup:
All nodes mentioned below are using the dht package I forked from the official project. The current address for the dht package in my project is https://github.com/pabcxyz/go-libp2p-kad-dht, and I only modified the value of the DefaultPrefix from “/ipfs” to “/signipfs”.

  1. Node A - I removed all the default bootstrap nodes and set Node A as the bootstrap node. It has a public IP. The code used for the bootstrap node is https://github.com/BenDerPan/simple-bootstrap-node.
  2. Nodes B and C - I removed all the default bootstrap nodes and added Node A as the bootstrap node. They have public IP.
  3. Nodes D and E - I removed all the default bootstrap nodes and added Node A as the bootstrap node. These nodes are on a local network.

Observation: By running nodes 2 and 3, I have confirmed that nodes 2 and 3 can discover and connect to each other. The two nodes in node 2 can discover and connect successfully, as well as the two nodes in node 3. However, when the nodes in node 2 try to connect to the nodes in node 3 or vice versa, the following error occurs: `QmThEh1WhwspRaKuwc6AwH2hJPbEyk6BiX4veMAGV8mQfw,err:failed to dial: failed to dial QmThEh1WhwspRaKuwc6AwH2hJPbEyk6BiX4veMAGV8mQfw: all dials failed

  • [/ip4/172.16.1.121/tcp/4004] dial backoff
  • [/ip4/127.0.0.1/tcp/4004] dial tcp4 127.0.0.1:4004: connect: connection refused. However, if I don't modify the value of DefaultPrefix` and use the default bootstrap nodes, node 2 can discover and connect to the nodes in node 3, and vice versa.

Question 1: How can I set up my own bootstrap nodes so that the nodes in node 2 and node 3 can discover and connect to each other successfully?

1 Like

Hello, did you find a solution? I have the same problem. @xiong

Hello, as I understand it, you want to have a private IPFS network and don’t want to connect to public nodes, correct?

In this case, there’s no need to change the DefaultPrefix; you can use PNET to achieve this. Private Networks PSK V1.

1 Like