Networking hardware and software is generally divided up into five layers. Some models add even more layers, but only the five most common layers are described here.
Today it is essential that application software developers be able to write software that communicates efficiently with other software over a network, in particular, the internet. For example, a program might need to make a connection to a database at a remote location, issue a query to the database, receive the results of the query, and close the connection. Many programmers can do this, but very few understand the complexity of the events their programs cause. This is due to the massive amount of information hiding inherent in network architecture.
Simple communication across the internet involves passing a message down through layers at the message origin and back up through similar layers (peer layers) at the message destination. In more complex communication, messages are delivered through several intermediate communication entities called routers. At each router, a message is passed up through some of the layers and then back down on the way to a different router or a destination machine.
Each layer serves a different purpose and uses a different protocol for communication. Kurose (2003) defines a protocol as follows:
A protocol defines the format and order of messages exchanged between two or more communicating entities, as well as the actions taken on the transmission and/or receipt of a message or other event. (p.~8)
Communicating entities are often a client, or process in need of a service, and a server, or process providing the service. Protocols generally involve a coding scheme for encoding and decoding data. However, they also cover dynamic aspects of communication. Many of the internet application protocols specify command languages that clients can use to direct servers.
Communication in the internet can be described by the picture to the right, showing the 5 standard layers.
The application layer is responsible for governing communication between client and server processes or between peer processes providing services to each other. There are many different protocols depending on the type of service.
The transport layer is responsible for delivery of information between processes on different machines on the internet. The two protocols in the transport layer are
TCP is the most interesting and complex. It fixes two major problems in the communication provided by the lower layers.
The first problem is unreliability of the data transmission - data can be corrupted or lost. Part of the solution of this problem is breaking up messages into small blocks of data to reduce the amount of data that is lost at one time. If one of the blocks is lost the receiving end can request retransmission.
The second major problem is that the blocks can arrive out of order due to taking different routes through the internet. TCP defines a complex algorithm used by both ends of the communication to ensure that the receiving end can put the blocks back in the correct order.
The network layer is responsible for delivery of information between different machines on the internet. This simplifies the delivery problem for the transport layer. If you are sending email across the network, the network layer delivers blocks of data from your machine to the machine on which your mail server software runs.
Using services provided by the network layer, the transport layers at either end only have to deal with delivering data to and receiving data from processes on their respective machines - your mailer program on your machine, or the mail server at the other end.
The path taken by blocks of data through the internet is determined by the network layer. In the Internet Protocol (IP), the route is adjusted to use links that have less traffic. Each block is routed individually so that successive blocks in an application layer message may take different routes.
The data link layer is responsible for delivery of information across a single link. The most important problem that the data link layer has to deal with is coordinating communication over a shared medium. For example, in the popular Ethernet family of protocols, several communication entities may be connected through a hub: a relay device that just passes data,from each communication entity that it connects to each other communication entity.
This creates a need for a mechanism for identifying the communicating entities so that communication can be supported between any pair of entities. It also creates a need for a coordination mechanism that deals with collisions that arise when two entities are transmitting simultaneously. Various wireless technologies face coordination problems similar to those of Ethernet, requiring similar data link protocols such as Bluetooth.
The physical layer is responsible for encoding bits onto a transmission medium. The bits may be encoded onto different media (wires, fiber optics, or radio broadcast) in different ways to maximize the transmission rate and to minimize sensitivity to noise. Each physical layer protocol specifies the media, the encoding scheme, and a scheme for starting and ending blocks of bits. If several communication entities are sharing a single media, the physical layer may also be responsible for detecting collisions.
When data is being transmitted across the internet the data is chopped up into small blocks. Each layer can add headers to these blocks. These headers are removed by the peer layer on the receive side. The headers, in effect, allow communication between the peers so that they may coordinate to achieve the objectives of their layer. Addresses are a common kind of information included in headers.
The overall effect is that the two peers on the send and receive side cooperatively implement an abstract service that is used by the layer above. The layer above sends and receives data in a format that is suitable to its own objectives, with the details of how that service is provided hidden.
Many networks have a 5 layer architecture that divides up communication responsibilities.
When data is being transmitted across the internet the data is chopped up into small blocks. Each layer can add headers to these blocks. These headers are removed by the peer layer on the receive side. The headers, in effect, allow communication between the peers so that they may coordinate to achieve the objectives of their layer. Addresses are a common kind of information included in headers.
The layered organization is common in software architectures. It defines an architecture that can be adapted to many different contexts. Each layer can be changed to meet new needs. As long as the abstract interface is maintained, other layers do not need to be changed.
In the history of the internet, there have been many new kinds of applications added. Each application is implemented with new software mainly in the application layer.
Various technologies have been incorporated into the internet for faster data transfer. Most of these changes have been only in the physical layer.