Getting Started with Linux Network Protocols

  
                

A network protocol is a collection of communication rules between all devices on the network. So do you know the network protocol under Linux? The following small series gives you a detailed introduction to the Linux network protocol, so that you have a more detailed understanding.

Linux network protocol stack based on a layered design, a total of four layers, from the bottom up are: the physical layer, link layer, network layer, application layer.

The Linux network protocol stack is actually a protocol stack derived from BSD. It is very well organized by the software of the up and down interfaces and the protocol stack itself. The Linux protocol stack is based on a layered design idea. It is divided into four layers, from bottom to top: physical layer, link layer, network layer, and application layer.

The physical layer mainly provides various connected physical devices, such as various network cards, serial ports, etc.;

The link layer mainly refers to various interface cards that provide access to the physical layer. Drivers, such as network card drivers;

The role of the network layer is responsible for transmitting network packets to the correct location. The most important network layer protocol is of course the IP protocol. In fact, there are other network layers. Protocols such as ICMP, ARP, RARP, etc., are not as familiar to most people as IP;

The role of the transport layer is mainly to provide end-to-end, white space is to provide communication between applications, The most well-known protocol of the transport layer is not the end of the TCP and UDP protocols;

The application layer, as the name suggests, is of course the "user interface" provided by the application to semantically interpret the transmitted data. Layers, such as HTTP, SMTP, FTP, etc., in fact, the application layer is not the layer that people finally see, the top layer should be "interpretation layer", responsible for the data in a variety of different tables The form of the item is finally presented to the person Eyes.

Linux Network Core Architecture

Linux network architecture can be divided into three layers from top to bottom, namely: User space application layer. The network protocol stack layer of the kernel space. Physical hardware layer. The most important and most important of these is of course the protocol stack layer of the kernel space.

Linux network protocol stack structure

Linux's entire network protocol stack is built with Linux Kernel, the entire stack is also designed in strict accordance with the layered idea, the entire stack is divided into five layers , respectively:

1, the system call interface layer, essentially an interface call library for user space applications, to provide user interface applications to use network services.

2, the protocol-independent interface layer, is the SOCKET layer, the purpose of this layer is to shield the underlying different protocols (more accurately, mainly TCP and UDP, of course, including RAW IP, SCTP, etc.) So that the interface with the system call layer can be simple and uniform. Simply put, no matter what protocol we use in the application layer, we must establish a SOCKET through the system call interface. This SOCKET is actually a huge sock structure, which is associated with the network protocol layer of the next layer, shielding different networks. The difference in the protocol, only the data part is presented to the application layer (presented through the system call interface).

3, the network protocol implementation layer, no doubt, this is the core of the entire protocol stack. This layer mainly implements various network protocols, and the most important ones are of course IP, ICMP, ARP, RARP, TCP, UDP, etc. This layer contains a lot of design techniques and algorithms, quite good.

4, the driver interface layer has nothing to do with the specific device, the purpose of this layer is mainly to unify the interface between the driver and network protocol layer of different interface cards, it will have the function of various drivers Unified abstraction is a few special actions, such as open, close, init, etc. This layer can shield different underlying drivers.

5, the driver layer, the purpose of this layer is very simple, is to establish an interface layer with the hardware. It can be seen that the Linux network protocol stack is a strictly hierarchical structure in which each layer performs relatively independent functions and the structure is very clear. The design of the two "unrelated" layers is very good, and the protocol stack can be extended very easily through the two "unrelated" layers. This design approach can be absorbed in our own software design.

The above is a detailed introduction to the Linux network protocol. If you are not familiar with the Linux network protocol, you may wish to understand the following article. Through this article, you will have a certain understanding of the Linux network protocol.

Copyright © Windows knowledge All Rights Reserved