Swarm of private nodes but not necessarily in a private LAN


I want a swarm of private nodes but not all of them in a private network, which I successfully achieved is a few nodes connected in a private network, forcing the daemon to run in a private network with the flag LIBP2P_FORCE_PNET=1 and this way only start if a swarm.key is defined but the IPs of the nodes are privates, can I use the swarm.key starting the daemon as a public swarm in order to allow connect to my nodes only nodes that have the same swarm.key?

Thanks in advance

Hi @ifrz. Check out https://github.com/libp2p/js-libp2p/tree/master/examples/pnet-ipfs#private-networking-with-ipfs and see if it helps clarify :slight_smile:

Hi David.

I’m sorry for the late response, I haven’t had much time to play with this, now I understand, it was a misunderstanding on my part. I was associating a private swarm to a private network, I was confused by the fact that I had to delete all the bootstrap nodes to work, I was associating that they are used to discover peers on the public network, but not mandatory to connect to other peers apparently, actually you can create a private swarm with nodes from anywhere as long as they have the same swarm.key associated, I did the test to connect from a node in my house to a node in a cloud and it worked perfectly.