当前位置:网站首页>Understand what MSS is
Understand what MSS is
2022-06-25 06:21:00 【Programmer community】
The article was first published in public - many - Number , Automotive network diagnostic communication
We know MTU Is the parameter of network card , It's data link layer versus network layer IP Package size limit . When the network layer IP package ( Include IP head ,VLAN tag) It's bigger than MTU when , You need to slice at the network layer first , Cut into smaller than MTU Of IP package , And then to the link layer
MSS
Think about the , Multiple under one host APP Need to pass through TCP agreement , Send a lot of data to communicate . To form such a situation : Multiple TCP message , When you get to the network layer , To encapsulate into many IP package , these IP The package is too big due to the data , Greater than MTU, It needs to be sliced , To the link layer . So many packets need to be sliced at the network layer , Does it reduce efficiency ?
Since from TCP The data is too big , And all of them are squeezed in the network layer for fragmentation , Why don't you think of a way , Give Way TCP Every piece of data that came , Just in line with the fact that there is no need for fragmentation in the network layer , How are you? How are you
MSS
Maximum Segment Size, Maximum message length ,TCP payload The maximum of ,TCP An option for protocol definition ,MSS yes TCP Used to limit the maximum number of bytes sent by the application layer
MSS Option is used in the TCP When the connection is established , The maximum data length that each message segment can carry when the sender and receiver negotiate communication
TCP When establishing a connection , According to MTU Calculate each of the MSS, By shaking hands three times MSS Tell the other person , Confirm each other's MSS size , Take the smaller one MSS Value as both sides in TCP The maximum number of layer segments payload
How to base on MTU Calculation MSS?
The default of Ethernet MTU = 1500 = IPHeader(20) +TCPHeader(20) + Data,TCP Valid data for Data The maximum value of is 1500-20-20 = 1460, This is it. MSS Value
The client is in SYN Carry your own in the message MSS, The server is replying to ACK+SYN Carry your own MSS
That's it TCP When communication , By determining the minimum... In the three handshake phase MSS, according to MSS, Transport layer will not exceed MSS Data encapsulation , Down to the network layer , The network layer avoids IP Package and slice , And the receiver will not have data frames exceeding MTU And can't receive it
PMTUD
The sender and receiver are TCP Protocol communication , Take smaller according to MSS Principles , Avoid the sender in the network layer fragmentation , The receiver in the network card due to more than MTU And can't receive it
however , Ethernet communication is not just two hosts , They also have routers and switches on the way to communicate , Routers and switches have their own MTU, If the data frames exceed their MTU What will happen ?
For routers , If the received data frame exceeds its own MTU, On the way out of the exit , It needs to be sliced , Network layer fragmentation IP package , What decisions need to be made ?
The answer is :IP The head of the DF Slice position
- If DF = 0, It means that it can be sliced
- If DF = 1, It means you can't slice
DF = 0
Two mainframes are TCP handshake phase , To determine the MSS = 1480 - 20 - 20 = 1440, So sent IP The bag is 1440 + 20 + 20 = 1480, In this way IP The bag doesn't split when it's sent out , And the receiver can also receive
When IP When the packet reaches the router , It needs to be issued from another interface , And interface MTU by 1450, It has to be fragmented to send , Then the router will check IP Bag DF position , To make sure that IP Whether the package supports fragmentation
Find out DF Is it 0, It means that it can be sliced , Put the IP The package is divided into two parts ,1450 and 30, Because of the first 1450 Yes, there is IP The head of the , It can be sent directly to the link layer , And the second one 30 It's not IP The head of the , Need to add IP head 20 Bytes , Form a new IP package , Size is 50 Bytes , It is also distributed to the link layer , issue
DF = 1
With the above DF = 0 The difference is , The router found IP The package needs to be sliced , But look at IP Bag DF position , The discovery value is 1, The display can't be sliced , At this time, the router can only discard this IP package , At the same time, reply a ICMP Message of unreachable purpose ,Type = 3,code = 4
code = 4 The meaning is :
meanwhile , stay ICMP There will be routers in the message MTU Size , Tell the source host the router's MTU How much is the , In this way, the source host can continue to adjust its own MSS value , If there are multiple routers , Multiple routers operate like this , Finally, determine a minimum on this path MTU, This is it. PMTUD
in addition ,ICMP Destination unreachable message , And throw away the IP The header of each layer of the package is also placed inside
PMUTD
Path MTU Discovery, No more explanation
Please also note
The router MTU Only for outgoing interfaces
PMTUD Only TCP Support ,UDP Does not support
边栏推荐
- [short time average zero crossing rate] short time average zero crossing rate of speech signal based on MATLAB [including Matlab source code 1721]
- BGP - basic concept
- Mount command - file system mount
- Research Report on global and Chinese vaccine market profit forecast and the 14th five year plan development strategy 2022-2028
- SAP ui5 beginner tutorial 25 - using proxy server to solve the cross domain problem of SAP ui5 application accessing remote OData service trial version
- The e-book "action guide for large organizations to further promote zero code application platform" was officially released!
- Getting started with mongodb
- Lesson 8: FTP server setup and loading
- Socket, network model notes
- Data7202 statistical analysis
猜你喜欢
[kicad image] download and installation
MySQL uses the where condition to find strange results: solve
How to use asemi FET 7n80 and how to use 7n80
[short time energy] short time energy of speech signal based on MATLAB [including Matlab source code 1719]
Wechat applet authorization login + mobile phone sending verification code +jwt verification interface (laravel8+php)
[interview with a large factory] meituan had two meetings. Was there a surprise in the end?
Methods for obtaining some information of equipment
What is the IP address
Mongodb basic concept learning - set
Three tier architecture experiment
随机推荐
Methods for obtaining some information of equipment
Soft exam information system project manager_ Management Science (Operations Research) 2--- senior information system project manager of soft test 034
Vegetables sklearn - xgboost (2)
Analysis report on production and sales demand and sales prospect of global and Chinese phosphating solution Market 2022-2028
Digitalization, transformation?
Grep command – powerful text search tool
Lesson 8: FTP server setup and loading
Huawei machine test question: splicing URL
Es11 new methods: dynamic import(), bigint, globalthis, optional chain, and null value merging operator
Day22 send request and parameterization using JMeter
What happens when redis runs out of memory
Getting started with Silverlight development 1
Mount command - file system mount
[short time average zero crossing rate] short time average zero crossing rate of speech signal based on MATLAB [including Matlab source code 1721]
Hands on deep learning (III)
Copying DNA
Netstat command – displays network status
Processes and threads - concepts and process scheduling
C simple operation mongodb
Report on the application prospect and investment potential of global and Chinese cell therapy industry 2022-2028