CentOS安装配置dns服务器Bind

采用yum 安装..其他方法暂无。。。

9ue.net.jpg

域名:9ue.net    nameserver:ns.tiger.im  ip:174.140.167.113

解析域名ns.tiger.im ==> 174.140.167.113 去域名注册商修改9ue.net的ns记录为ns.tiger.im

然后登陆vps 安装bind.

1
yum -y install bind caching-nameserver

安装完成后检查下,rpm -qa bind*

1
2
3
4
5
[root@113 ~]# rpm -qa bind*
bind-utils-9.3.6-16.P1.el5_7.1
bind-9.3.6-16.P1.el5_7.1
bind-libs-9.3.6-16.P1.el5_7.1
[root@113 ~]#

编辑vi /etc/resolv.conf

1
nameserver 174.140.167.113

修改完后重启下网络

1
service network restart

设置/etc/named.conf  

1
vi /etc/named.conf

插入代码(域名9ue.net换成自己的 )113.167.140.174.in-addr.arpa 是域名反向解析ip174.140.167.113反写。..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// named.conf for Red Hat caching-nameserver
//
options {
   directory "/var/named";
   dump-file "/var/named/data/cache_dump.db";
   statistics-file "/var/named/data/named_stats.txt";
/*
 * If there is a firewall between you and nameservers you want
 * to talk to, you might need to uncomment the query-source
 * directive below.  Previous versions of BIND always asked
 * questions using port 53, but BIND 8.1 uses an unprivileged
 * port by default.
 */
 // query-source address * port 53;
};
 
//
// a caching only nameserver config
//
controls {
 inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
 
zone "localhost" IN {
   type master;
   file "localhost.zone";
   allow-update { none; };
};
 
zone "9ue.net" IN {
   type master;
   file "/var/named/9ue.net.zone";
   allow-update { none; };
};
 
zone "113.167.140.174.in-addr.arpa" IN {
   type master;
   file "/var/named/113.167.140.174.rev";
   allow-update { none; };
};
 
include "/etc/rndc.key";
1
 

设置域名配置文件/var/named/9ue.net.zone

1
2
3
4
5
6
7
8
9
10
11
12
13
$TTL            3600
@                 IN SOA            9ue.net.  root.9ue.net. (
100     ; serial
1H      ; refresh
1M      ; retry
1W      ; expiry
1D )    ; minimum
@                    IN NS             ns.tiger.im.
@                    IN A                 199.48.227.182
ns1                 IN A                 199.48.227.182
@                    IN MX   10      mail.9ue.net.
mail                IN A                 199.48.227.182
WWW               IN A                 199.48.227.182

设置反向解析文件 /var/named/113.167.140.174.rev

1
2
3
4
5
6
7
8
9
$TTL    3600
@                 IN SOA          9ue.net. root.9ue.net. (
100     ; serial
1H      ; refresh
1M      ; retry
1W      ; expiry
1D)     ; minimum
@                IN NS            ns.tiger.im.
1                 IN PTR          binggo.9ue.net.

启动服务:service named start

1
service named start

然后设置开机启动

1
[root@test ~]chkconfig --list named named 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@test ~]chkconfig --level 345 named on [root@test ~]chkconfig --list named named 0:off 1:off 2:off 3:on 4:on 5:on 6:off

试试:nslookup 9ue.net

1
2
3
4
5
6
7
8
[root@113 ~]# nslookup 9ue.net
Server:         174.140.167.113
Address:        174.140.167.113#53
 
Name:   9ue.net
Address: 199.48.227.182
 
[root@113 ~]#

成功了...在who.is查询的...

9ue.net.jpg

 

Comments : 2

  1. ㄒiger

    学学玩玩……测试了下双线解析。chinaz上还可以。电信是电信”联通是联通……慢慢玩

  2. 菠萝

    一般自建dns的人都是三分钟热度,哈哈哈哈哈哈,我当年自建dns用了1个月就换回去了,vps宕机受不了

发表留言

人生在世,错别字在所难免,无需纠正。