How does a Tor client pick Tor nodes for circuit creation?

  • A Tor client initially contacts Directory Authorities to fetch the consensus (i.e. a file containing all relays of the Tor network at that time with details such as IP address, exit policy, public key etc.) As soon as a Tor client gathers sufficient information about existing relays, it tries to build circuit paths. How does the Tor client choose which nodes to use for a circuit?

  • alaf

    alaf Correct answer

    9 years ago

    Taken from Tor Path Specification document:

    We choose the path for each new circuit before we build it. We choose the exit node first, followed by the other nodes in the circuit. All paths we generate obey the following constraints:

    • We do not choose the same router twice for the same path.
    • We do not choose any router in the same family as another in the same path. (Two routers are in the same family if each one lists the other in the "family" entries of its descriptor.)
    • We do not choose more than one router in a given /16 subnet.
    • We don't choose any non-running or non-valid router unless we have been configured to do so. By default, we are configured to allow non-valid routers in "middle" and "rendezvous" positions.
    • The first node must be a Guard node.

    Relay selection is not uniform but weighted by relay bandwidth. Faster relays have a higher probability of being picked than slower ones.

    It should be added that the relay selection is not uniform but weighted by relay bandwidth. Faster relays have a higher probability of being picked than slower ones.

    Faster relay do not have a higher probability. Tor tries to choose a relay from the set of Fast node with priority as a matter of design. Relay bandwidth if provided by consensus. Tries to choose relay to satisfy the most requests and likely to succeed from historical use. The type of traffic is a deciding factor.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used