I was reading https://security.stackexchange.com/questions/36571/why-can-a-tor-exit-node-decrypt-data-but-not-the-entry-node and it got me thinking: How does a tor node knows that the next hop is a node and not the final destination?.

In the normal tcp/ip packet you have source address and destination address. How can TOR packets know that they did not reached their destination and it's not only another hop on the chain? Does the packet has any type of TCP options like the TCP/IP packet does?

  • You are telling me that using TOR is the same as using a proxy? Mar 5, 2016 at 21:47
  • Oh, I think I missunderstood your question with my first comment (now deleted). I think the nodes know at which position in the chain they are when the connection with the client is negotiated (the TOR client negotiates a connection with all three nodes individiually and likely tells them their assigned role)
    – SEJPM
    Mar 5, 2016 at 21:50
  • @cremefraiche I did not have knowledge of such community. Thank you. Mar 5, 2016 at 23:36
  • @RichardHorrocks it is a clear duplicate, no doubt
    – Alexey Vesnin
    Mar 29, 2016 at 11:01

1 Answer 1


If an OR is an exit node, it will receive a RELAY cell that tell it to establish a tcp connection with a server. If it is not an exit node, it will receive an EXTEND cell that tells it to extend the tor circuit to another OR. See https://gitweb.torproject.org/torspec.git/tree/tor-spec.txt for more.

Not the answer you're looking for? Browse other questions tagged .