The transport layer consists of the TCP, UDP and similar protocols.
The application layer consists of all the various application clients and servers, such as the Samba file and
print server, the Apache web server, and others. Some of the application-level protocols include Telnet, for
remote login; FTP, for file transfer; and, SMTP, for mail transfer.
Network devices form the bottom layer of the protocol stack. They use a link-layer protocol, usually
Ethernet, to communicate with other devices to send and receive traffic. The interface put up by the network
device driver copies packets from a physical medium, performs some error checks, and then puts up the
packets to the network layer.
Output interfaces receive packets from the network layer, perform error checks, and then send the packets out
over the physical medium. The main functionality of IP is routing:
It checks incoming packets to see if they are for the host computer or if they need to be forwarded.
It defragments packets if necessary and delivers them to the transport protocols.
It has a dynamic database of routes for outgoing packets
It addresses and fragments them if necessary before sending them down to the link layer.
Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are the most commonly used
transport layer protocols. UDP simply provides a framework for addressing packets to ports within a
computer, whereas TCP allows more complex connection-based operations such as the recovery of lost
packets, and also traffic management implementations. Both UDP and TCP copy the application packet for
transporting.
Moving up the transport layer, next is the INET (for internet) layer, which forms the intermediate layer
between the transport layer and application sockets. The INET layer implements the sockets owned by the
applications. All socket-specific operations are implemented here.
Each layer of the protocol stack adds a header containing layer-specific information to the data packet. A
header for the network layer might include information such as source and destination addresses. The process
of prepending data with headers is called encapsulation. Figure 5-18 shows how data is encapsulated by
various headers. During decapsulation, the inverse occurs: the layers of the receiving stack extract layer-
specific information and accordingly process the encapsulated data. Note that the process of encapsulation
increases the overhead involved in transmitting data.
71
Figure 5-18: How data travels through the Network protocol stack