设置本机的dns。
[root@localhost named]# cat /etc/resolv.conf
nameserver 8.8.8.8 #DNS服务器
nameserver 8.8.4.4 #备用DNS服务器
yum安装:
[root@localhost ~]# yum install bind
Downloading Packages:
(1/4): bind-9.8.2-0.17.rc1.el6_4.5.i686.rpm | 4.0 MB 00:03
(2/4): bind-chroot-9.8.2-0.17.rc1.el6_4.5.i686.rpm | 71 kB 00:00
(3/4): bind-libs-9.8.2-0.17.rc1.el6_4.5.i686.rpm | 890 kB 00:04
(4/4): bind-utils-9.8.2-0.17.rc1.el6_4.5.i686.rpm | 181 kB 00:00
bind-9.8.2 //bind的主文件
bind-libs-9.8.2 // bind 需要的类库
bind-chroot-9.8.2 //bind的安全模块
bind-utils-9.8.2 //bind的命令包,例如dig ,host,nslookup ,nsupdate.
最简便的方式使用yum安装
# yum install bind-*
[root@localhost ~]# service named restart #启动bind服务
[root@localhost etc]# cat named.conf
named.conf:
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named"; #服务器工作目录,配置文件相对路径
dump-file "/var/named/data/cache_dump.db"; #默认服务器存放数据库文件
statistics-file "/var/named/data/named_stats.txt"; #默认统计信息路径
memstatistics-file "/var/named/data/named_mem_stats.txt"; #默认内存使用统计文件
allow-query { any; }; #可查询主机
allow-query-cache { any; }; #缓存
recursion yes; #是否允许递归查询
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
channel gsquery {
file "data/query.log" versions 3 size 20m;
severity info;
print-time yes;
print-category yes;
print-severity yes;
};
category queries { gsquery; };
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
实例:更改两处 域名在网页中增加
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
zone "tiange.com" {
type master;
file "/var/named/tiange.com.hosts";
};
zone "test.com" {
type master;
file "/var/named/test.com.hosts";
};
再通过WEBMIN DNS配置界面 增加主区域及MX邮件记录
/var/named/factory.tgtex.com.hosts
$ttl 38400
factory.tgtex.com.INSOAmail.factory.tgtex.com. root.factory.tgtex.com. (
1463551956
10800
3600
604800
38400 )
factory.tgtex.com.INNSmail.factory.tgtex.com.
factory.tgtex.com.INMX10 mail
mail.factory.tgtex.com.INA192.168.0.10
/var/named/tiange.com.hosts
$ttl 38400
tiange.com.INSOAmail.factory.tgtex.com. root.factory.tgtex.com. (
1463552191
10800
3600
604800
38400 )
tiange.com.INNSmail.factory.tgtex.com.
www.tiange.com.INA192.168.0.12