I’m trying to create a private network that uses the KadDHT so that the private nodes can discover each other. My code is in the Gist below, I’ve run it with firstname.lastname@example.org.
In this code I’m testing with two nodes (apart from the bootstrap node). In
line 93 I first explicitely connect the two nodes together and then I look up the DHT for the same node to find the other node to which it just connected. While the connection is successful,
dht.findpeer fails with
Error: Peer lookup failed.
The bootstrap server runs using the go-ipfs cli and nodes are successfully connecting to it, when I run
ipfs swarm peers I can see the nodejs peers in the output. Also, when I run additional nodes from the command line in the same private network, these nodes can successfully find the nodejs nodes connected to the bootstrap node. So the problem appears to be with the
js-ipfs nodes only.
I tried to explore the problem more so I checked if js-ipfs nodes can use the DHT successfully when they’re connected in the public network, and sure enough they can discover and connect automatically to other nodes. So it seems that the DHT functionality isn’t working only for private networks.
Has anyone created private networks that utilize the DHT successfully?