Cannot connect two nodes locally

Dear community,

I have some problems connecting two nodes locally on the same network. I have two nodes a “server node” and a “laptop node”.

————————————————————————————————

Now, I have tried to connect these two nodes by bootstrapping and “ipfs swarm connect” from two different networks. When I try to connect with my laptop from an outside network (cellular) to my server on a local network

ipfs swarm connect /ip4/77.250.53.250/tcp/4001/p2p/12D3KooWCdkKw4hKXLEZg1K1pFPShV7s7gzymb6xmitKooTfoFd7

where 77.250.53.250 is my public IP then it connects to my “server node” perfectly.

————————————————————————————————

However, when my laptop is on the same LOCAL NETWORK as my “server node” then I don’t seem able to connect to the “server node". I use again

~ % ipfs swarm connect /ip4/77.250.53.250/tcp/4001/p2p/12D3KooWCdkKw4hKXLEZg1K1pFPShV7s7gzymb6xmitKooTfoFd7
connect 12D3KooWCdkKw4hKXLEZg1K1pFPShV7s7gzymb6xmitKooTfoFd7 success

and it says it is a success. But when I then use: “ipfs swarm peers” it does not show up in the list

————————————————————————————————

Finally, when I try to connect from my “server node” locally to my “laptop node" by using

$ ipfs swarm connect /ip4/77.250.53.250/tcp/4002/p2p/12D3KooWJ1wgTksqoFFcCUCDXoMZMTkfZ3DhLhzwfCqCgk7WLawa
connect 12D3KooWJ1wgTksqoFFcCUCDXoMZMTkfZ3DhLhzwfCqCgk7WLawa success

It is again a succes, but when I then look at: “ipfs swarm peers” it is again not in the list. PS I used port 4002 for my laptop since I already use 4001 for the server node.

————————————————————————————————

CONCLUSION: I cannot connect locally from my “laptop node” to my "server node”, and I don’t understand why it does work from an outside network,

Hopefully, somebody can help me and clarify what is going on ?

Thanks in advance!

If you have a local address (NAT, like 192.168.x.x), you must use that address to connect when on the same local network (and when looking for it in the swarm peers).

Hey Ylmepereur,

Thank you for your fast reply. I thought that as well to connect locally to the local IP addresses of the machines. However, this did not work neither. I tried to connect both machines with each other by using

ipfs swarm connect /ip4/192.168.178.59/tcp/4002/p2p/12D3KooWJ1wgTksqoFFcCUCDXoMZMTkfZ3DhLhzwfCqCgk7WLawa

Ipfs bootstrap add /ip4/192.168.178.59/tcp/4002/p2p/12D3KooWJ1wgTksqoFFcCUCDXoMZMTkfZ3DhLhzwfCqCgk7WLawa

to connect the server node to the laptop node, and the other way around

ipfs swarm connect /ip4/192.168.178.115/tcp/4001/p2p/12D3KooWCdkKw4hKXLEZg1K1pFPShV7s7gzymb6xmitKooTfoFd7

Ipfs bootstrap add
/ip4/192.168.178.115/tcp/4001/p2p/12D3KooWCdkKw4hKXLEZg1K1pFPShV7s7gzymb6xmitKooTfoFd7

However, again after doing this they do not show up in the ipfs swarm peers list. It looks like only connecting from outside the network works. Maybe, there is another setting wrong in my setup that does not allow for local connections.

Thanks again!

I also discovered when I run

mdns-scan on my ubuntu ipfs server I only get this output

  • oxg37ib3i53084z9lp6tzmn33pc7czt9._ipfs-cluster-discovery._udp.local
  • h39n1zwe97zawxovkcm4tbxto2dqos2qy._p2p._udp.local

but I do not get the _ipfs-discovery._udp.local. The same thing holds for my ipfs node on my laptop that runs macOS

dns-sd -Q ‘_ipfs-discovery._udp.local’ ‘PTR’ ‘IN’

I basically get nothing.

But when I run

dns-sd -Q ‘_ipfs-cluster-discovery._udp.local’ ‘PTR’ ‘IN’

Then it does show up

Maybe this is an issue as well. But I do not know how to solve this problem

I figured out the problem. When I installed my server node I installed it with the label

–profile server

As it said in the documentation:

If you are running a Kubo node in a data center, you should initialize IPFS with the server profile. Doing so will prevent IPFS from creating data center-internal traffic trying to discover local nodes:

I reinitialized both the server and the laptop node without this label and now I can discover my nodes locally on my network as well. Maybe, someone else had this problem as well and can learn from my mistake :wink:

Cheers!

1 Like