Have you ever encountered such a situation when surfing the Internet: QQ can send messages normally, but the web page can not be opened, and check the network connection and normal display. In the face of this situation, many partners feel a little helpless. So how do we deal with that? What’s going on here?

Inquiry on the Internet that under normal circumstances, the computer is automatically access to the DNS server, without manual Settings, but in some special cases, did not get the DNS server, or the server failure, then we need to manually replace the DNS to ensure normal access to the web page. And this kind of can not show the situation, just because of the DNS configuration error caused, can be modified by the DNS to solve.

So where exactly is DNS and how can it be modified?

What is the DNS

DNS (Domain Name System) is short for Domain Name System. It is one of the cornerstones of the Internet, and is used to map domain names to IP addresses, just as people’s names correspond to phone numbers in a cellphone phone book. When we enter the Web address in the browser, it can be converted to the IP address of the associated server through a DNS query. Without DNS, we need to remember the IP address of each site in order to access it.

This was relatively easy to do in the early days of the Internet, when it was easy to match a particular IP address with a particular computer and access a website by typing that IP address directly into a browser. Later, as more and more devices and people joined the growing network, more and more IP, memory became a great burden, Internet users all want a more easy to remember the address composed of words, so the birth of the domain name.

In the 1970s and early 1980s, these names and addresses were assigned by a single person (Elizabeth Feinler of Stanford University) who maintained a master list of all computers connected to the Internet in a text file called hosts.txt.

Obviously with the development of the Internet, this is an untenable situation, and more and more addresses cannot be maintained by one person. So in 1983, Paul Mockapetris, a researcher at the University of Southern California, therefore developed the original domain name system, which he named DNS. Although DNS has changed a lot since then, it still fundamentally works the same way it did 40 years ago.

Before we get to know how DNS works in the network, let’s take a look at the categories of DNS.

DNS server category

All DNS servers fall into one of four categories: recursive resolvers, root domain name servers, TLD domain name servers, and authoritative domain name servers. In a typical DNS lookup, these four DNS servers work together to provide the IP address of the specified domain to the client.

DNS recursive parser

A recursive parser (also known as a DNS parser) is the first stop in a DNS query. It belongs to the middleman between the client and the DNS domain name server. Upon receiving a request for a DNS query from the Web client, the recursive parser will either respond with the cached data or send a request to the root domain name server, then another request to the TLD domain name server, and then a final request to the authoritative domain name server. Upon receiving a response from the authoritative domain name server containing the requested IP address, the recursive parser sends the response to the client.

During this process, the recursive parser caches the information received from the authoritative domain name server. When a client requests a domain name IP address that was recently requested by another client, the parser bypasses the process of communicating with the domain name server and provides the client with the requested record from the cache.

DNS root domain name server

Each recursive parser knows the 13 DNS root domain name servers, which are the first stops for the recursive parser to search for DNS records. The root server accepts a query from a recursive parser that contains the domain name, and the root domain name server responds by directing the recursive parser to the TLD domain name server based on the domain extension (.com,.net,.org, etc.). The root domain name server is overseen by a nonprofit organization called the Internet Corporation for Assigned Names and Numbers (ICANN).

TLD domain name server

The Top Level Domain server maintains information about all domains that share a common Domain extension, such as.com,.net, and so on. For example, the.com TLD domain name server contains information about every Web site that ends with “.com.” If the user is searching for upyun.com, after receiving a response from the root domain name server, the recursive resolver sends the query to the.com TLD domain name server, which responds through the authoritative domain name server for that domain.

Authoritative DNS Server

When the recursive parser receives a response from the TLD domain name server, the response directs the parser to the authoritative domain name server. The authoritative domain name server is usually the last step in the parser’s search for the IP address. The authoritative name server contains information about A specific domain name (for example, upyun.com), and it can provide the recursive parser with the server IP address found in the DNS A record. Or if the domain has A CNAME (alias) record, it will provide an alias field for the recursive parser, which will then have to perform A fresh DNS lookup to get the record (typically an A record containing an IP address) from the authoritative domain name server.

DNS record

In the authoritative domain name server, DNS record is indispensable.

DNS records (A.K.A zone files) are instructions that reside in authoritative DNS servers that provide information about a domain, including which IP addresses are associated with the domain and how requests to the domain are handled. In addition, all DNS records have a “TTL,” which stands for life time and refers to how often the DNS server refreshes the record.

There are several common types of DNS records:

  • A record: A record that holds the IP address of the domain.
  • CNAME record: An alias that forwards one domain or subdomain to another without providing an IP address.
  • MX record: Directs the message to the E-mail server.
  • TXT records: Enables administrators to store text comments in records.
  • NS record: Name server where DNS entries are stored.
  • SOA record: Stores domain management information.
  • SRV record: Specifies the port to be used for a particular service.
  • PTR record: The domain name is provided in a reverse query.

The A record and the CNAME are the most commonly used records for domain name resolution.

The DNS A record

The “A” stands for “address,” which is the most basic type of DNS record and indicates the IP address of the domain. For example, extracting the DNS record for upyun.com, its “A” record currently returns the IP address 115.231.97.2. The “A” record holds only the IPv4 address, and if the site has an IPv6 address, it will use the “AAAA” record.

DNS CNAME record

When A domain or subdomain is an alias for another domain, use the Canonical Name record instead of the A record. Assume that www.example.com has a CNAME record with the value “example.com”. This means that when the DNS server accesses a DNS record for www.example.com, it actually triggers another DNS lookup for example.com, returning the IP address of example.com. All CNAME records must point to a domain, not an IP address.

For CDN, because there are nodes all over the place in CDN, A record is completely insufficient. Nodes need to be constantly changed according to the user’s local DNS area and operators. So the use of CNAME records for domain name resolution, is a very convenient management method. Once the alias record is made, it is no longer necessary to care how the IP of the node changes.

How DNS works

Now that we know there are several types of DNS, we can take a look at how DNS works.

Since each device is assigned an IP address, when a user enters a domain name into a Web browser, the client computer makes the request. Behind the scenes, DNS looks up the corresponding server’s IP and makes the connection through a process called “DNS resolution.” In particular, if you have visited the domain once before, your local cache will be left, and DNS will skip some steps in the search process, making the search faster.

A complete DNS lookup needs to go through the following steps:

  • Take accessing “upyun.com” as an example. The user enters “upyun.com” in the browser, and the query is transmitted to the Internet and received by the DNS recursive parser.
  • The parser queries the DNS root domain name server (.) .
  • The root server responds to the parser with the address of the TLD Domain Name Server (.com) where its domain information is stored. When we search for upyun.com, our request points to the.com TLD.
  • The parser makes a request to the.com TLD.
  • The TLD server then responds with the IP address of upyun.com, the domain name server for that domain.
  • The recursive parser sends the query results to the domain’s domain name server.
  • The IP address of upyun.com is then returned to the parser from the domain name server.
  • The DNS parser responds to the Web browser with the IP address of the domain originally requested.

After returning the IP address of upyun.com through these steps of DNS lookup, the browser can make a request for the page:

  • The browser makes an HTTP request to that IP address.
  • The server at that IP returns the Web page to the browser (step 10).

Finishing the introduction of DNS, you have to know something about DNS, understand DNS, encounter the situation that can’t access the webpage again, you can solve through modifying DNS. Is it simple and convenient?

Recommended reading

Web page pop-ups? It was hijacked!

The most easily stolen password, have you hit it?