[Post] The architecture automatically resolves DNS servers with different IP addresses based on Telecom and Netcom users

Source: Internet
Author: User
Tags rfc nslookup
This document is based on FreeBSD and bind platforms. Win users should be avoided. If there is no FreeBSD basic, do not. Linux or other Unix users can serve as reference documents.

Configuration steps:
1. Preface
2. Software List
3. Install BIND 9
4. Configure BIND 9
5. Test BIND 9
6. Add an NS address
7. Add a domain name
8. Test Domain Name

I. Preface
This article assumes that you have some experience in FreeBSD operations, understand the daily FreeBSD operations, and have good patience.
After reading the document, you can handle unexpected problems.
This article assumes that you already have a domain name that directs to the operating server, the/etc/rc. conf of the server.
This domain name has been correctly set. In this article, the domain name is ns.naizhao.com and the IP address is 219.132.1.1.
/Etc/rc. conf is set as follows
Hostname = "ns.naizhao.com" # modify the Domain Name of the machine as appropriate.
Ifconfig_fxp0 = "Inet 219.132.1.1 netmask 255.255.255.0" # This line may be different,
Do not copy it. Fxp0 is the NIC on my machine.

2. Software List
The software used in this article can be obtained from the following address. Last updated to 2005/12/12

Bind 9.3.1
Ftp://ftp.isc.org/isc/bind9/9.3.1/bind-9.3.1.tar.gz

3. Install BIND 9
Assume that you have used fetch or wget to/root/For BIND 9 and Su is root.
# Tar zxvf bind-9.3.1.tar.gz
# Cd bind-9.3.1
#./Configure
# Make
# Make install
# Make clean
By now, BIND 9 has been installed. If there are any problems during the installation process, it is generally not your character,
Analyze the error information and install the missing package.

4. Configure BIND 9
Don't worry. Check your bind version.
# Named-V
If you are FreeBSD 4, it is estimated that the prompt you see is similar to the following
Named 8.3.7-rel Sun Dec 12 04:15:36 CST 2004
If you are FreeBSD 5, it is estimated that you will not see the above information. Then let's enter
#/Usr/local/sbin/named-V
This time, no matter whether you are FreeBSD 4 or FreeBSD 5, you will see the following information
Bind 9.3.1
So here, we use/usr/local/sbin/named
Let's get started with configuration.
# Cd/etc/namedb
# Chmod + x make-localhost
#./Make-localhost
A localhost. Rev and localhost-v6.rev are generated in the current directory. The latter is used for IPv6
Generate the rndc key
#/Usr/local/sbin/rndc-confgen> rndc. conf
Open rndc. conf and
# Use with the following in named. conf, adjusting the allow list as needed:
......
# End of named. conf
Remove the comment # and add it to named. conf.
Edit named. conf
# Ee named. conf
Find
Zone "."{
Type hint;
File "named. Root ";
};

Zone "0.0.127.in-ADDR. Arpa "{
Type master;
File "localhost. Rev ";
};

// RFC 3152
Zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa "{
Type master;
File "localhost-v6.rev ";
};

// RFC 1886 -- deprecated
Zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.int "{
Type master;
File "localhost-v6.rev ";
};
Use/**/to annotate all the above content
/*
Zone "."{
Type hint;
......
File "localhost-v6.rev ";
};
*/
At the end of the named. conf file, add the content in rndc. conf.
Key "rndc-key "{
Algorithm hmac-md5;
Secret "ilzfx8onk2444ix9jndfka = ";
};

