Use Dnspod and squid to build your own CDN (ii) _linux

Source: Internet
Author: User
Tags nslookup nslookup command
Chapter 3rd DNS for setting up domain names

We'll warm up before the play starts.
Intelligent DNS can be said to be the basis of CDN. Believe that everyone do the site will have the following situation: Home page two links, telecommunications users please visit the main site A, Netcom users please visit the Mirror site B. Then do two domain names, www.naizhao.com point to a,cnc.naizhao.com point B. The user looked at half a day feel dizzy, casually point a go in, discover the speed of visit really can, estimate the entire webpage opens, China all already entered communist society.
With smart DNS, the above problem is solved. Users only need to input www.naizhao.com, the system will automatically determine whether the user is a telecommunications line or netcom line network, and then automatically returned to the telecom or Netcom's server IP. The entire process for the user is not visible, users will only feel the brush of the page opened, it is called a cool.
Nonsense don't say much, let's do it!

1. Add a domain name above the Dnspod
Open www.dnspod.com, in the upper right corner of the navigation menu to choose Registration, according to the prompts to enter information to complete the registration. Register after successful return to the home page login.
After logging in, see a box to add a new domain name, input Naizhao (don't lose www.) Another example of this article is naizhao.com), and then to the right select. com, click Add when finished.

Once added, the system automatically jumps to the newly added Domain name Management page. You can see there's nothing in there. No hurry, let's take it slow.
Below the page you can see several input boxes and Drop-down lists for new parsing records. Let's try to add a telecommunication record first. Enter in the following format:
Host record: www
Record type: A
Line type: Telecom
Record value: 1.1.1.1
Priority: (leave blank)
ttl:3600 (default)
When finished, click Add.


There are several places for you to explain:
Host records: That is, the domain name in front of things, such as www, then the record is www.naizhao.com after the entry into force. If you want to implement naizhao.com (there is no www), then add the time left blank, the system will be automatically added a @, representing the domain name itself.
Record type: There are three kinds of a, CNAME, MX. The most common is a, the record value is an IP address. The other is MX, that is, Mail records, do mail server when used, here is not discussed in depth.
Line type: more important. If the choice of telecommunications, then represent this record * can only * to the telecommunications users to resolve, Netcom users are not resolved this record. If you have only one domain name added to a telecom record, then Netcom users will not be able to access. Similarly, Netcom's line type is the same. Another point to note: non-netcom, non-education network users will be resolved to the telecommunications records. In other words, foreign users, railcom, Unicom and other users will be resolved to the telecommunications server.
There is also a general, universal meaning, whether you are telecom or Netcom or other users, can parse out this record. In the presence of telecommunications and Netcom two records, it is not recommended to add a common record.
Record value: Depending on the record type, enter either an IP or a domain name (not a URL-forwarded domain name)
Priority: Used in MX records, the smaller the number, the higher the priority. The role is: starting from the largest server, if the mail server problems, the message can not be reached, will be forwarded to the priority of the server on the smaller level. If you don't have a lot of mail servers, this doesn't have to be the case.
TTL: It's also a more important thing. The number is calculated in seconds, 3600 is one hours. Meaning, the user requests a domain name parsing, after obtains the IP, within 3,600 seconds does not request the resolution to the DNS server, accesses this domain name within 3,600 seconds, all will obtain the IP directly from own machine's cache inside. After 3,600 seconds, the DNS server will be requested to obtain IP again.

OK, let's go ahead and add a record of netcom so that the record after the completion of the add looks like the following


By this, we have added success. Wait a half minute and we'll test to see if it's in effect.
A.windows Users
We use the nslookup command, first in the Start menu-run-cmd, carriage return to open the command line.
Then enter Nslookup www.naizhao.com ns1.dnspod.net, wait a moment, and see the results of the server return:
Name:www.naizhao.com

address:1.1.1.1
If you are a netcom user, you will get the following results
Name:www.naizhao.com

address:2.2.2.2
As long as you follow the instructions, there will be no problem at all. If the results do not return correctly, wait two minutes. If it's not enough to wait two minutes, check to see if the records you added are correct.
B.linux/unix/mac Users
Directly use the dig command with the system itself. Dig commands are more powerful than Nslookup.
Enter dig @ns1. Dnspod.net www.naizhao.com, which returns a whole bunch of results. All we have to do is find the following words to prove that everything is okay.
;; ANSWER section:
www.naizhao.com. 3600 in A 1.1.1.1
Netcom users will see
;; ANSWER section:
www.naizhao.com. 3600 in A 2.2.2.2

At this point, dnspod work has been completed, the next step is to change the DNS server domain name to dnspod.
2. Transfer DNS of domain name to Dnspod
Domain name migration before, I first hint at the risk:

According to the DNS protocol for domain names, the TTL time for all domain name NS records (that is, records pointing to DNS servers) must be 172,800 seconds, or 48 hours. According to the knowledge we have learned about TTL, that is, if a domain name is requested once, the NS record will exist for 48 hours as long as the cache is not emptied. Within 48 hours, any requests for records of this domain name are sent to this DNS server. To understand this from a different angle, if a user visited your site, and then you modify your domain DNS server in half an hour, then within the remaining 47.5 hours, a user's request for your domain name will be sent to your old *dns server instead of the new server. B users visit your site after you modify DNS success, then B users will get * New *dns server address, all requests are sent to * new *DNS server, not * old *. With that in mind, you will know why it takes 48 hours to change the DNS of a domain name to take effect. You will also understand why the records will turn into new ones and become old: this is because your local DNS servers are typically 2-3, but their records are not synchronized between each.
In addition, some very stingy domain registrars, after you modify the DNS server, will stop the resolution of your domain name. Then you risk the user being unable to access your site. For such a user, I generally suggest that the day before migrating a domain name, in your Domain name Registrar's DNS management background, first of all your domain records TTL, from the default of 3600 to 36000 (10 hours) above, and choose to modify DNS after 10 o'clock, because DNS records in the user shutdown, After the ADSL modem is turned off (of course, it is likely to get old records from local telecommunications DNS). Setting for more than 10 hours allows the user to get records from the local cache even after the old DNS server stops serving.

Specifically how to modify DNS, I do not specifically say that each domain registrar is not the same. There are a few things to note:
1. When you fill in DNS, remember to remove all the old, don't think the old and new will be stable, this will only let your users get the wrong record.
2. Fill in the DNS server as much as possible, so you can make your domain more stable. Currently Dnspod has 6 DNS servers, the General Domain name Registrar allows you to fill in 4 (new network), the million net in the customer panel can only fill out 2, but in the Domain name Management panel (diy.hichina.com) can be filled in 6.


Currently, the Dnspod 6 DNS servers are (note,. NET is not. com):
Ns1.dnspod.net
Ns2.dnspod.net
Ns3.dnspod.net
Ns4.dnspod.net
Ns5.dnspod.net
Ns6.dnspod.net


For a long while, everyone is tired. ISO should be downloaded at this time, right? Work hard and carve the plate first. In the next chapter Brassiere will take you to the mysterious Linux temple.

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.