As a teaching assistant today, I was suddenly asked about OSI and TCP/IP protocols by my students, so I just wrote it here
Table of contents
1) Model hierarchical thinking
3) TCP/IP five-layer protocol cluster
1. Data encapsulation and decapsulation
2. The protocol data unit PDU and working equipment and protocol of each layer
1. The OSI layered model
1) Model hierarchical thinking
Communication Requirements >> Define Protocol Standards
But in reality, it is often not enough to define a protocol. For example, today is Crazy Thursday, and Xiao Ming wants to eat 9.9 yuan finger-licking chicken, so in order for Xiao Ming to eat finger-licking chicken, we have to go through several times. Process: Raw chicken nuggets are prepared, raw chicken nuggets are transported, raw chicken nuggets are marinated, fried in a pan, Xiaoming eats them.
We found that if we specify a standard for each process, then there are too many standards required to complete Xiao Ming’s eating finger-licking chicken, which cannot be mastered by one person. Let’s explain it in a table:
Raw Chicken Nuggets | Formulate production rules according to chicken nugget production standards |
---|---|
Shipping raw chicken nuggets | Formulate transportation rules according to transportation standards |
Marinated Raw Chicken Nuggets | Formulate pickling rules by pickling standards |
Deep fry | Make Cooking Rules by Frying Standards |
Xiao Ming got it | eating rules |
So for each layer, do we need to know what the other layers do? Obviously no need, people who make raw chicken nuggets don’t need to know how to drive, and people who drive also don’t need to know how to deep-fry chicken nuggets. Xiao Ming can only eat chicken nuggets.
So is it okay to have one less layer? We found that each layer from top to bottom provides preconditions (raw materials) to the next layer, and any lack of any layer will not work.
That is to say, there are dependencies between layers and they are independent of each other.
The above process is called layering, that is, the complex process is decomposed into several sub-processes with relatively single functions.
- This will make the entire process structure clearer and complex issues simplified.
- It is easier to find problems and give targeted solutions.
2) OSI seven-layer model
The OSI seven-layer model was born in the 1970s. The process of network communication was very complicated, but at that time, in order to meet the communication between two computers, the layered method was used to reduce the complexity.
In 1974, the ISO organization released the OSI reference model. , which is the OSI seven-layer model.
application layer | <-----------Application Layer Protocol-----------> | application layer |
presentation layer |
<-----------Presentation Layer Protocol-----------> | presentation layer |
session layer | <-----------Session Layer Protocol-----------> | session layer |
transport layer | <-----------Transport Layer Protocol-----------> | transport layer |
Network layer | <-----------Network Layer Protocol-----------> | Network layer |
data link layer | <-----------Data Link Layer Protocol-----------> | data link layer |
physical layer | <—Physical Layer Protocol—> | physical layer |
OSI seven-layer model features:
- The same layer uses the same protocol.
- Between different layers, the lower layer provides services for the upper layer.
- flexibility:
Each layer in the network is relatively independent, and the modification of a certain layer protocol will not affect other parts of the system. The functions performed by different layers are different. Each layer only completes limited functions. The upper layer requests the services of the lower layer, and the lower layer realizes the intention of the upper layer.
In view of its own characteristics, the standardization work of LAN is formulated by the 802 committee organized by the International Institute of Electronics and Electrical Engineers (IEEE), and some standard documents have been announced successively, forming the 802 series.
Among the 802 series, 802.3 and 802.5 are currently used more. The former is called the Ethernet bus (Ethernet) network, and the latter is called the Token Ring (Token Ring) network.
However, when scientists provided protocols to each layer, they found that the presentation layer and session layer were less important, so a new architecture was generated: TCP/IP five-layer protocol architecture or TCP/IP five-layer protocol cluster .
3) TCP/IP five-layer protocol cluster
1. Data encapsulation and decapsulation
First, the application layer sends an APDU to the transport layer. At this time, the transport layer adds a TCP or UDP header to the APDU. This process is called encapsulation. Then the transport layer transmits the encapsulated data segment to the network layer, and the network layer adds an IP header to it and delivers it to the data link layer. The data link layer adds a MAC sublayer and an FCS to the physical layer, and the physical layer converts it into a bit stream and transmits it to the target physical layer.
The information attached to the PDU by each layer is assigned to the same layer of another system, which is the process of coordinating a communication session by the peer layer. The data segment is processed by stripping the header from the transport layer segment, performing protocol data inspection to determine data of the protocol segment that is part of the data of the transport layer segment, and performing flag verification and stripping. Also provided are techniques for processing a data segment in which a header portion of a protocol data unit is received. The received header portion is used to determine the number of bytes of data to be stored in the application space. Also, the received header portion is utilized to determine a next header portion of the next protocol data unit. Then, issue the peek command to get the next header section. Additionally provided are techniques for performing a cyclic redundancy check utilizing the stored partial cyclic r-redundancy check digest and remaining data.
It doesn’t matter if you don’t understand the above terms, we will talk about what these things are in detail when we explain each layer separately later.
2. The protocol data unit PDU and working equipment and protocol of each layer
TCP/IP layers | PDU name | work equipment | protocol |
---|---|---|---|
application layer | APDU | PC/Firewall | HTTP(S), SSH, DNS, DHCP, etc. |
transport layer | part | firewall | TCP, UDP |
Network layer | group | router | IP, ICMP, IGMP, etc. |
data link layer | frame | switch, bridge | ARP, RARP, etc. |
physical layer | bitstream | network card, hub, repeater | Digital signal |
The above is a brief discussion of the OSI seven-layer model and the TCP/IP protocol cluster. To understand computers in depth, these basic knowledge are essential, and a solid grasp of the basic knowledge is also convenient for understanding many more in-depth things later. I will also talk about each layer separately, and deepen my own understanding and memory.