IPFS local discovery through WiFi

Hello.
I have a local private network composed of 4 nodes. They have an ethernet interface and are in the same WiFi ad-hoc network. This is their routing table:

Kernel IP routing table
Destination       Gateway         Genmask     Flags Metric Ref    Use Iface
10.0.21.0       0.0.0.0         255.255.255.0   U     0      0     0 wlan0
192.168.21.0    0.0.0.0         255.255.255.0   U     0      0     0 eth0

The bootstrap list is empty (I want them to discover themselves alone, without the help of specific and predetermined peers).
If I have them connected through Ethernet and WiFi, running ipfs swarm peers on every node will return the other 3 nodes. However, if I remove the cables and use WiFi only (they are pingable), the same command will return empty.

What do I need to do to make the discovery work? (mdns is enabled in the config)
I tried:

  • adding the Ethernet network to the swarm address filters
  • only announcing the WiFi address in the config

Thank you.

1 Like

Shutting down the Ethernet interface with ifconfig eth0 down (only loopback and wlan0 active) solved the issue, but isn’t there a way to make this work with all interfaces up? Does IPFS or libp2p give preference to Ethernet?

I am not sure about the issue, but you could start digging from https://github.com/libp2p/go-libp2p/blob/master/p2p/discovery/mdns.go#L50

Technically, it should discover all the IP addresses that we listen to and pass those to the mdns library for announcing. I am not sure why the WLAN addresses would not be there, specially after hardcoding them in Announce though.