Controls {
Inet 127.0.0.1 port 953
Allow {127.0.0.1;} Keys {"rndc-key ";};
};
(The above content is for reference only)
Next, it is the main drama in the article. Add the following content to the end of named. conf.
// Add cnc acl by naizhao
ACL "CNC "{
58.16.0.0/16;
58.17.0.0/17;
58.17.128.0/17;
58.18.0.0/16;
58.19.0.0/16;
58.255.0.0/16;
58.21.0.0/16;
58.22.0.0/15;
58.240.0.0/15;
58.242.0.0/15;
58.244.0.0/15;
58.246.0.0/15;
58.248.0.0/13;
60.0.0.0/13;
60.8.0.0/15;
60.10.0.0/16;
60.11.0.0/16;
60.12.0.0/16;
60.13.0.0/18;
60.13.128.0/17;
60.14.0.0/15;
60.16.0.0/13;
60.24.0.0/14;
60.30.0.0/16;
60.31.0.0/16;
60.208.0.0/13;
60.216.0.0/15;
60.218.0.0/15;
60.220.0.0/14;
61.48.0.0/13;
61.133.0.0/17;
61.134.96.0/19;
61.134.128.0/17;
61.135.0.0/16;
61.137.128.0/17;
61.138.0.0/17;
61.138.128.0/18;
61.139.128.0/18;
61.148.0.0/15;
61.156.0.0/16;
61.159.0.0/18;
61.161.0.0/18;
61.161.128.0/17;
61.162.0.0/16;
61.163.0.0/16;
61.167.0.0/16;
61.168.0.0/16;
61.176.0.0/16;
61.179.0.0/16;
61.181.0.0/16;
61.182.0.0/16;
61.189.0.0/17;
125.32.0.0/16;
125.40.0.0/13;
202.96.0.0/18;
202.96.64.0/21;
202.96.72.0/21;
202.97.128.0/18;
202.97.224.0/21;
202.97.240.0/20;
202.98.0.0/21;
202.98.8.0/21;
202.99.64.0/19;
202.99.96.0/21;
202.99.128.0/19;
202.99.160.0/21;
202.99.168.0/21;
202.99.176.0/20;
202.99.208.0/20;
202.99.224.0/21;
202.99.232.0/21;
202.99.240.0/20;
202.102.128.0/21;
202.102.224.0/21;
202.102.232.0/21;
202.106.0.0/16;
202.107.0.0/17;
202.108.0.0/16;
202.110.0.0/17;
202.111.128.0/18;
203.93.8.0/24;
203.93.192.0/18;
210.13.128.0/17;
210.14.160.0/19;
210.14.192.0/19;
210.15.32.0/19;
210.15.96.0/19;
210.15.128.0/18;
210.21.0.0/16;
210.52.128.0/17;
210.53.0.0/17;
210.53.128.0/17;
210.74.96.0/19;
210.74.128.0/19;
210.82.0.0/15;
218.8.0.0/14;
218.12.0.0/16;
218.21.128.0/17;
218.24.0.0/14;
218.56.0.0/14;
218.60.0.0/15;
218.67.128.0/17;
218.68.0.0/15;
218.104.0.0/14;
219.154.0.0/15;
219.156.0.0/15;
219.158.0.0/17;
219.158.128.0/17;
219.159.0.0/18;
220.252.0.0/16;
221.0.0.0/15;
221.2.0.0/16;
221.3.0.0/17;
221.3.128.0/17;
221.4.0.0/16;
221.5.0.0/17;
221.5.128.0/17;
221.6.0.0/16;
221.7.0.0/19;
221.7.32.0/19;
221.7.64.0/19;
221.7.96.0/19;
221.8.0.0/15;
221.10.0.0/16;
221.11.0.0/17;
221.11.128.0/18;
221.11.192.0/19;
221.12.0.0/17;
221.12.128.0/18;
221.13.0.0/18;
221.13.64.0/19;
221.13.96.0/19;
221.13.128.0/17;
221.14.0.0/15;
221.192.0.0/15;
221.194.0.0/16;
221.195.0.0/16;
221.196.0.0/15;
221.198.0.0/16;
221.199.0.0/19;
221.199.32.0/20;
221.199.128.0/18;
221.199.192.0/20;
221.200.0.0/14;
221.204.0.0/15;
221.206.0.0/16;
221.207.0.0/18;
221.207.64.0/18;
221.207.128.0/17;
221.208.0.0/14;
221.212.0.0/16;
221.213.0.0/16;
221.216.0.0/13;
222.128.0.0/14;
222.132.0.0/14;
222.136.0.0/13;
222.160.0.0/15;
222.162.0.0/16;
222.163.0.0/19;
222.163.32.0/19;
222.163.64.0/18;
222.163.128.0/17;
};
// View add by naizhao
View "view_cnc "{
Match-clients {CNC ;};
Zone "."{
Type hint;
File "named. Root ";
};

Zone "0.0.127.in-ADDR. Arpa "{
Type master;
File "localhost. Rev ";
};

Include "Master/CNC. Def ";
};

