It is often said that each node 'knows' the preceding and proceding nodes. But what identification information does the node have exactly? Just the IP address? Also, as a result of what protocol does it get that information. Thank you!! :) :)
A node or onion router knows about other nodes what anybody can know. It's the public description of the network. It's the fingerprint, IP, exit policy and some configuration more, and the persistent public key. That's what it uses to encrypt data when sending it to the node.
A node obviously know who is connecting to it from the outside. It can decrypt the information that is encrypted with it's own public key: That is where the node should pass on that data it received.
It's as a result of the onion routing protocl, specified at https://gitweb.torproject.org/torspec.git/ and implemented in tor.