It's clear that if all of the disparate devices composing the internet are going to communicate seamlessly, there must be agreed-upon standards that define their communications. These standards are called protocols. Protocols define everything from the voltage levels on an Ethernet cable to how a JPEG image is compressed on a web page. It's clear that, when we talk about the voltage on an Ethernet cable, we are at a much different level of abstraction compared to talking about the JPEG image format. If you're programming a website, you don't want to think about Ethernet cables or Wi-Fi frequencies. Likewise, if you're programming an internet router, you don't want to have to worry about how JPEG images are compressed. For this reason, we break the problem down into many smaller pieces.
One common method of breaking down the problem is to place levels of concern into layers. Each layer then provides services for the layer on top of it, and each upper layer can rely on the layers underneath it without concern for how they work.
The most popular layer system for networking is called the Open Systems Interconnection model (OSI model). It was standardized in 1977 and is published as ISO 7498. It has seven layers.
OSI Model Layers
- 7. Application
- 6. Presentation
- 5. Session
- 4. Transport
- 3. Network
- 2. Data Link
- 1. Physical
Physical Layer
This is the lowest level of OSI model. It is the level of physical communication in the real world. At this level, we have specifications for things such as the voltage levels on an Ethernet cable, what each pin on a connector is for, the radio frequency of Wi-Fi, and the light flashes over an optic fiber.
Data Link Layer
This level builds on the physical layer. It deals with protocols for
directly communicating between two nodes.
This layer performs the following functions:
- Framing: Defines how direct data between nodes starts and ends.
- Error detection and correction(Error control): Error detection and correction is archived by adding a calculated value CRC (Cyclic Redundancy Check) that is placed to the data link layer's trailer which is added to the message frame before it is sent to the physical layer.
- Flow control: It is the technical through which the constant data rate is maintained on both the sides so that no data get corrupted.
Data on this layer is called frame.
Network Layer
The network layer provides the methods to transmit data
sequences (called packets) between nodes in different networks. It provides
methods to route packets from one node to another (without a direct physical
connection) by transferring through many intermediate nodes. This is the layer
that the Internet Protocol is defined on, which we will learn later in this tutorial.
Data on this layer is referred to as packet.
Transport Layer
This is the layer which Transmission Control Protocol (TCP) and
User Datagram Protocol (UDP) are said to exists, they provides
methods to reliably deliver variable
length data between hosts. These methods deal with splitting up data,
recombining it, ensuring data arrives in order, and so on.
Data on this layer is called Segment.
Session Layer
This layer builds on the transport layer by adding methods to establish, checkpoint, suspend, resume, and terminate dialogs.
Presentation Layer
This is the lowest layer at which data structure and presentation for an application are defined. Concerns such as data encoding, serialization, and encryption are handled here.
Application Layer
The applications that the user interfaces with (for example, web browsers and email clients) exist here. These applications make use of the services provided by the six lower layers. A protocol from this layer, such as HTTP used to transmit web pages, doesn't have to concern itself with how the data is being transmitted. It can rely on services provided by the layer underneath it to effectively transmit data.
As we will see in the next section, the OSI model doesn't fit precisely with the common protocols in use today. However, it is still a handy model to explain networking concerns, and it is still in widespread use for that purpose today.