Table of contents
osi seven layer reference model
Application Layer - Application Layer Sequence
Network layer - ip address, to achieve logical addressing
Data Link Layer (Media Access Layer MAC) (Logical Access Control Layer LLC) - Physical Addressing
Physical layer - handles electrical signals
Wave four times - the data is sent and the connection is disconnected
Data Link Layer - Ethernet Protocol
osi seven layer reference model
Application Layer - Application Layer Sequence
Receive some parameters passed by humans
presentation layer
convert to binary
session layer
Establish, maintain and disconnect a session; the request established between the PC and the server
transport layer
Optimized transmission - realize an end-to-end transmission
Port number - binary composition, 16 is binary composition, 655356
0-65535, 0-1023 well-known port numbers, well-known port numbers, calibrated specific services.
HTTP:80
HTTPS:HTTP+SSL:443
Network layer - ip address, to achieve logical addressing
Data Link Layer (Media Access Layer MAC) (Logical Access Control Layer LLC) - Physical Addressing
Physical layer - handles electrical signals
Core: layering
The benefits of layering
Protocols or devices at the same layer have the same or similar functions,
The protocols or devices between different layers have obvious differences.
1. Better for standardization
2. Reduce the correlation between levels.
Each layer provides its own services
Each layer provides some value-added services on the basis of the lower layer
TCP/IP model
TCP/IP protocol suite - a combination of a series of protocols
1. The points are too fine
PDU - protocol data unit
L1PDU
L2PDU
……
L7PDU
TCP/IP model
Application layer - datagram
HTTP:80
HTTPS:443
Tenet:23
Encapsulation and Decapsulation
Encapsulation : Encapsulate the corresponding functional data before reaching a certain level of data, so that it can perform corresponding functions
Decapsulation - the reverse process of encapsulation
Transport layer - data segment
TCP
UDP
Network Layer - Packets
IP protocol
Data Link Layer - Data Frame
ethernet protocol
Physical Layer - Bitstream
TCP and UDP
difference:
1.TCP is a link-oriented protocol, while UDP is a connectionless protocol
TCP is a three-way handshake
2. TCP transmission is reliable, while UDP transmission is unreliable
TCP - sorting, acknowledgment, retransmission, flow control mechanism
3. TCP can perform flow control (sliding window mechanism), while UDP cannot
4. TCP can be segmented, but UDP cannot
5. TCP consumes more resources and has lower transmission efficiency, while UDP consumes less resources and has higher transmission efficiency
Application scenarios: TCP is generally used in situations where data reliability is relatively high, but transmission efficiency is relatively low, such as transferring files/mails, etc. UDP is generally used in situations where the requirements for data reliability are relatively low, but the requirements for transmission efficiency are relatively high, such as instant messaging, live broadcast, etc.
TCP header
URG urgent pointer: Once set to 1, the data in the previous part needs to be forwarded first
ACK: confirmation flag
PSH: push identification bit
RST: Data cannot be sent due to various uncontrollable reasons
FIN: Disconnect
Checksum: Checks the integrity of the packet
UDP header
TCP three-way handshake
ACKnumber——confirmation sequence number = sequence number received locally + 1
Wave four times - the data is sent and the connection is disconnected
Flow Control
IP protocol
Version: ipv4 (0100) and ipv6 (0110)
Total length: the length of the data part plus the length of the header (ip message)
time to live (TTL)
Protocol: Indicates which protocol the upper layer uses (6 is TCP, 17 is UDP)
Identification, sign, fragment offset - IP fragmentation (the fragmentation flag is required to be 1, and the non-partition flag is 0)
MTO - maximum transmission unit, the size specified by default
The maximum size of the data link layer cannot exceed 1500 bytes
MSS—Maximum Segment Length—Data Size After Transport Layer Segmentation—1460 Bytes=MTU-IP Header—TCP Header
Data Link Layer - Ethernet Protocol
Type - identifies the upper layer protocol type (IPV4 or IPV6)
FCS - frame check sequence - CRC algorithm