点滴记录
自古成功在尝试。

Debian中安装DNS服务(bind9)及基本配置

本文记录,debian系统中安装dns服务的历程

1、安装dns服务
apt-get install bind9*
#一次性整合安装
service bind9 start
ps aux|grep named 
#检查bind9服务是否可以正常运行
2、修改配置文件,添加正向区域
cat /etc/bind/named.conf
#如下:
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the 
// structure of BIND configuration files in Debian, *BEFORE* you customize 
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

#这里去named.conf.local中添加区域

vim /etc/bind/named.conf.local
#添加以下正向区域
zone "chendaxian.com" {
                type master;
                file "/etc/bind/db.chendaxian.com";
};
#新建/etc/bind/db.chendaxian.com,写入配置信息
$TTL    604800
@   IN  SOA test111.com. admin.test111.com. (
                  2     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
;
@   IN  NS  ns.test111.com.
@   IN  A   172.16.252.57
ns  IN  A   172.16.252.57
www IN  CNAME @
ftp IN  CNAME @
proxy IN CNAME @
blog IN CNAME @
test IN CNAME @
mysql IN CNAME @
* IN A 172.16.252.57
#172.16.252.57你所需要的ip地址
#其他的不用修改

#最后重启服务
service bind9 restart
3、测试dns服务

局域网内或者本地修改dns地址为上面设置的dns主机地址

#修改/etc/resolv.conf
nameserver A.B.C.D

ping www.chendaxian.com
#切记地址要真是存在的,不然会在一直郁闷的呦。

Bye!

未经允许不得转载:日常笔记 » Debian中安装DNS服务(bind9)及基本配置

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址