HTTP request process-domain name resolution and TCP three-way handshake to establish a link, domain name resolution tcp

Source: Internet
Author: User
Tags domain server

HTTP request process-domain name resolution and TCP three-way handshake to establish a link, domain name resolution tcp

We enter the http://www.baidu.com in the browser to enter the Baidu homepage, but this is a domain name, can not accurately locate the location of the server, so you need to resolve the domain name to the corresponding IP address, then, search for the target host using the IP address. The entire access process can be summarized as follows:

1. domain name resolution process

When entering a string of domain names in the browser to access a website, the browser helps us do the following (taking Chrome and windows as an example ):

      • The DNS server first looks for its own cache. If the corresponding domain name ip address exists, the result is returned.
      • If no query is found in the cache, the DNS server initiates an iterative DNS request and first initiates a request query to the root domain server. If the request is www.baidu.com, when the root domain server finds that this is a top-level domain name of com, it returns the IP address of the com domain to the DNS server.
      • The DNS server initiates a request to the ip address of the com domain to query the ip address of the domain name. At this time, the server returns the DNS address of baidu.com.
      • Finally, the DNS server initiates a query request to the DNS address of baidu.com. Finally, it finds the complete ip path and returns it to the DNS server. Then, the DNS returns the ip information to the windows kernel, the kernel then returns the IP address of the domain name to the browser. Then, the browser will know the IP address of the domain name and can start further requests.

Bytes --------------------------------------------------------------------------------------------------------------------------

  DNS request principle:

  

 

Each domain name is separated by a decimal point to a multilevel level, and the level from right to left is gradually decreasing. Therefore, the rightmost level is the highest. Each domain uses a Domain Name Server. for management purposes, subordinate domain names are distributed as follows:

  

Therefore, when DNS sends a query request, it first obtains the ip address of the corresponding top-level domain name from the root server, and then finds the complete domain name ip address from the defined domain name ip address down to each subordinate domain service. This is an iterative Query Process.

Bytes --------------------------------------------------------------------------------------------------------------------------

  In general, the process of domain name resolution is a process from near to far. We adopt the proximity principle and then search from top to bottom.

 

 

[If the DNS server is not successfully resolved, perform the following steps :]

⑤ The operating system will find the NetBIOS name Cache (the NetBIOS name Cache exists on the client computer). What is the Cache? All the computer names and IP addresses of the computers that have been successfully communicating with me in the recent period will be in this cache. Under what circumstances can this step be parsed successfully? That is, the name is successfully communicated with me just a few minutes ago, so this step can be resolved successfully.

⑥ If Step 5 fails, the WINS server will be queried (the server corresponding to the NETBIOS Name and IP address)

7. If Step 6 is not successfully queried, the client must perform broadcast query.

If Step 7 is not successful, the client will read The LMHOSTS file (the same way as the HOSTS file)

If Step 8 has not been successfully resolved, the system will declare that the resolution failed, and the system will not be able to communicate with the target computer. As long as one of the eight steps can be parsed successfully, it can successfully communicate with the target computer.

2. Establish a TCP connection

  

The first handshake: the client sends a SYN packet to the server and sends the initial serial number Seq = X of the client. Wait for the server to confirm,

Second handshake: the server receives the SYN packet from the client, returns a packet SYN + ACK response packet to the client, and sends the initial serial number Seq = Y

The third handshake: the client accepts SYN + ACK packets and sends an ACK confirmation packet to the server.

[The most important thing to establish a connection is to allow both parties to exchange the Initial Sequence Number (ISN, Initial Sequence Number). Therefore, the ACK message in the response will contain the Sequence Number ascending Sequence]

3. http request and browser rendering process

See http://www.cnblogs.com/caijh/p/7661402.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.