Skip to main content

Path Discovery and Route Learning

MeshCore uses ana intelligenthybrid pathflood-first discovery/ direct-route-after systemapproach rather than simplepersistent flooding. ThisFor designstable meansrepeat-unicast traffic the network getsquiets quieterdown -as notpaths are learned; under mobility, link churn, or heavy group/broadcast traffic it can get louder -again asbecause usageof increases.re-flooding.

How Path Discovery Works: Step by Step

  1. First message to an unknown destination - MeshCore floods the network to locate the target node. EveryThe flooded message carries the payload, and every node relays the messageit until it reaches the destination.destination, recording the path it travelled as a byproduct.
  2. Destination receivesreturns thea messagepath and sends an ACKrecord - The acknowledgementdestination travelssends back alonga PAYLOAD_TYPE_PATH packet containing the discoveredrecorded path.path (not merely a generic ACK).
  3. RouteSender isstores cachedthe path - Both theThe original sender records the returned path and alluses relayit (ROUTE_TYPE_DIRECT, embedding the path) for subsequent messages. Relay nodes alongforward based on the path recordembedded thein route.each packet; they do not maintain per-destination route tables. This is the key step: the networksender has now "learned" a path.
  4. Subsequent messages use the established path - Only nodes on the known route retransmit. All other nodes stay silent.
  5. Retry and re-discover - After 3 consecutive failed retries on a known path, MeshCore discards the cached route and floods again to find a new one.

Group and Public Channel Messages

Group messages and public channel broadcasts always flood the network, because they are addressed to multiple destinations and no single path can serve all recipients. Path caching only applies to direct (unicast) messages.

Path Hash Mode

The granularitypath.hash.mode ofsetting controls the cachedpath-hash pathsize identifierused in a node's own advert broadcasts (on a repeater it affects only its advert broadcasts, not which packets it forwards). On companion nodes, the message path-hash size is configurableset viain the CLI:app's Experimental Settings.

set path.hash.mode 0 # 1-byte path hash (default; low overhead)
set path.hash.mode 1 # 2-byte path hash (default; balanced)
set path.hash.mode 2 # 3-byte path hash (highest precision)

A larger hash reduces the chance of path collision in dense networks at the cost of slightly larger packet headers. The firmware default is mode 0 (1 byte); only raise it after confirming the whole network runs firmware that supports the larger size.

Advertisement Broadcasts

Nodes periodically broadcast advertisements so neighbors can discover them. The flood-advert interval is configurable:configurable (in hours):

set flood.advert.interval 6 # broadcast every 6 hours (default is 12)

To trigger an immediate advertisement (useful after changing location or name):, use advert for a flood advert, or advert.zerohop for a zero-hop (neighbors-only) advert:

advert