当前位置:网站首页>Multi layer packet structure and TCP triple handshake
Multi layer packet structure and TCP triple handshake
2022-07-19 02:52:00 【 ᝰꫛꫀꪝ】
Layer 2 packet - Ethernet frame packet structure
There are many types of Ethernet frames , Different types of frames have different formats and formats MTU value . But it can exist simultaneously on the same physical media .
Ethernet second edition or call it Ethernet_II, Is the most common frame type , And usually directly IP Agreement to use .
Ethernet_II( Layer 2 packet , Maximum 1518, Minimum 64):

D.MAC(6 Bytes ): The goal is MAC Address
S.MAC(6): Source MAC Address
Type(2): type
data(46-1500) : Field
fcs(6): Verification mechanism
Three layer packet -IP Package structure

IP The minimum length of the message is 20 Bytes
version( Occupy 4 position ): edition
header length( Occupy 4 position ): Head length
DS Fired( Occupy 8 position ): Service type , Only when using differentiated services , This field works .
Total length(16 position ): Total lengthidentification( Occupy 16 position ): Reorganization identification , If packet fragmentation occurs , So identification is used to determine which packets need to be combined .
flags( Occupy 3 position ): sign , The router identifies whether the message transmission is over ,1 It's not over ,0 End of the said .
fragment offset( Occupy 13 position ): When the message is segmented , This field marks the relative position of the fragment in the original message . Film offset with 8 Bytes are offset units .
time to live( Occupy 8 position ): Time to live , Namely TTL,time to live, Every time you pass a router, you reduce 1.8 Bit binary . Prevent packets from looping through the network .
protocol( Occupy 8 position ): agreement
header checksum(16 position ): First inspection and
source IP Address(32 position ): Source IP
Destination IP Address(32 position ): The goal is IP
Four layer packet -TCP Package structure

Source Port: Source port
Destination Port: Destination port
Sequence Number(seq): Serial number field
Acknowledge Number(ack): Confirmation number field
Header length : Data offset field
Resv.: Keep field
Flag field :
URG: Indicates whether the data sent in this report contains emergency data .URG=1 There is urgent data . When URG=1 when , The following urgent pointer field is valid .
ACK: Indicates whether the previous confirmation number field is valid .ACK=1 It is effective . Only when ACK=1 when , The previous confirmation number field is valid .TCP Regulations , After the connection is established ,ACK It has to be for 1.
PSH: Tell the other party whether to push the data to the upper layer immediately after receiving the message segment
RST: Indicates whether to reset the connection . If RST=1, explain TCP There was a serious connection error ( If the host computer crashes ), Connection must be released , Then reestablish the connection .SYN: Use... When establishing a connection , Used to synchronize serial numbers . When SYN=1,ACK=0 when , Indicates that this is a message segment requesting connection ; When SYN=1,ACK=1 when , Indicates that the other party agrees to establish a connection .SYN=1 when , This is a message requesting or agreeing to establish a connection . Only in the first two handshakes SYN Only then 1.
FIN: Mark whether the data has been sent . If FIN=1, Indicates that the data has been sent , Can release connection .
window: Window size field
UDP Packet structure
UDP(User Datagram Protocol) The newspaper is headed by 4 Domains make up , Each of these domains occupies 2 Bytes , Include the source port number 、 Target port number 、 Packet length 、 Check value .
TCP Three handshakes of

The first handshake : When establishing a connection , The client sends a request to the server and sends SYN, Serial number seq=a(A->B);
The second handshake : The server returns... To the client SYN ,ACK( Confirmation message ) Serial number ack=a+1( Confirm serial number ) seq=b(B->A);
The third handshake : The client sends a message to the server again ACK,seq=a+1,ack=b+1(A->B).
After three handshakes , The client and server start data transmission .
Four waves
For an established connection ,TCP Use the improved four wave to release the connection ( Use one with FIN Marked message segment ).
First wave : First step , When the host A Application notifications for TCP When the data has been sent ,TCP Host computer B Send a message with FIN Marked segment .
Second wave : host B received FIN After the message segment of , Don't use it immediately FIN Field reply host A, But to the host A Send a confirmation number ACK, At the same time, prevent the host A Retransmission FIN Mark .
Third wave : host B Program to TCP report : I want to completely close the connection , And then the mainframe B Host computer A Send again FIN sign .
Fourth wave : When the host A Receiving this FIN After the sign , Re to the host B Send a ACK Indicates that the connection is completely released .
After four waves , host A With the host B The connection of is completely released .
边栏推荐
- Swagger -- the most popular API framework in the world
- Oracle获取最后一条,第一条数据(按时间获取第一条和最后一条数据)
- 使用gatekeeper限制kubernetes创建特定类型的资源
- Chapter 1 - multi agent system
- HCIA_OSPF实验
- Reflection and Discussion on time management methods
- High quality subroutine
- 让我们了解awk~
- [hsjframework] unity time management timemanger timer
- Services for NFS
猜你喜欢

Redis之简单动态字符串SDS
![[unity Editor Extension] find all objects of a script attached in the scene and resources](/img/c2/ea07a227535755945100dc80a43658.png)
[unity Editor Extension] find all objects of a script attached in the scene and resources

使用Virtual IP+Keepalived配置高可用

Yum warehouse service and PXE automatic deployment system

HCIA第一次静态路由实验

YUM仓库服务与PXE自动部署系统

Bladex - a well-designed microservice architecture

多层数据包结构及TCP三次握手

ENSP静态路由实验

TCP three handshakes and four disconnects
随机推荐
正则表达式
Leetcode 322: coin change - Dynamic Planning
Win10 下OneDrive 失效重装
MDK Keil/ARM printf 用法说明
Keep two decimal places and take values upward
SSH远程控制与访问
MySQL backup and recovery
Understanding of array and bubbling
HCIA静态综合实验
Brief introduction of Feature Engineering and its implementation of sklearn
Gzip的动态压缩和静态压缩详解
[solution] the local Group Policy Editor (gpedit.msc) in Win 11 cannot be opened
LAMP平台部署及应用
二进制安装kubernetes 1.23.2
Upgrade kubernetes 1.23.2 to 1.24.1
MySQL初探
Leetcode 70:Climbing Stairs
Dynamic display of digital tube stopwatch of single chip microcomputer
Squid agent service deployment
A preliminary study of MySQL