Can i connect to a node which does not have a PUBLIC IP?

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/

i am getting the following error response

`Error: connect 12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S failure: failed to dial 12D3KooWGkCcZDwMEeyVgoe5P2Kqh6ffvcitZZBLeBu8tJKyXy9S: all dials failed

  • [/ip4/] dial tcp4> i/o timeout
  • [/ip4/] dial tcp4> 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

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.