How do node members discover each other?

I have a small question on how ZeroTier works, I didn’t find the answer to my question in the doc. Indeed, I wonder how a connection is initialized, how my machine retrieves the node id of another machine when I basically ping its virtual ip. So I wonder how is done the transition between VL2 and VL1.

I hope someone will answer my question, thank you :slight_smile:

Hello

thanks but how does my computer know what is the node address of the node i want to communicate with? It’s just with that that I have trouble, because once they have communicated together there is a node file that is created, but the first time how are they discovered? Thanks for your help

Do the nodes files that the controllers send to each node contain the node’s ip? Indeed in this file there is the zerotier address and the public key of the node but I wonder how my computer does to know that this node has this ipv4 address. And what is the point of the mac being derived from the zerotier address? Thank you :slight_smile: hoping for an answer

I just analyzed a bit a peer file and I see in this file the node address, the public key and its public ip. I can’t figure out how ZeroTier translates a zerotier local ip into a ZeroTier address :confused: Can you help me please? thank you

I’m not sure how to better explain. Every node talks to the roots. When they want to find another node, they ask the roots. This is a layer lower than networks/controllers.

ok thank you, but let’s imagine that for the first time I ping a zerotier virtual ip (192.168.192.1) how will my pc know what is the node address of the node with the ip 192.168.192.1 in order to initiate a connection via the root server?

I understood a lot of things about how zerotier works but the first discovery (conversion of the virtual ip to the zerotier address) I can’t understand and it bothers me :confused:

I don’t think you’re starting your search deep enough into the OSI model for your answer. ZeroTier emulates Layer 2 of the OSI model - the data link layer. AKA ethernet & packet switching, so the answer to your question is how TCP/IP is translated to Ethernet frames.

For IPv4, that’s the Address Resolution Protocol (ARP). For IPv6, that’s the Neighbor Discovery Protocol (NDP). In essence, the way ZeroTier finds peers is the same way members of a physical LAN find each other.

ok thank you so ARP discover are send by broadcast packet in the zerotier Network. But how my pc know which zerotier adresses are in the network to send the arp packet to the broadcast? :slight_smile:

It sends out a broadcast to all members of the network. Then an ARP reply is sent back.

Thank you, So the controller provides a list of network nodes with their zt addresses? .peer files? In the peer file I only see the node address, the node public key and the public ip adresse, I don’t see a network ID the say that this peer is in this ZeroTier network.

Hello Mr. Grant, do you have an idea for my question? Indeed, I understand the principle of ARP and broadcast but I can’t understand how the machines are able to discover each other the first time. How is the broadcast sent to another nodeid the first time? How does my pc manage to determine that this nodeid is part of the network I use.

Thank you for your precious help.

@celien Have you read the whitepaper that Travis shared? That gives an overview of the discovery process as well as many other topics.

I have read it but can’t find the information. Let’s imagine I have ZeroTier address 8ccc8cada1 and my ZeroTier ip is 192.168.192.1 and the other node has 1abc2defh2 and its ZeroTier ip is 192.168.192.2.

Imagine I am 192.168.192.1 and I ping 192.168.192.2 how am I going to find out that 192.168.192.2 is 1abc2defh2? Indeed in order to request an rendezvous for 1abc2defh2 to a root I must know that 192.168.192.2 is 1abc2defh2.
I understand the principle of ARP but how does my computer know that 1abc2defh2 is part of my ZeroTier network to send him the broadcast ARP?

Thank you

I’m afraid the only thing left to point you to is the code, which is open source. We don’t have documentation other than that for exactly what you’re asking.

ok thank you very much for your help. You don’t know how it happens? It may be the controller sending the information about network members when the node does not yet know the others but I’m not sure

When node 1 pings node 2 it will begin the normal ARP process, but ZT will actually interject here and use its multicast system to perform its own kind of lookup and emulate ARP. This multicast packet is sent to a group derived from the network membership configs received from the controller. This is how the peer is discovered. At this point we still don’t have a physical IP, so when node 1 tries to send a packet to node 2 it will send the packet upstream (to relay) and send a HELLO packet upstream to a root. The root will most likely have a record of node 2’s last physical address. If not it will forward to another root. Once this HELLO is received by the root with the necessary information, the root will forward it to node 2 and will inform node 1 of node 2’s last known physical address to try. Then node 1 will try to send a HELLO directly to node 2’s physical address and node 2 will send a HELLO directly to node 1’s physical address used to send the original HELLO. If all goes well each will receive these packets and begin a short sequence of OKs back and forth and then will learn the path.

Focus on the contents of node/Switch.cpp : onLocalEthernet and node/Peer.cpp : received

2 Likes

A big thank you I understand better :slight_smile: In which part of the code this is located: “group derived from the network membership configs received from the controller” indeed it is with this that I have trouble. but you have already explained it well and the discovery is therefore linked with the controller. :slight_smile: