Telecommunications Pocket Reference

The IP resides within layer 3 (network layer) of the OSI model. It provides end-to-end transport of data units through internets using connectionless services. Being connectionless, IP does not provide reliable data transfer, but this is not an issue if the upper layers provide reliability and error control.
An IP host must encapsulate data into IP headers, which are then passed to the data link (such as Ethernet). The protocol at the data link layer then encapsulates the IP header with the data into its own data unit (the datagram). The datagram is then passed down to the physical layer, where it is passed over the network as a serial bit stream (with possible encapsulation again, depending on the technology used).
For data to leave the local network, it must be sent to a router. Routers are network layer devices and are capable of processing the Ethernet and the IP headers. If the data is to be passed to another network, the Ethernet (or data link) header is stripped from the data, and the IP header is then processed.
Before transmitting the data over a port to the next network, the router must create a new IP header and place the data (consisting of the TCP header, possibly an application header, and user data) into the IP header. The datagram is then given to the data link layer (which may now be
X.25, ISDN, Frame Relay, or even Switched 56), and the whole process is repeated.