TCP/IP encapsulate upper layers using headers for the purpose of exchanging control and status information about the progress of the communication because its protocols also engage in peer talk by encapsulating data with protocol headers before submitting it to the underlying layer for subsequent delivery to the network. The data communication using TCP/IP and Ethernet as it is passed down the layers by an application on node X to node Y across the network.
A header is added to the data at each layer before being sent to the receiving node. The same header is removed at the receiving end in the reverse order. When a node wishes to transmit a data, the application layer of TCP/IP architecture adds a header as TCP header which is again complemented by IP header and Ethernet header in the lower layers.
The addresses included in the TCP, IP and Ethernet headers are port numbers, IP addresses, and MAC addresses, respectively.
At the transport layer, the header includes destination and source port numbers. For example, port number 25 identifies a SMTP session, whereas port number 80 HTTP session. Therefore, upon receiving data from the Internet layer, the transport layer fetches its own header for the destination port number to identify the application that it is supposed to deliver the data to. This mechanism helps the transport layer establish connections on behalf of multiple applications without confusing the data exchange process. The protocol data unit thus formed at this layer is normally referred to as a data segment.
At the network access layer, the header includes the MAC addresses of the source and destination devices communicating on the same physical network. A frame check sequence is also included to assist the network access layer in checking the integrity of the received data. The protocol data unit thus formed at this layer is normally referred to as a data frame.