This question already has an answer here:

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?

marked as duplicate by Richard Horrocks, Andrew Lott Mar 29 '16 at 20:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from security.stackexchange.com Mar 25 '16 at 21:35

This question came from our site for information security professionals.

  • You are telling me that using TOR is the same as using a proxy? – Joao Miesler Mar 5 '16 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 '16 at 21:50
  • @cremefraiche I did not have knowledge of such community. Thank you. – Joao Miesler Mar 5 '16 at 23:36
  • @RichardHorrocks it is a clear duplicate, no doubt – Alexey Vesnin Mar 29 '16 at 11:01

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 or ask your own question.