ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.14k stars 3.02k forks source link

Other peers can´t see my peers hosted in my local VM #6711

Open kikoncuo opened 5 years ago

kikoncuo commented 5 years ago

Version information:

Peers 1 and 2 are running:

go-ipfs version: 0.4.22-
Repo version: 7
System version: amd64/windows
Golang version: go1.12.7

Peer 3 is running:

go-ipfs version: 0.4.22-
Repo version: 7
System version: amd64/linux
Golang version: go1.12.7

Description:

I successfully created a swarm key and configured 3 peers.

Peer 1 is connected to peer 2, peer 2 is connected to peer 3, peer 3 runs inside a VM connected to peer 2 connected through the virtualbox network adapter.

They can only discover files if they are directly connected to the peer. I.E. Peer 1 can´t access files of Peer 3 and Peer 3 can´t access files of Peer 1. Peer 3 is not in the list of peers for Peer 1 and vice versa. ipfs cat or ipfs get just get stuck.

I´ve tried connecting more peers to the network in different devices, behavior is the same, host peers can connect and auto-discover each other, but they can only see the client (VM hosted) nodes in their physical machine.

I think the problem is that I connect to the VM hosted peer using the virtualbox adapter, and maybe, the other clients are trying to connect through the same IP which they can´t reach. Is that how peer discovery works? by sharing the IP of all the nodes in the exact same way I connect to them?

Jorropo commented 5 years ago

If a peer want to get a file and one have the file they must be able to talk to exchange the file, but if they can't see each other in the network its impossible for them to talk (wich seems with what you said of your config), how ever its possible for an other node to act as a relay. To do so : First enable auto relay on all nodes needing to hop somewhere (that will create automaticaly choose some nodes to use as relay) :

ipfs config --json Swarm.EnableAutoRelay true

And activate relay hop on peer 2 (that will allow other peers to use peer 2 as relay) :

ipfs config --json Swarm.EnableRelayHop true

That should do it if there is no more than 1 hop to do, currently there isn't any multihop.