I have set up two ipfs node in two different machines, none of them have PUBLIC IP. Now when i try to connect node with this command
ipfs swarm connect /ip4/192.168.101.28/tcp/4001/p2p/12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S
i am getting the following error response
`Error: connect 12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S failure: failed to dial 12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S: all dials failed
- [/ip4/192.168.103.103/tcp/49192] dial tcp4 0.0.0.0:4001->192.168.103.103:49192: i/o timeout
- [/ip4/192.168.101.28/tcp/36963] dial tcp4 0.0.0.0:4001->192.168.101.28:36963: i/o timeout
`
I tried this from both node to connect to another, but none is successful. Is this happening because the machines do not have PUBLIC IP?
If no then how do i solve this problem?
Are both machines on the same LAN?
1 Like
try
ipfs swarm connect /p2p/12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S
@solanav No, they aren’t
@FledgeXu Still not working, this time getting error failure: routing: not found
Are you sure the Node ID is right? (run ipfs id
to get node id)
Yes i am sure.
As i have mentioned my IP is not public. With this private IP, am i even reachable(specially in certain port) to everyone in the internet? If no then i guess none can connect to my node with ipfs swarm connect PERR_ID
right?
ipfs swarm connect /p2p/PERR_ID
should be OK.
if both machines are behind a NAT you might be out of luck, however if this is not the case you can try to detect how the network is seeing them using the commands:
ipfs dht findpeer 12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S
ipfs swarm connect {outside_address_found_by_previous_command}/p2p/12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S
an other useful tip might be to have both machines connect to a same public gateway
before trying to connect with one-another.
The only way this can work is if both LANS have a way to talk to each other. If both lans are using the same ip address range they cannot ever talk to each other except through a vpn. If both lans are accesable to each other then you may need to open the ports on both networks.but there needs to be something in the middle of both networks showing which LAN has what IPS so it can all route correctly. You will need a sonicwall or something just as feature rich to be able to create your own routable tables.