Due to the limited bandwidth of LoRa, Meshtastic does not keep track of the nodes a message used to hop to the destination. However, in the latest 2.0.8 alpha release, there is a new ‘TraceRouteModule’ (as per an idea of @mc-hamster) that allows you to track which nodes are used to hop to a certain destination.
In order to use it, you have to flash the firmware to all your nodes and upgrade the Python CLI (using pip3 install meshtastic --upgrade). Then use this command:
meshtastic --traceroute ‘<destinationId>’
Where for <destinationId> you have to fill in the ID of the node you want to trace the route to, which you can get from running meshtastic --nodes. Depending on your OS, you might need quotation marks around it. Then it will send a specific message to track the hops. For example, this is what you will get:
meshtastic --traceroute ‘!bff18ce4’ Connected to radio Sending traceroute request to !bff18ce4 (this could take a while) Route traced: !25048234 --> !ba4bf9d0 --> !bff18ce4
The first ID shown is the node you are connected to. As you can see, this packet went through one other node to get to its destination. Only nodes that know the encryption key can be traced. Also note that a message may arrive via multiple routes due to duplication because of rebroadcasting. This will only show the route of the first packet containing the traceroute request that arrived at the destination.
I hope you find it useful.