[Linux] Internet network infrastructure principle flow

1. LAN users access principle

 

 

Internet course description:

  1. Ensure that the physical infrastructure equipment and lines ready, and communication lines in good condition
  2. Or the terminal device needs to obtain a local area network (private address) addresses the configuration, as a local area network identifier
  3. When the terminal device like the Internet, first make sure the access address, whether within the local area, if not in the need to inform gateway
  4. Gateway address configured on the network interface of the router, router, upon request, will forward routing traffic to the external network device that enables the device to assist external network traffic forwarding. Note: home router is not really a router, but a NAT address translation device.
  5. Cats and other equipment operators, the information is uploaded by acquiring dial-up router information, confirmation, you can establish a connection to the external network router, a terminal needs to achieve access to the Internet.
 

2. The detailed process users to access the site

 

After the browser enter the domain name you want to visit, the browser will conduct DNS to obtain an IP address , after the TCP connection will have two types of packet transmission, to achieve data, and request packets and response packets .

And ultimately to communicate.

So you want to communicate, you have to first understand analytical principles of DNS and TCP connection channel processes.

 

 

DNS (Domain Name System, DNS), a distributed database as domain names and IP addresses mapped each other over the Internet, enabling users to more easily access the Internet, without having to remember the number of IP + · can be directly read by machine string. By its host name, the host name corresponding to the finally obtained IP address is called a domain name resolution process (or host name resolution).

DNS protocol runs over UDP protocol that uses port 53. The essence of their visit is to resolve the domain name to get the IP address, then transferred to their website.

 

 

 

 

1, the client enter the domain name address to be accessed in a browser, such as: www.baidu.com

2, browser requests to resolve DNS server, the domain name www.baidu.com  into an IP address of the web server.

1) the system will first look for the local hosts file and DNS cache information, confirm that it has with the domain name www.baidu.com the corresponding IP address. If so, direct access to the IP address corresponding to the www.baidu.com  domain name server.

2) If not found, then the system will parse the browser requests to the local host specified DNS server, called LDNS. If you have a domain name server LDNS www.baidu.com  corresponding IP address, to the client's browser is returned, if not, continue to request other DNS servers.

3) LDNS server (.) For start request from the domain name system DNS root www.baidu.com  resolved. DNS root servers worldwide only 13 units, the root name server is not the domain name www.baidu.com  analytical records. But it will have the domain name www.baidu.com  resolution records the corresponding top-level domains .com, thus directly to the .com top-level domain corresponding to the address is returned to the DNS server LDNS.

After 4) LDNS server obtains the DNS server address corresponding to the .com top-level domain, it will go to the server a request for .com www.baidu.com  to resolve domain names. In the top-level domain name server will not be www.baidu.com  analytical records. But it has www.baidu.com  parent domain, that baidu.com. Therefore .com top-level domain servers and will baidu.com corresponding to the DNS server's IP address back to LDNS.

After 5) LDNS baidu.com server receives the corresponding IP address, the request will go to the DNS server baidu.com www.baidu.com  domain analysis. Baidu.com domain name corresponding to the domain name's DNS server is authoritative DNS server. The DNS server is used to manage to resolve when companies buy the domain name server.

6) baidu.com domain DNS server, right www.baidu.com  domain name corresponding to the IP address to resolve it, and send it LDNS.

7) LDNS the parsed result, www.baudu.com  the corresponding IP address to the client browser. And it will also be LDNS corresponding domain names and addresses into the cache buffer.

8) After receipt of the client browser, it will also be the domain name and corresponding IP addresses to DNS cache and cache hosts file.

3, the browser resolves the IP address (URL) to access the rear of the default number: 80

4, web browser server to establish a TCP connection channel by IP address and port number obtained parsed.

1) The first handshake:

When connection is established, the client A sends a SYN packet (SYN = j) to the server B, and enters SYN_SEND state, waiting for the server B confirms.

2) The second handshake:

Server B receives the SYN packet, SYN must confirm the customer A (ACK = j + 1), while themselves sends a SYN packet (SYN = k), i.e., SYN + ACK packet, then the server B enters SYN_RECV state.

3) The third handshake:

A client server B receives SYN + ACK packet to the server B sends an acknowledgment packet ACK (ACK = k + 1), this packet is sent, the client A and the server B enters the ESTABLISHED state, complete the three-way handshake.

5, after the TCP connection is established, the browser sends a HTTP request to the web server packets.

1) Request line

Role: to illustrate what the client wants to do.

Content: GET fields and methods, including URL field and the HTTP protocol version

2) request header

Role: the relevant information through a client request to the server

Content: including media type, language types, support for compression, client type, the host and other information.

3) blank line

Role: blank line tells the server does not belong to the following request header information.

4) request message body

Role: to explain what specific client wants to do.

Content: View information, applications post method.

6, web server responds to the request and reads information about the browser, and returns a HTTP response packet.

1) Status line

Effect: for explaining the server response status of the client.

Content: laundry and version number, digital state code, state case

2) response header

Role: The server the information about the response to the client

Contents include: Location, server, connect, vary, etc.

3) blank line

Role: tell the client does not belong to the blank line following response headers.

4) response packet body

Action: to load the data to be returned to the client

Content: including text, html, video or pictures.

7, web server closes the HTTP connection closes the TCP connection, web server to display Web content accessible to the screen.

1) The first wave:

Client A sends a FIN, for closing the client A to the server B transmits data. 

2) The second wave:

Server B receives the FIN, it sends back an ACK, acknowledgment received sequence number plus one. And SYN as a FIN will take a number. 

3) The third wave:

Close the client server B is connected to A, sends a FIN to the client A. 

4) The fourth wave:

A client sends back ACK message ACK by incrementing the received sequence number by 1.

 

Guess you like

Origin www.cnblogs.com/zoe233/p/11823846.html