dakhnod / Meshenger

open source, P2P messenger without centralized server that works in a local network.
GNU General Public License v3.0
205 stars 45 forks source link

Make Meshenger working through routed networks #5

Open bodems opened 6 years ago

bodems commented 6 years ago

This is not an issue, but some ideas I have to make Meshenger working through routed networks. The problem: layer 2 networks don't scale. Many Freifunk communities already split up their networks in different layer 3 domains to reduce overhead and to improve performance. Different devices in different domains still can talk to each other, but they have different network prefixes and you can't use the link local address anymore. Also you don't know in what domain your peer device is, and so you don't know the IP. Maybe you can guess the prefix, but if we assume a /64 for each domain and a /48 for the whole network, you have 65536 possibilities. Of course you can enter all known used prefixes in your app (they are not much), but that's not really user friendly. So there is a need for a "signaling system", which should, of course, not be a centralized service. This can be done by a small daemon on the layer 3 routers, which connect the different domains. Meshenger already knows the IP of the router, because the device has an IPv6 default route received via router advertisements from the router. If Meshenger can't find the peer locally, it could ask the router if it knows a (routable) IPv6 address for the MAC of the peer. The router then looks up its neighborhood tables from other domains and returns the global routable IPv6 address of the peer. If the router doesn't find an address for the searched MAC, it even could ask other routers! Of course, this method is not perfect and has some problems:

Problems:

Maybe there is a better solution at all?

mwarning commented 6 years ago

A slightly different idea that that would work without the necessity to modify the mesh node firmware.

thereyougo commented 6 years ago

Maybe adapt the torrent DHT model?

Otherwise as mentioned in other similar projects: UUCP

mwarning commented 6 years ago

A DHT keeps the wifi chip busy and as a result drains the battery. That is why it is not successfully used on phones.

T-X commented 5 years ago

Throwing in another idea:

Example:

On the gateway routers use https://github.com/troglobit/pim6sd to interconnect the various domains for IPv6 multicast. We are currently in the process of resurrecting this dusty layer 3, IPv6, PIM routing daemon. Also checkout https://md.darmstadt.ccc.de/dn42-multicast (this will move to the dn42 wiki eventually).

On the batman-adv and Gluon side routable IPv6 multicast support will hopefully land soon. Patches are available, reviewing and adjustments are in progress (batman-adv, Gluon).

Advantages:

mwarning commented 5 years ago

Thank you for the idea! It would be great to make the app working in other community networks as well.

So that I understand this correctly:

To implement your proposal, the contact database would need to be store support multiple ways to communicate. And the in the settings those things need to be configured in the settings. An the of course the network code would need to be added. While this is not a topic for the GSoC, any pull request to add this feature would have my support.

Btw., Meshenger so far only supports this way to reach other contacts:

T-X commented 5 years ago

So that I understand this correctly:

  • this would enable enable direct calls in layer 3 networks with the help of multicast groups and pim6sd.

  • for gluon/batman-adv meshes the current approach using IPv6 link local works already, but the multicast approach you propose would also work in the future.

Basically yes. The thing is, currently we have several communities which have split their batman-adv networks into multiple domains with their own subnet each. So in those communities you would either be unable to use the Meshenger between those domains. Or you would need some manual work to feed and update things like your DNS support.

A multicast based discovery protocol similar to the one used by IPv6 NDP would provide an automised way to find a routable unicast address for a given identifier (MAC address, eui-64 suffix, public key, ...). So very similar to a DHT, but only bothering your target and multicast routers in between.

And this would not only allow such discovery between the domains of a city, but for instance could also enable address discovery and communication between communities, for instance over BGP/dn42/Intercity-VPN. Without any manual work by the user, without central servers.

(so it's not so much a proposal "to work in the future", but to extend the range of the Meshenger, without sacrificing any of the benefits of the current link-local-address-QR-code approach)

mwarning commented 5 years ago

The simple description of this feature by T-X would be: A chat based on multicast groups to exchange each others IP address. :-)

ToEatFreshBabies commented 4 years ago

Why not ZeroTier?

https://github.com/zerotier

You need daemons on every router between the peers

BGP?

mwarning commented 4 years ago

@ToEatFreshBabies ZerotTier does not work properly on OpenWrt with "typical" hardware resources (4mb flash or 64mb RAM or low power CPUs).