Unable to connect to peers via DHT if I run my node on MacOS

93 Views Asked by At

I'm working on a simple project to get to know how to use DHT. Here it is: https://github.com/ashish10677/dht-implementation This project simply runs a libp2p node and and publishes it's peer id. Other machines can run the same program using the peer id provided by the first node to connect to it.

So, basically the scenario is something like this: Suppose we have 3 machines. #Mach1 is my personal macbook air (m1), #Mach2 is a GCP VM and #Mach3 is also a GCP VM.

If I start the program in #Mach2 by providing it's public IP and port, it gives out a peer info to connect to. Using that info #Mach1 and #Mach3 are able to connect and since it is DHT, all nodes are connected to each other.

Now, if I repeat the same process but start with #Mach1, then the other two machines (which are VMs) #Mach2 and Mach3 are not able to connect to each other. I get an error:

failed to dial 12D3KooWLQaT8UhctNM9LJiSpL11ZcV5YgrZPwW8uj1SrZ2Lbuqt:

  • [/ip4/<#Mach1_publicIP>/tcp/3000] dial tcp4 0.0.0.0:3000->171.76.86.245:3000: i/o timeout What I can conclude is there is some issue while running a DHT server on a macbook. I have enabled port forwarding on my router but still the error persists, whereas VMs are able to connect to each other very easily. Can someone help me in resolving this issue?

I tried enabling port forwarding on my router. I also tried using a VPN. It did not help.

0

There are 0 best solutions below