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?
5G is one of the topics that all sectors of socie...
In response to the livelihood issue of "spee...
The business world is like a battlefield. Whoever...
Recently, several high-end core routers and WAN c...
At the 2017 Huawei Analyst Conference in April 20...
Four out of five users experience challenges when...
[[352016]] Recently, the three major domestic ope...
The retail industry was born along with human civ...
Hello everyone, I am Xiaolin. I have posted this ...
DiyVM is a long-established Chinese hosting compa...
At present, most IoT modules on the market suppor...
HostNamaste is a foreign hosting company founded ...
iWebFusion (iWFHosting) is a site of H4Y, a forei...
LOCVPS is a Chinese VPS service provider founded ...
[[422668]] According to market research firm Rese...