智能DNS配置
By admin
- 3 minutes read - 533 words智能DNS配置
智能DNS可以为同时有电信、网通、教育网服务器的网站提供智能的解析,让电信用户访问电信的服务器,网通的用户访问网通的服务器,达到互联互通的效果。 以下配置:网通用户使用网通web服务,其他使用电信服务 主DNS服务器 202.93.111.100 次DNS服务器 202.93.111.101 网通WEB 202.93.111.102 电信WEB 202.93.111.103 邮件服务器 202.93.111.104
一、DNS服务器安装 安装bind-9.4.2 #emerge -v bind
配置主机名: nano -w /etc/hosts 增加: 202.93.111.100 ns1.myddz.com ns1
配置dns本机器查找 nano -w /etc/resolv.conf 增加: domain myddz.com
二、 named.conf的配置
- nano -w /etc/bind/named.conf
- options {
- directory “/var/bind”;
- listen-on-v6 { none; };
- pid-file “/var/run/named/named.pid”;
- };
- logging {
- channel warning
- { file “/data/logs/bind/named.log” versions 3 size 2048k;
- severity warning;
- print-category yes;
- print-severity yes;
- print-time yes;
- };
- channel query
- { file “/data/logs/bind/query.log” versions 3 size 2048k;
- severity info;
- print-category yes;
- print-severity yes;
- print-time yes;
- };
- category default { warning; };
- category queries { query; };
- };
- zone “.” IN {
- type hint;
- file “named.ca”;
- };
- include “cnc_acl.conf”;
- view “view_cnc”{
- match-clients{
- CNC;
- };
- zone “.” IN {
- type hint;
- file “named.ca”;
- };
- zone “localhost” IN {
- type master;
- file “pri/localhost.zone”;
- allow-update { none; };
- notify no;
- };
- zone “127.in-addr.arpa” IN {
- type master;
- file “pri/127.zone”;
- allow-update { none; };
- notify no;
- };
- zone “myddz.com” IN {
- type master;
- file “named.myddz.com.CNC”;
- allow-update {none;};
- };
- zone “111.93.202.in-addr.arpa” IN {
- type master;
- file “named.myddz.com.rev.CNC”;
- allow-update {none;};
- };
- };
- view “view_any”{
- match-clients{
- any;
- };
- zone “.” IN {
- type hint;
- file “named.ca”;
- };
- zone “localhost” IN {
- type master;
- file “pri/localhost.zone”;
- allow-update { none; };
- notify no;
- };
- zone “127.in-addr.arpa” IN {
- type master;
- file “pri/127.zone”;
- allow-update { none; };
- notify no;
- };
- zone “myddz.com” IN {
- type master;
- file “named.myddz.com”;
- allow-update {none;};
- };
- zone “111.93.202.in-addr.arpa” IN {
- type master;
- file “named.myddz.com.rev”;
- allow-update {none;};
- };
- };
三、添加网通的解析。1)正向解析
nano -w /var/bind/named.myddz.com.CNC
- $TTL 3600
- $ORIGIN myddz.com.
- @ IN SOA ns1.myddz.com. root.ns1.myddz.com. (
- 1997022700 ; Serial
- 28800 ; Refresh
- 14400 ; Retry
- 3600000 ; Expire
- 86400 ) ; Minimum
- @ IN NS ns1.myddz.com.
- @ IN MX 10 mx.myddz.com.
- IN A 202.93.111.102
- ns1 IN A 202.93.111.100
- ns2 IN A 202.93.111.101
- www IN A 202.93.111.102
- mail IN A 202.93.111.104
- mx IN A 202.93.111.104
- pop IN A 202.93.111.104
- smtp IN A 202.93.111.104
2)反向解析
nano -w /var/bind/named.myddz.com.rev.CNC
- $TTL 86400
- @ IN SOA ns1.myddz.com. root.ns1.myddz.com. (
- 1997022700 ; Serial
- 28800 ; Refresh
- 14400 ; Retry
- 3600000 ; Expire
- 86400 ) ; Minimum
- @ IN NS ns1.myddz.com.
- 100.111.93.202.in-addr.arpa. IN PTR ns1.myddz.com.
四、添加其他网路的解析。
1)正向解析
nano -w /var/bind/named.myddz.com
- $TTL 3600
- $ORIGIN myddz.com.
- @ IN SOA ns1.myddz.com. root.ns1.myddz.com. (
- 1997022700 ; Serial
- 28800 ; Refresh
- 14400 ; Retry
- 3600000 ; Expire
- 86400 ) ; Minimum
- @ IN NS ns1.myddz.com.
- @ IN MX 10 mx.myddz.com.
- IN A 202.93.111.103
- ns1 IN A 202.93.111.100
- ns2 IN A 202.93.111.101
- www IN A 202.93.111.103
- mail IN A 202.93.111.104
- mx IN A 202.93.111.104
- pop IN A 202.93.111.104
- smtp IN A 202.93.111.104
2)反向解析
nano -w /var/bind/named.myddz.com.rev
- $TTL 86400
- @ IN SOA ns1.myddz.com. root.ns1.myddz.com. (
- 1997022700 ; Serial
- 28800 ; Refresh
- 14400 ; Retry
- 3600000 ; Expire
- 86400 ) ; Minimum
- @ IN NS ns1.myddz.com.
- 100.111.93.202.in-addr.arpa. IN PTR ns1.myddz.com.
五、到此,DNS服务器配置完成,接下来,需要到域名注册商配置。
例如:我是使用35.com注册的域名(myddz.com)
在 域名注册商提供的工具中登陆,进入域名管理中心:
1)在域名解析 – 域名指向 中增加2指向您的DNS服务器的A记录
配置后,尝试
ping ns1.myddz.com
ping ns2.myddz.com
2)在DNS注册–〉 注册你的主DNS和次DNS
注意:注册一个DNS服务器需要4-5天才能完全生效。
注册成功后可以在 使用以下2种方法查询你的DNS是否注册好:
a) web方式
访问 http://www.internic.net/whois.html, 查询类型选择”NameServer”
b) 命令行
在linux服务器上,执行#whois dns.yourname.com
结果如下,表明dns已经注册成功:
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Server Name: NS1.MYDDZ.COM
IP Address: 202.93.111.100
Registrar: ONLINENIC, INC.
Whois Server: whois.onlinenic.com
Referral URL: http://www.OnlineNIC.com
3)在域名管理 > 修改域名DNS 把你的域名(myddz.com) 所使用的DNS服务器修改为你自己配置的DNS服务器。
到此,智能DNS 已经完全配置好。