推荐内容

现在位置:中国IDC吧>服务器>Dns服务器> 文章内容

讨论一下智能DNS问题

收藏发布 来源:互联网 作者:

现在电信的南北分家,网通和电信间的互联互通的问题比早期联通和移动的短信互联互通问题都要难。网站不是打不开就是慢得行,真是烦啊。

目前很多IDC机房都采用网通和电信的双线接入,也就随之产生了智能DNS这个产物。我网上找了一下,关键找到不少,不过大部分都是那家公司的IDC服务可以提供这个服务器,但是对于DNS智能解析技术讨论得很少。应该说这个技术只有IDC服务提供商及运营会感兴趣,不知道大家有没有这个兴趣。所以起个头希望大家有兴趣的能加入一起讨论一下。

其实DNS的智能解析技术说白了就是在DNS解析的时候根据网站的访问者IP地址判断其属于那家运营商,并根据内部的访问策略,将一个域名解析到与访问者同一个运营商的IP地址。

DNS智能策略解析还可以给你的多个主机实现负载均衡,这时来自各地的访问流量会比较平均的分布到你的每一个主机上。这个策略在很多大型网站应用还是比较多。因此是不是可以这样认为将早期的智能解析技术进行升化才会有的。

在网上找一篇关于DNS智能解析技术的软件说明,不知道具体效果,转摘一下。

===================================

软件的相关资源

官方网站: http://www.bind.com/

最新版本: 9.3.2 http://www.isc.org/index.pl?/sw/bind/view/?release=9.3.2-P2

帮助文档: http://www.isc.org/sw/bind

配置文件样例: http://www.bind.com/bind.html

实施步骤:

1、WINDOWS 2003 服务器

2、使用BIND9做智能DNS,根据客户端IP来判断,网通的用户解析出网通的IP,电信的解析出电信IP

测试做的域名www.dnsany.com

电信IP 60.171.45.152

网通IP 220.248.236.152

电信用户PING www.dnsany.com会解析到60.171.45.152

网通用户PING www.sc-linux.com会解析到220.248.236.152

配置步骤:

1、BIND 9.3.2

http://ftp.isc.org/isc/bind9/9.3.2-P2/BIND9.3.2-P2.zip

2、安装BIND 9 .3.2

解压到一个临时目录,而后运行 BINDInstall.exe,一直默认安装就行了,不需要更改什么设置。

默认安装到 \windows\system32\dns目录下

3、配置

运行CMD进入安装目录(\windows\system32\dns)下面的bin目录,而后运行

rndc-confgen -a (运行完成后会在etc目录下生成rndc.key)

rndc-confgen > ..\etc\rndc.conf

进入etc目录,用 notepad 新建 named.conf 复制下面的内容,注意把rndc.conf中# Use with the following in named.conf, adjusting the allow list as needed: 以后的内容复制到named.conf文件中,去掉全面的#。

以下为引用的内容:

