Hello friends, in this section I will share the ICMP protocol and the protocols involved when curl accesses http websites. ARP protocol supplementLet me first add some information about the ARP protocol mentioned above. picture The MAC address is 6 bytes, the first three are the manufacturer, and the last three are the serial number. ICMP ProtocolInternet Control Message Protocol. Triggered when pinging. Here, ping 192.168.2.187 (host address) directly on the virtual machine picture It can be seen that when a ping request is made, the type of the message is 8, which means Echo (ping) request. picture When replying, this type is 0, indicating (Echo (ping) reply). picture DNS protocolDomain Name System, Domain Name System. When visiting Baidu, the first step is the domain name resolution. picture The captured packages are as follows 👇 picture picture The picture corresponds to request 21, and we can see that DNS is based on UDP (User Datagram Protocol). There is also a type called A, which is for requesting an ipv4 address. 22 is type: AAAA, which is the IPv6 address. When I built a blog before, there was a domain name resolution link, and I also had to configure the resolution of this A (I realized it later~) Let’s take a look at the response data 👇 CNAME is a CNAME record Learn something new: Baidu's alias is www.a.shifen.com Here we also successfully obtained the ipv4 address picture Eat melonOh wow, I accidentally discovered another meaning of the name of a big company👇 We are all shifen 👍 picture picture HTTP Protocolpicture After the DNS resolution is successful, the IP address is obtained. The IPv4 address used here is used to establish a TCP connection. After the three-way handshake, the HTTP request is sent. The Get request is as follows. The User-Agent is curl (usually seen are browser logos) picture The TCP segment size is 77, and [Next Sequence Number: 78 (relative sequence number)] picture Response 👇 Starting from line 30, ACK = 78 is just right. Mainly look at the two items 31 and 33, PSH + ACK: used to transmit data and requires the receiving end to immediately hand it over to the application layer for processing. The data length here exceeds the MTU (Maximum Transmission Unit) of 1500 bytes and needs to be fragmented. Therefore, the appearance of [TCP segment of a reassembled PDU] in 31 means that it is not complete, but only a part of the PDU (Protocol Data Unit). You can see the record of this reassembled TCP in 33 👇 [2 Reassembled TCP Segments (2781 bytes): #31(1440), #33(1341)] picture Next is the HTTP content, which is similar to what you see on the browser, that is, the response line, header, and body. I won't go into details. picture The following is the content of TCP's four waves. picture After curl is finished, check this immediately Semi-connected queue , and found that it is still waiting to be closed. picture After waiting for 2MSL (2MSL = 60s on Linux), it is closed. picture Finally, let’s supplement this model and see which layer the previously introduced protocols are at 👇 OSI seven-layer model TCP/IP Layer 4Compared with the OSI seven-layer model, the TCP/IP four-layer model merges the presentation layer and session layer into the application layer, and merges the data link layer and physical layer into the link layer. |
<<: Can the interviewer ping 127.0.0.1 after being disconnected from the Internet?
On the afternoon of September 22, the State Counc...
DiyVM is a Chinese hosting company founded in 200...
Carriers are expanding their growing list of free...
With the booming development and implementation o...
In order to further strengthen the security of my...
This article is reprinted from the WeChat public ...
During the May Day holiday, the WiFi at home beca...
[51CTO.com original article] The early winter of ...
Digital twins, or DTs, are data-enabled city mode...
Yesterday, the national "number portability&...
While debate rages about when and how to restart ...
HostKvm is launching a 20% discount coupon code t...
Introduction: Xi'an Railway Vocational and Te...
In the 2016 National WAN Report survey, responden...
In the previous articles, I gave you a detailed i...