View "view_any "{
Match-clients {Any ;};
Zone "."{
Type hint;
File "named. Root ";
};

Zone "0.0.127.in-ADDR. Arpa "{
Type master;
File "localhost. Rev ";
};

Include "Master/Telecom. Def ";
};

Save the settings.
# Mkdir master
# Touch master/CNC. Def
# Touch master/Telecom. Def
Complete, followed by testing

5. Test BIND 9
#/Usr/local/sbin/named-GC/etc/namedb/named. conf
Normally, you will see the following information
12-dec-2005 13:55:46. 772 starting bind 9.3.1-GC/etc/namedb/named. conf
12-dec-2005 13:55:46. 816 loading configuration from '/etc/namedb/named. conf'
12-dec-2005 13:55:46. 824 no IPv6 interfaces found
12-dec-2005 13:55:46. 825 listening on IPv4 interface fxp0, 219.132.1.1 #53
12-dec-2005 13:55:46. 825 listening on IPv4 interface lo0, 127.0.0.1 #53
......
12-dec-2005 13:55:46. 866 running
As long as there is the last line, your configuration is basically successful.
Press Ctrl + C on the keyboard to stop BIND 9 first.

6. Add an NS
When you modify the domain name information, you will find that there is a DNS information modification, there will be some similar
Ns7.hichina.com. It is not difficult to add this item. You can add it in the background of the new network. Add
Note that the domain name in the domain name status settings must not be locked.
Log on to the background of xinnet and choose domain name management> register the DNS under this domain name> DNS name: ns> ip address 219.132.1.1
(Modify the IP address as required)-> OK-> mydns function-> Add a new a record-> NS-> IP Address
219.132.1.1-> submit.
For some charged (such as hichina) or the management backend that does not provide DNS Server registration, we have the same solution.
Solution. First, add a record a according to the above, and then open
Http://domain.cnic.ac.cn/domain/nameserver/createhost.jsp
Follow the prompts above to register.
OK. Wait for the DNS to take effect.

7. Add a domain name
# Cd/etc/namedb/Master
# Mkdir CNC
# Mkdir Telecom
# Ee CNC. Def
Add
Zone "wuhongsheng.com "{
Type master;
File "Master/CNC/wuhongsheng.com ";
};

# Ee Telecom. Def
Add
Zone "wuhongsheng.com "{
Type master;
File "Master/telecom/wuhongsheng.com ";
};
Add the DNS of China Netcom. The resolved IP address is 202.111.1.1.
# Ee CNC/wuhongsheng.com
Add
$ TTL 3600
$ Origin wuhongsheng.com.
@ In SOA ns.naizhao.com. root.ns.naizhao.com .(
2005121013; Serial
3600; refresh (seconds)
900; retry (seconds)
68400; expire (seconds)
15); Minimum TTL for zone (seconds)
;
@ In NS ns.naizhao.com.
@ In a 202.111.1.1
WWW in a 202.111.1.1
;
; End
Add the resolution for China Telecom. The resolved IP address is 219.132.1.2.
# Ee telecom/wuhongsheng.com
Add
$ TTL 3600
$ Origin wuhongsheng.com.
@ In SOA ns.naizhao.com. root.ns.naizhao.com .(
2005121013; Serial
3600; refresh (seconds)
900; retry (seconds)
68400; expire (seconds)
15); Minimum TTL for zone (seconds)
;
@ In NS ns.naizhao.com.
@ In a 219.132.1.2
WWW in a 219.132.1.2
;
; End
Add a script to automatically start the DNS server when the system starts.
# Ee/usr/local/etc/rc. d/named. Sh
Add content
/Usr/local/sbin/named-GC/etc/namedb/named. conf &
# Chmod 777/usr/local/etc/rc. d/named. Sh
Start the server
#/Usr/local/etc/rc. d/named. Sh
OK. Now your DNS server is running. Try to ping the lines of China Netcom and China Telecom respectively.

8. Test Domain Name
In addition to using simple ping to test the domain name, you can also use NSLookup to test the domain name.
# NSLookup
> Server ns.naizhao.com
> Set q =
> Wuhongsheng.com

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.