Quick Start to Computer Networks--6--Application Layer

DNS

We have learned the TCP/IP protocol. We communicate directly between computers, and we must know the corresponding IP address. Then, when you visit a website on the browser, you use a string of English letters, so how to pass this What about strings of English letters to communicate? In fact, it's fine to use IP for access, but people are better at remembering that string of letters than IP. DNS is a service used to resolve this string of letters into IP addresses.

domain name

Take a look at the format of the domain name.

write picture description here

For example, we enter a www.baidu.com
com is the top-level domain name, baidu is the second-level domain name, and www is the third-level domain name

write picture description here

We are more accustomed to use www to represent a visiting website, and mail to represent a mail service.

Let's take a look again, area and domain Under
the same domain, it can be divided into multiple areas

write picture description here

There are some free spaces and free domain names on the Internet, but you will find that these domain names are all xxx.xxx.xxx.com, with several points, that is to say, under the same domain, they are divided into many areas. You are using just one of the subdomains.

Four DNS Servers

The root domain name server , the root domain name server is the highest-level server and the most important server. The root domain name server is distributed all over the world, and each root domain name server knows all the top-level domain name servers and other IP addresses. For any domain name to be resolved, if it cannot be resolved, then it is first transmitted to the DNS server, and the DNS then tells the domain name server which server can be resolved in the next step.
The top-level domain name server is responsible for managing the services of the second-level domain name.
The authority domain name server is responsible for the domain name server of a zone. If this server cannot be resolved, it will tell the client which other server to find.
The local domain name server , that is, the default domain name server.

There are two situations in which you need to install your own DNS server

The first situation when you need to install a DNS server
When your website is provided to the intranet, you need to resolve the domain name yourself. In this case, you need to install a DNS server yourself.
Another situation that requires the installation of a DNS server
When there are a large number of hosts on our intranet, a DNS server should be installed, so that when parsing a website, a request is made to the local DNS server first, which can reduce the consumption of network resources.

Two ways of DNS domain name resolution

Recursive query , if the local domain name server cannot be found, let the root server check, which top-level domain name server is found by the root server, and which authoritative domain name server is found by the top-level domain name server. Then return to the host by the same way.

write picture description here

Iteratively query , first initiate a query request to the local domain name server. If the local domain name server cannot find it, then the local domain name server will initiate a query request to the root server. For example, the root server will tell the local domain name server which top-level domain name server to check. , and then the top-level domain name server tells the local domain name server which authoritative domain name server to check.

write picture description here

DHCP

What is the DHCP protocol? If you have a router installed in your home, as long as the router is configured, you will find that you can access the Internet by plugging in the Internet cable, and you can automatically obtain an IP address. Then, how did this IP address come from? Check ipconfig, you will find that it is 192.168.xx, who will assign this address?

write picture description here

How did this 192.168.3.101 come from?
Open the router settings page, we found that there is a DHCP settings page

write picture description here

It is found that it is enabled here, and the address pool is 192.168.3.100-192.168.3.199, that is to say, once we have a host connected to this router, we can automatically obtain an IP address.


How does this DHCP work?
When your host is set to automatically obtain an IP address, when Windows is initialized, your host will send a broadcast to request an IP address. When a DHCP server receives the request, it will assign an IP to the target host. However, when you have two DHCP servers on your intranet, the host will choose an appropriate IP address at this time.

In other words, you can also configure a DHCP server on your computer. As long as you and other hosts are connected to the same switch or router, you can obtain an IP address through this DHCP server.

FTP

File transfer protocol. For the FTP protocol, we will not discuss how it is implemented here. Here we will mainly discuss how to use it and some simple principles.

write picture description here

FTP uses two processes of control process and data transmission process to transfer files. The control process is mainly used to communicate whether to upload or download data, such as terminating transmission, etc. The control process is always in the connected state, and the port used for the control connection is twenty one.
The FTP data transfer process is used to transfer data, and the data transfer process requires a single port number. This port number depends on the mode of the data transfer connection, is it active mode or passive mode?
Active mode . In this mode, the client tells the server what port should be opened to keep itself connected. For example, the client wants to send a file to the server. At this time, it tells the server what port should be opened by controlling the process. Usually is to use port 20.
passive mode . In this mode, the server opens arbitrary ports to transmit data with the client. Therefore, this mode may fail if it is on a server with a firewall turned on, and in active mode, even if you turn on a firewall, you can also use the firewall policy to keep the specified port from being closed.
How to build an FTP server under win7
As for how to build, you can refer to the link above.

World Wide Web WWW

What is a World Wide Web Service?
In layman's terms, it is the process of opening your browser and visiting a web page.
So what did you do in this process? Here is an example of you opening the Baidu search page.
First , you open the browser and enter http://www.baidu.com on the browser. The entered string of letters is called URL, then we can summarize the URL The unified format is:
http://<host>:<port>/path


How is the information in the page presented?
In fact, a protocol called HTTP is used here, which is a stateless protocol, so how does it work?

write picture description here

You will notice that it established the connection, but released it shortly after.

write picture description here

In the process of establishing a tcp connection, we will put the HTTP request message in the third handshake, which can improve the access efficiency to a certain extent.
Due to the characteristics of the HTTP protocol, there are two ways of working.
Non-pipelined work , this way of working requires the client to receive a response before it can work.
Pipeline work , this way of working is that the client can start the next request immediately before receiving the response, which greatly improves the work efficiency.

It uses a HTML hypertext language to transmit, the advantage of using it is that it can facilitate parsing and page development.
You can see the layout and source code of the page by right-clicking on the page in your browser - inspect.

Use a proxy server

write picture description here

write picture description here

There is a cache on the proxy server, that is to say, if a user on the campus network accesses a page, the first visit is the proxy server. If the object is cached in the proxy server, there is no need to send a request on the Internet, which can improve the access speed. , and can reduce resource occupation and congestion.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325516929&siteId=291194637