I will try to describe in the simplest possible way what kind of beast OSI is and who needs it. If you want to connect your life with information technology and are at the very beginning of the journey, then understanding the OSI operation is simply vital, any pro will tell you this.
I'll start by defining how it is customary. The OSI model is a theoretical ideal model for transmitting data over a network. This means that in practice, you will never find an exact match with this model, it is the benchmark that network developers and network equipment manufacturers adhere to in order to maintain the compatibility of their products. You can compare this with people's ideas about the ideal person - you will not find it anywhere, but everyone knows what to strive for.
I want to immediately outline one nuance - what is transmitted over the network within the OSI model, I will call data, which is not entirely correct, but in order not to confuse the novice reader with terms, I made a compromise with my conscience.
The following is the best known and best understood OSI model diagram. There will be more drawings in the article, but I propose to consider the first one as the main one:
The table consists of two columns, at the initial stage we are only interested in the right one. We will read the table from bottom to top (otherwise:)). In fact, this is not my whim, but I do it for the convenience of assimilating information - from simple to complex. Go!
On the right side of the above table, from bottom to top, the path of data transmitted over the network is shown (for example, from your home router to your computer). Clarification - if you read the OSI layers from bottom to top, then this will be the data path on the receiving side, if from top to bottom, then vice versa - the sending side. I hope it's clear so far. To completely dispel doubts, here's another diagram for clarity:
To trace the path of the data and the changes occurring with it across the levels, it is enough to imagine how they move along the blue line on the diagram, first moving from top to bottom along the OSI levels from the first computer, then from bottom to top to the second. Now let's take a closer look at each of the levels.
1) Physical (phisical) - it refers to the so-called "data transmission medium", i.e. wires, optical cable, radio waves (in the case of wireless connections) and the like. For example, if your computer is connected to the Internet via a cable, then wires, contacts at the end of the wire, contacts of the network card connector of your computer, as well as internal electrical circuits on the computer boards, are responsible for the quality of data transfer at the first, physical level. Network engineers have the concept of a "problem with physics" - this means that the specialist saw a physical layer device as the culprit for the "non-transmission" of data, for example, a network cable is broken somewhere, or a low signal level.
2) Channel (datalink) - it's much more interesting here. To understand the data link layer, we first have to grasp the concept of the MAC address, since it is he who will be the main character in this chapter:). The MAC address is also called "physical address", "hardware address". It is a set of 12 characters in the number system, separated by 6 dashes or colons, for example 08: 00: 27: b4: 88: c1. It is needed to uniquely identify a network device on the network. In theory, the MAC address is globally unique, i.e. nowhere in the world there can be such an address, and it is "sewn" into a network device at the production stage. However, there are simple ways to change it to an arbitrary one, and besides, some unscrupulous and little-known manufacturers do not hesitate to rivet, for example, a batch of 5000 network cards with exactly the same MAC. Accordingly, if at least two such "brother-acrobats" appear in the same local network, conflicts and problems will begin.
So, at the data link layer, the data is processed by the network device, which is only interested in one thing - our notorious MAC address, i.e. he is interested in the addressee of delivery. For example, link layer devices include switches (they are also switches) - they keep in their memory the MAC addresses of network devices with which they have a direct, direct connection, and when they receive data on their receiving port, they check the MAC addresses in the data with the MAC -addresses available in memory. If there is a match, then the data is sent to the addressee, the rest are simply ignored.
3) Network (network) - "sacred" level, understanding of the principle of operation of which for the most part makes the network engineer such. Here "IP-address" rules with an iron fist, here it is the basis of the basics. Due to the presence of an IP address, it becomes possible to transfer data between computers that are not part of the same local network. The transfer of data between different local networks is called routing, and the devices that allow this to be done are routers (they are also routers, although in recent years the concept of a router has been greatly perverted).
So, the IP address - if you do not go into details, then this is a set of 12 digits in the decimal ("normal") system of calculus, divided into 4 octets, separated by a dot, which is assigned to a network device when connected to a network. Here you need to go a little deeper: for example, many people know an address from the 192.168.1.23 series. It is quite obvious that there are no 12 digits here. However, if you write the address in full format, everything falls into place - 192.168.001.023. We will not dig even deeper at this stage, since IP addressing is a separate topic for story and display.
4) Transport layer (transport) - as the name implies, is needed precisely for the delivery and sending of data to the addressee. Drawing an analogy with our long-suffering mail, the IP address is actually the delivery or receipt address, and the transport protocol is the postman who can read and knows how to deliver the letter. There are different protocols for different purposes, but they have the same meaning - delivery.
The transport layer is the last, which is by and large of interest to network engineers, system administrators. If all 4 lower levels worked as they should, but the data did not reach the destination, then the problem must be looked for in the software of a particular computer. The protocols of the so-called upper levels are of great concern to programmers and sometimes still to system administrators (if he is engaged in server maintenance, for example). Therefore, further I will describe the purpose of these levels in passing. In addition, if you look at the situation objectively, most often in practice the functions of several upper layers of the OSI model are taken over by one application or service, and it is impossible to say unequivocally where to assign it.
5) Session - controls the opening and closing of a data transfer session, checks access rights, controls the synchronization of the start and end of the transfer. For example, if you download a file from the Internet, then your browser (or through what you download there) sends a request to the server where the file is located. At this point, session protocols are turned on, which ensure the successful download of the file, after which, in theory, they are automatically turned off, although there are options.
6) Representative (presentation) - prepares data for processing by the final application. For example, if it is a text file, then you need to check the encoding (so that "kryakozyabrov" does not work), it is possible to unpack it from the archive…. but here, once again, what I wrote about earlier is clearly traced - it is very difficult to separate where the representative level ends, and where the next one begins:
7) Application (application) - as the name implies, the level of applications that use the received data and we see the result of the labors of all levels of the OSI model. For example, you are reading this text because you opened it in the correct encoding, the correct font, etc. your browser.
And now, when we have at least a general understanding of the process technology, I consider it necessary to tell about what bits, frames, packets, blocks and data are. If you remember, at the beginning of this article I asked you not to pay attention to the left column in the main table. So, her time has come! Now we will go through all the layers of the OSI model again and see how simple bits (zeros and ones) are converted into data. We will go the same way from the bottom up, so as not to disrupt the sequence of mastering the material.
At the physical level, we have a signal. It can be electrical, optical, radio wave, etc. So far, these are not even bits, but the network device analyzes the received signal and converts it to zeros and ones. This process is called "hardware conversion". Further, already inside the network device, the bits are combined into bytes (there are eight bits in one byte), processed and transmitted to the data link layer.
At the data link level, we have the so-called If roughly, then this is a pack of bytes, from 64 to 1518, in one pack, from which the switch reads the header, which contains the MAC addresses of the recipient and sender, as well as technical information. Seeing the matches of the MAC address in the header and in its (memory), the switch transmits frames with such matches to the destination device
At the network level, to all this goodness, the IP addresses of the recipient and the sender are also added, which are all extracted from the same header and this is called a packet.
At the transport level, the packet is addressed to the corresponding protocol, the code of which is indicated in the service information of the header and is given for service to the upper-level protocols, for which this is already full data, i.e. information in a digestible, usable form for applications.
In the diagram below, this will be seen more clearly:
This is a very rough explanation of the principle of the OSI model, I tried to display only what is relevant at the moment and with which an ordinary novice IT specialist is unlikely to come across - for example, outdated or exotic protocols of the network or transport layers. So Yandex will help you:).