Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mDNS doesn't seem to be working #8078

Closed
markg85 opened this issue Apr 18, 2021 · 5 comments
Closed

mDNS doesn't seem to be working #8078

markg85 opened this issue Apr 18, 2021 · 5 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@markg85
Copy link
Contributor

markg85 commented Apr 18, 2021

Hi,

In my local network i have 2 IPFS nodes.
One go-ipfs on linux (via docker) started with:
docker run -d --name ipfs_host -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs --network host -p 4001:4001 -p 8080:8080 -p 5001:5001 --restart unless-stopped -v /home/mark:/home/mark:ro ipfs/go-ipfs

And one on windows installed via the ipfs desktop installer.

Both nodes have version 0.8.0

Both nodes have this MDNS section in their config:

	"Discovery": {
		"MDNS": {
			"Enabled": true,
			"Interval": 10
		}
	},

Now i merely used the IPFS WebUI in the Peers tab to "confirm" this. It was sorted by latency which would put a local network node definitely at the top (with sub-milisecond latency).

Both my nodes don't appear to be able to find each other.
Now i do know that my windows node does not have it's port forwarded in the router so it would have more difficulties connecting to peers. My linux node does have the port forwarded.

When running avahi-browse -a (on my linux node) i see nothing from IPFS from either it or the windows node. And yes, i do see a lot more services on my network so mDNS is functioning properly on my network, just no IPFS.

I can however manually connect the windows node to the linux node (and vice verse works too) which does make that connection show up as the fastest one in the peers tab.

This seemed to have been a problem in the past #6579 but that was fixed...

If you need specific logs or command outputs, please do tell!

@markg85 markg85 added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Apr 18, 2021
@Stebalien
Copy link
Member

I can confirm that mDNS is working, and that avahi-browse -a on a linux machine shows local go-ipfs mDNS broadcasts. This could be one of many issues:

  • Firewall? That shouldn't affect loopback broadcasts... but you never know.
  • Another application listening on the mDNS port? We use reuseport to try to avoid conflicting, but some other app may not.
  • Some strange docker networking issue? @lidel has tested two linux docker containers and have found that they can connect.

Given that:

  1. mDNS appears to be working elsewhere.
  2. Your networking situation is complex and has many unknowns.

I'm going to assume that this isn't a bug for now. Could you open a thread in discuss.ipfs.io? That and do some more mDNS specific testing (try other mDNS apps, maybe pull up wireshark, etc.).

@Stebalien Stebalien added not our bug and removed need/triage Needs initial labeling and prioritization labels May 24, 2021
@Stebalien Stebalien reopened this May 24, 2021
@Stebalien
Copy link
Member

You know... I think this might be a conflict with Avahi. I'm finding that if I start IPFS before avahi, everything works. If I start it after, avahi-browse -a fails (although I still haven't tested two nodes).

Try stopping the avahi daemon on your ubuntu node. Also, make sure disallow-other-stacks isn't set to "no" in /etc/avahi/avahi-daemon.conf

@Stebalien
Copy link
Member

Ok, so it looks like we may not be using reuseport and it looks like running multiple mdns responders at the same time is just broken in general (avahi is not happy with this).

I've updated libp2p/go-libp2p#623 to reflect this. Unfortunately, it's unlikely to get fixed in the near future.

Try disabling avahi-daemon on the ubuntu node and see where that gets you. It's not a good fix, but it will narrow things down.

@markg85
Copy link
Contributor Author

markg85 commented May 24, 2021

Hi @Stebalien, thank you for debugging this!

I just tried a few things.

  1. If i leave avahi out completely, it works. This is "workable" as i don't really need avahi at the moment, no ideal.
  2. If i start avahi after IPFS, it acts weird. The nodes both (1 on linux, 1 on windows) find each other but the node on linux (that finds the one on windows) then has an insanely high latency. Like 44000.
  3. The results from within a docker container and native on linux are the same.
  4. I never see any IPFS node in avahi-browse -b

Hope that helps narrowing it down.
It does help me in working around it when i need a connection between these 2 nodes.

@Stebalien
Copy link
Member

Yeah... this seems to be a conflict between mDNS daemons. I'm going to close this as the libp2p issue is really the proper place to track problems with our mDNS implementation. Unfortunately, the only real path forward is to rewrite it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

2 participants