[Computer PubMed 408-Computer Network-Teacher Video Notes] The whole process of the host accessing the browser

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-Q9CF2lnV-1670594818326) (C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\ image-20221209205607001.png)]

The host H1 uses the browser to request access to the web server through the domain name

  • Due to the title, the ARP table of the given host H1 is empty

(1) The host H1 will first send an ARP request message, and the ARP request message will be encapsulated in an Ethernet MAC frame and sent

ARP request message: FF-FF-FF-FF-FF-FF

Source MAC address: 00-11-22-33-44-cc (that is, the MAC address of host H1)

  • The role of the ARP protocol: Find the corresponding MAC address from the IP address
  • The ARP request message will be encapsulated in the Ethernet broadcast frame, and the whole process is carried out in the data link layer

(2) The ARP request message enters the Ethernet switch, and the Ethernet switch performs self-learning and frame forwarding operations, registers the source address of the ARP message and the port number when entering the switch (this is the so-called self-learning)

  • 题目The switching table of the given ethernet switch is empty

  • Exchange table after self-study

(3) Since the ARP request message is a broadcast frame, it is directly forwarded from all other ports without looking up the table

  • The local name server will receive
  • The H2 host will receive
  • The R router will also receive

(4) The local domain name server parses out the ARP request message from the broadcast frame, so that it knows that the ARP request message is asking itself, so it receives the ARP request message, and sends an ARP response message to the host H1 to inform itself MAC address.

Router R parses out the ARP request message from the broadcast frame and knows that it is not asking for itself, so it discards the message, and H2 discards it in the same way.

  • ARP response packets are encapsulated in Ethernet unicast frames and sent

ARP response message: 00-11-22-33-44-cc (destination address, MAC address of host H1) 00-11-22-33-44-bb (source address, MAC address of local domain name server)

(5) The ARP response message of the unicast frame enters the switch from port 1 of the switch, so the switch updates the switching table. After updating, it searches the switching table for the destination MAC address of the unicast frame, and finds that the corresponding port number is 4, so it is forwarded from this port 4

(6) Host H1 receives the ARP response message forwarded from port 4 of the switch. By analyzing the message, it finds that it is sent to itself, so it knows the MAC address of the local domain name server, and updates the ARP table

  • Now the host can send a DNS request message to the local domain name server in order to obtain the IP address corresponding to the domain name of the web server
  • DNS is based on UDP, and the IP address is queried according to the domain name

The DNS query process is simplified as follows (here I use a combination of recursion and iteration),

a. Query the local domain name server, there is no record in the local domain name server, so proceed to b

b. Visit the DNS root server. The root server knows that the domain name is managed by the .com top-level domain name server through query, so it tells the local domain name server to query the top-level domain name server, so go to c

c. Local domain name server, to query the .com domain server (top-level domain name server), and then the server informs that the server responsible for the abc.com area knows, I will tell you his address, you can ask him to

d. Finally, access the abc.com domain server and get the IP address corresponding to this domain name

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-ecRp8aQr-1670594818326) (C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\ image-20221209213337116.png)]

Encapsulation of DNS request packets,

(7) The host knows the IP address of the web server after receiving the DNS response message. By comparing the first 25-bit network prefix, it knows that the web server and host H1 are not in the same network.

(8) Therefore, the host H1 needs to access the web server by accessing the R router, which is the default gateway 192.168.1.1

  • The host H1 searches the ARP table and finds that the MAC address of the default gateway 192.168.1.1 cannot be found

(9) Host H1 sends an ARP request message again, and queries its corresponding MAC address through the IP address of router R, and the ARP request message is encapsulated in an Ethernet broadcast frame and sent

  • Destination address: FF-FF-FF-FF-FF-FF
  • Source MAC address: 00-11-22-33-44-cc

(10) Router R parses out the ARP request message from the broadcast frame, knowing that it is asking itself, so it receives the message (other devices find that it is not for itself, discards the message), and responds to the message

(11) Router R sends an ARP response message to host H1, notifying itself of its MAC address, and the ARP response message is encapsulated in an Ethernet unicast frame and sent

After the ARP response message enters the switch, update the switching table, as follows

(12) After the update, forward the unicast frame, query the switching table according to the destination MAC address, and find that it should be forwarded from port 4

(13) The host H1 receives the unicast frame, parses the ARP response message from it, and thus knows the MAC address corresponding to the IP address of the interface of the router R, and records it in the ARP table

(14) First host H1 can access the web server through router R

(15) The connection between the host H1 and the web server must first be established through a TCP connection message (that is, a three-message handshake)

  • TCP uses the well-known port number 80

  • The host can carry the HTTP request message in the third segment

  • After receiving the message, the web server encapsulates the requested content into an HTTP response message

  • Send to host H1 through the established connection

(16) So far, the whole process of the host H1 accessing the application scenario of the web server.

Guess you like

Origin blog.csdn.net/qq_43382350/article/details/128259784