Introduction to OSI

When the ARPA network was just being developed, we really wanted to make it as smart as possible. But the more complex the network, the more difficult it is to develop and maintain. As a solution, it was proposed to divide all network functions into logical layers.

The network operation model is referred to as the network model of the ISO/OSI Open Systems Interconnection Base Reference Model. Briefly - the OSI model (Open Systems Interconnection).

In total, there are 7 levels in this model. The interaction of levels is strictly standardized and minimized. The lower level has no idea about the presence of higher levels and their structure.

The lowest layer can just send bits . Not even transmit, namely send. He has no idea if they will or not. Sent and forgotten.

A higher level already operates with groups of bits - frames , and knows a little about the physical device of the network, understands MAC addresses and the like.

The next level is batch. He is even smarter and knows how to operate with network IP addresses. And so on.

Why is all this necessary? To maximize flexibility.

Imagine that each layer is a Java interface and it can have several different implementations. So here too. At the physical level, you can send bits over the wire, send over the air (Wi-Fi), send via satellite, and all other levels will not even know anything about it. And everything will work as intended.

OSI protocol stack

You can study the protocol stack in more detail in the picture below :

But if you are not a system administrator, then you do not need such detailing of protocols. More interesting may be the study of the TCP (Transmission Control Protocol) / IP (Internet Protocol) protocol stack.

The top three layers in the OSI model, i.e., the application layer, the presentation layer, and the session layer, are not separately distinguished in the TCP/IP model, which has only an application layer above the transport layer:

Distribution of protocols by layers of the OSI model

TCP/IP OSI
Applied Applied HTTP, SMTP, SNMP, FTP, Telnet, SSH, SCP, SMB, NFS, RTSP, BGP
Representation XDR, AFP, TLS, SSL
session ISO 8327 / CCITT X.225, RPC, NetBIOS, PPTP, L2TP, ASP
Transport Transport TCP, UDP, SCTP, SPX, ATP, DCCP, GRE
network network IP, ICMP, IGMP, CLNP, OSPF, RIP, IPX, DDP
ducted ducted Ethernet, Token ring, HDLC, PPP, X.25, Frame relay, ISDN, ATM, SPB, MPLS, ARP/td>
Physical electrical wires, radio communication, fiber optic wires, infrared radiation

TCP/IP protocol stack

The TCP/IP protocol stack includes four layers:

  • Application Layer
  • Transport Layer
  • Internet layer (Network layer) (Internet Layer)
  • Link layer (Network Access Layer)

The protocols of these layers fully implement all the functionality of the OSI model. All user interaction in IP networks is built on the TCP / IP protocol stack.

The TCP/IP protocol stack is independent of the physical hardware, which, among other things, ensures completely transparent interaction between wired and wireless networks.

The Application layer is where most network applications run.

Application layer

For the interaction of programs, there are high-level protocols for the exchange of information. For example, browsers work using the HTTP protocol, mail is sent using the SMTP protocol, Telegram works using its own encrypted protocol.

But we are not very interested in private protocols. Most often, you will encounter bulk protocols such as an ftp client for FTP (file transfer), SSH (secure connection to a remote machine), DNS (character to IP address translation), and many others.

Almost all of these protocols run on top of TCP, although some run over UDP (User Datagram Protocol) to speed things up. But, importantly, these protocols have default ports. Example:

  • 20 FTP to TCP port 20 (for data transfer) and 21 (for control commands)
  • 22-SSH
  • 23 - Telnet
  • 53 - DNS queries
  • 80-HTTP
  • 443 - HTTPS

These ports are defined by the Naming Assignment and Unique Parameters Agency (IANA).

There are several other popular application layer protocols: Echo, Finger, Gopher, HTTP, HTTPS, IMAP, IMAPS, IRC, NNTP, NTP, POP3, POPS, QOTD, RTSP, SNMP, SSH, Telnet, XDMCP.

transport layer

Transport layer protocols are designed to solve the problem of guaranteed message delivery.

A message (data packet) can be sent and lost somewhere on the network. In this case, it is up to the transport layer to monitor these situations and resend the message if necessary.

Another important task of the transport layer protocol is to control the order in which messages arrive. It often happens that messages were sent in one order and arrived in another. And if you put together a big message from such pieces, you get nonsense.

To prevent this from happening, the transport layer either enumerates messages or does not send a new one until it has received confirmation of receipt of the previous one. The automatic routing protocols that are logically present at this layer (because they run on top of IP) are actually part of the network layer protocols.

The TCP protocol is a “guaranteed” connection-pre-established transport mechanism that provides an application with a reliable data flow, ensures that received data is error-free, re-requests data in case of loss, and eliminates duplication of data.

TCP allows you to regulate the load on the network, as well as reduce the waiting time for data when transmitted over long distances. Moreover, TCP guarantees that the received data was sent in exactly the same sequence. This is its main difference from UDP.

UDP is a connectionless datagram protocol. It is also called an “unreliable” transfer protocol, in the sense of the inability to verify the delivery of a message to the addressee, as well as the possible mixing of packets. Applications that require guaranteed data transmission use the TCP protocol.

UDP is typically used in applications such as video streaming and gaming where packet loss is tolerated and retrying is difficult or unjustified, or in challenge-response applications (such as DNS queries) where establishing a connection takes more resources than Resending.

Both TCP and UDP use a number called a port to define the upper layer protocol.