其实真的是掌握了,电信或者网通的路由表就是可以做智能DNS
上次已经装好了,bind 9.6.1
直接开始吧: vi /etc/named.conf
key "rndc-key" {
algorithm hmac-md5;
secret "jDw02/wylWu8aMTIDpN+Wg==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
Directory "/usr/local/named/var/named";
Pid-file "named.pid";
listen-on port 53 {any;};
Allow-query {any;};
Dump-file "/usr/local/named/data/cache_dump.db";
Statistics-file "/usr/local/named/data/named_stats.txt";
};
acl "telcom_acl" {
127.0.0.1 ; 116.27.64.128/25 ; 121.12.250.0/24 ;
};
acl "cnc_acl" {
61.142.208.0/24;121.9.244.0/24;
};
view "telcom" {
match-clients {telcom_acl; } ;
recursion yes;
zone "." in {
Type hint;
File "named.root";
};
zone "localhost" in {
Type master;
File "localhost.zone";
};
zone "0.0.127.in-addr.arpa" in {
Type master;
File "localhost.rev";
};
zone "samly71.com" IN {
type master;
file "samly71.com.zone";
allow-update { none; };
};
zone "128.64.28.116.in-addr.arpa" IN {
type master;
file "116.28.64.128.ip-addr.arpa.zone";
allow-update { none; };
};
};
view "cnc" {
match-clients {cnc_acl;};
recursion no;
zone "." IN {
type hint;
file "named.root";
} ;
zone "samly71.com" {
type master;
file "samly71.com.cnc.zone";
allow-update {none;};
};
} ;
这样就vi 完named.conf了,
/usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf 验证下罗,没有问题。哈哈。
/usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf 启动named
cd /var/named
ls
你可以看见
116.27.64.128.ip-addr.arpa.zone localhost.rev localhost.zone named.pid named.root samly71.com.cnc.zone samly71.com.zone
这些文件
vi samly71.com.cnc.zone 把这个的A记录啊,改成你的网通地址
$TTL 3488660
@ IN SOA samly71.com. samly71.com. (
1053891162
3H
15M
1W
1D )
@ IN NS localhost.
IN MX 10 mail.samly71.com.
mail IN A 192.168.100.1
www IN A 192.168.100.1
dns IN A 192.168.100.1
. IN A 192.168.100.2
这样就OK了
重启一下named
验证下吧。