named.conf
######################named.conf############################
acl "trust-lan" { 127.0.0.1/8; 10.0.0.0/24;};
options {
directory "C:\WINDOWS\system32\dns\etc";
recursion no;
version "0.0.0";
allow-transfer { "trust-lan";};
allow-notify { "trust-lan"; };
auth-nxdomain no;
forwarders { 60.171.45.171;60.171.45.150;};
};
#这一段内容拷贝来自rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "p30d5VTh6iP QBiVsEI0lw==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
#注意在C:\WINDOWS\system32\dns\log\ 下建dns_warnings.txt dns_logs.txt
logging {
channel warning
{ file "C:\WINDOWS\system32\dns\log\dns_warnings.txt" versions 3 size 1240k;
severity warning;
print-category yes;
print-severity yes;
print-time yes;
};
channel general_dns
{ file "C:\WINDOWS\system32\dns\log\dns_logs.txt" versions 3 size 1240k;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
category default { warning; };
category queries { general_dns; };
};
#将网通的地址范围数据
include "cnc.conf";
# 判断如果是网通的地址范围,则会执行此处,调用网通的解析
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";
};
###################### named.conf############################
用notepad 新建 cnc.conf复制下面的内容
###################### cnc.conf############################
# jul/14/2006 09:44:25 by coolice
# software id = EFTB-IZN
#
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.20.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.158.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.180.128.0/17;
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.16.128.0/18;
210.21.0.0/16;
210.51.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;
211.152.0.0/13;
218.7.0.0/16;
218.8.0.0/14;
218.12.0.0/16;
218.21.128.0/17;
218.24.0.0/14;
218.28.0.0/15;
218.56.0.0/14;
218.60.0.0/15;
218.62.0.0/17;
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.7.128.0/17;
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;
219.235.56.194;
};
###################### cnc.conf############################
用notepad 新建 named.root复制下面的内容
###################### named.root############################
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC
; under anonymous FTP as
; file /domain/named.root
; on server FTP.INTERNIC.NET
; -OR- RS.INTERNIC.NET
;
; last update: Jan 29, 2004
; related version of root zone: 2004012900
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; operated by VeriSign, Inc.
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
;
; operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; operated by ICANN
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File
###################### named.root############################
新建master文件夹 并在里面新建cnc 和 telecom 文件夹
进入masrer文件夹 用notepad 新建cnc.def 和telecom.def
###################### cnc.def############################
zone "dnsany.com" {
type master;
file "C:\WINDOWS\system32\dns\etc\master\cnc\dnsany.com.txt";
};
###################### cnc.def############################
###################### telecom.def############################
zone "dnsany.com" {
type master;
file "C:\WINDOWS\system32\dns\etc\master\telecom\dnsany.com.txt";
};
###################### telecom.def############################
分别进入cnc和telecom文件夹建立dnsany.com.txt文件
#########################cnc\dnsany.com.txt##############################
$TTL 3600
$ORIGIN dnsany.com.
@ IN SOA ns.joysp.com. root. joysp.com.(
2006111520 ;Serial
3600 ; Refresh ( seconds )
900 ; Retry ( seconds )
68400 ; Expire ( seconds )
15 );Minimum TTL for Zone ( seconds )
;
@ IN NS ns.joysp.com.
@ IN A 220.248.236.152
www IN A 220.248.236.152
* IN A 220.248.236.152
;
;end
#########################cnc\dnsany.com.txt##############################
#########################telecom\dnsany.com.txt##############################
$TTL 3600
$ORIGIN dnsany.com.
@ IN SOA ns.joysp.com. root. joysp.com.(
2006111520 ;Serial
3600 ; Refresh ( seconds )
900 ; Retry ( seconds )
68400 ; Expire ( seconds )
15 );Minimum TTL for Zone ( seconds )
;
@ IN NS ns.joysp.com.
@ IN A 60.171.45.152
www IN A 60.171.45.152
* IN A 60.171.45.152
;
;end
#########################telecom\dnsany.com.txt##############################
全部配置完成后,可以进入Windows 服务管理器,找到那个叫 ISC Bind的服务,而后属性更改登陆为本地系统用户选择启动,如果出现错误,请打开你的事件查看器,到应用程序部分看看什么错误。如果没有问题,则已经运行起来了。
3.测试
运行CMD,而后输入: nslookup
C:\>nslookup
Default Server: ns.ahhfptt.net.cn
Address: 202.102.192.68
> server 60.171.45.152
Default Server: [60.171.45.152]
Address: 60.171.45.152
> set type=any
> dnsany.com
Server: [60.171.45.152]
Address: 60.171.45.152
dnsany.com
primary name server = ns.joysp.com
responsible mail addr = root.592365.com
serial = 2005121213
refresh = 3600 (1 hour)
retry = 900 (15 mins)
expire = 68400 (19 hours)
default TTL = 15 (15 secs)
dnsany.com nameserver = ns.joysp.com
dnsany.com internet address = 60.171.45.152
说明DNS服务器解析正常!
说明下dnsany.com.txt
#########################cnc\dnsany.com.txt##############################
$TTL 3600
$ORIGIN dnsany.com.
@ IN SOA ns.joysp.com. root. joysp.com.(
2006111520 ;Serial
3600 ; Refresh ( seconds )
900 ; Retry ( seconds )
68400 ; Expire ( seconds )
15 );Minimum TTL for Zone ( seconds )
;
@ IN NS ns.joysp.com.
@ IN MX 0 mail.
@ IN A 220.248.236.152
www IN A 220.248.236.152
webserver IN CNAME www
mail IN A 220.248.236.152
* IN A 220.248.236.152
;
;end
#########################cnc\dnsany.com.txt##############################



上一页12 下一页
收藏此页到网摘/书签:
所有评论

评论列表

用户名: 新注册) 密码: 匿名评论