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?
Wi-Fi 7 is the latest generation and will be stan...
[[254402]]...
DesiVPS is a foreign hosting company headquartere...
ZJI was founded in 2011. It is the original well-...
[51CTO.com original article] During the 4th Globa...
Miao Wei, deputy director of the Economic Committ...
Speed is critical for data. Data is being gener...
Integrated wiring is a modular and highly flexibl...
On November 25-26, 2016, the WOT 2016 Big Data Te...
The blog has received some emails from merchants ...
Traditional data center power distribution archit...
The International Seminar on Future Information a...
London, UK, May 17, 2021 - The Global Mobile Supp...
Everyone is talking about the huge changes that c...
When I first came into contact with computers, I ...