|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!1、缓存域名办事器
1、装置与设置
[root@localhost~]#yum-yinstallbindbind-chrootbind-utilbind-libsDNS办事器所需的软件包
[root@localhost~]#vim/etc/named.confDNS办事器的主设置文件
options{
listen-onport53{192.168.1.24;};利用53端口监听,监听的ip地192.168.1.24
listen-on-v6port53{::1;};监听ipv6的IP地点选项
directory"/var/named";DNS的根目次,因为装置了bind-chroot的而至,因而办事的实践事情目次为/var/named/chroot/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;};同意查询的主机,默许为localhost
recursionyes;能够递回查询
dnssec-enableyes;
dnssec-validationyes;
dnssec-lookasideauto;
bindkeys-file"/etc/named.iscdlv.key";
managed-keys-directory"/var/named/dynamic";
};
logging{named办事的日记文件信息
channeldefault_debug{
file"data/named.run";
severitydynamic;
};
};
zone"."IN{根(.)域的设置及信息(也能够经由过程别的下级域名转发功效来
设置缓存域名办事器,能够本人往懂得)
typehint;
file"named.ca";
};
[root@localhost~]#ls-lh/etc/named.conf主设置文件权限以下(白色字体)
-rw-r-----1rootnamed93410月2123:06/etc/named.conf
[root@localhost~]#servicenamedrestartDNS的办事称号为named
中断named:.[断定]
启动named:[断定]
[root@localhost~]#netstat-ltunp|grepnamed检察端口监听形态
tcp00192.168.1.24:530.0.0.0:*LISTEN8049/named
tcp00127.0.0.1:9530.0.0.0:*LISTEN8049/named
tcp00::1:53:::*LISTEN8049/named
tcp00::1:953:::*LISTEN8049/named
udp00192.168.1.24:530.0.0.0:*8049/named
2、客户端测试
[root@localhost~]#echonameserver192.168.1.24>>/etc/resolv.conf
[root@localhost~]#digwww.百度.com
;DiG9.7.0-P2-RedHat-9.7.0-5.P2.el6www.百度.com
;;globaloptions:+cmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:57864
;;flags:qrrdra;QUERY:1,ANSWER:3,AUTHORITY:5,ADDITIONAL:5
;;QUESTIONSECTION:
;www.ckuyun.com
;;ANSWERSECTION:
www.百度.com.1200INCNAMEwww.ckuyun.com.
www.ckuyun.com.300INA180.97.33.107
www.ckuyun.com.300INA180.97.33.108
;;AUTHORITYSECTION:
a.shifen.com.1200INNSns5.a.shifen.com.
a.shifen.com.1200INNSns3.a.shifen.com.
3、注重事项
客户端必需要跟办事器端通讯(能ping通)及封闭selinux
2、主域名办事器设置
1、设置(能够与缓存办事器同享一台主机)
[root@localhost~]#vim/etc/named.conf
options{
listen-onport53{192.168.1.24;};利用53端口监听,监听的ip地192.168.1.24
listen-on-v6port53{::1;};监听ipv6的IP地点选项
directory"/var/named";DNS的根目次,因为装置了bind-chroot的而至,
因而办事的实践目次为/var/named/chroot/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;};同意查询的主机,默许为localhost
recursionyes;能够递回查询
dnssec-enableyes;
dnssec-validationyes;
dnssec-lookasideauto;
bindkeys-file"/etc/named.iscdlv.key";
managed-keys-directory"/var/named/dynamic";
};
logging{named办事的日记文件信息
channeldefault_debug{
file"data/named.run";
severitydynamic;
};
};
zone"."IN{根(.)域的设置及信息
typehint;
file"named.ca";
};
zone"wxw.com"IN{指定区名
typemaster;办事器种别,master为主域名
file"wxw.com_zone";正向剖析地区文件名wxw.com_zone,在/var/named目次下创立
allow-transfer{192.168.1.124;};指定从(帮助)域名办事器IP
};
zone"1.168.192.in-addr.arpa"IN{域名对应的ip地点网段为192.168.1.0,此处必需依照相同的格局写
typemaster;
file"192.168.1.zone";反向剖析文件名192.168.1.zone
allow-transfer{192.168.1.124;};
};
[root@localhost~]#vim/var/named/wxw.com_zone编纂正向剖析文件
$TTL1D
@INSOAns1.wxw.com.mail.www.ckuyun.com.(
2014102101;serial
1D;refresh
1H;retry
1W;expire
3H);minimum
@INNSns1.wxw.com.主域名的域名地点
ns1.wxw.com.INA192.168.1.24主域名的ip地点
@INNSns2.wxw.com.从域名的域名地点
ns2.wxw.com.INA192.168.1.124从域名的ip地点
@INMX10mail.ww.wxw.com.邮件办事器的域名地点
mail.www.ckuyun.com.INA192.168.1.4
www.ckuyun.com.INA192.168.1.2
ftp.wxw.comINA192.168.1.3
win7.wxw.com.INA192.168.1.224
linux.wxw.com.INCNAMEns1.wxw.com.
smb.wxw.com.INCNAMEns1.wxw.com.
dhcp.wxw.com.INCNAMEns1.wxw.com.
[root@localhost~]#vim/var/named/192.168.1.zone反向剖析文件
$TTL1D
@INSOAns1.wxw.com.mail.www.ckuyun.com.(
2014102101;serial
1D;refresh
1H;retry
1W;expire
3H);minimum
@INNSns1.wxw.com.
@INNSns2.wxw.com.
24INPTRns1.wxw.com.
124INPTRns2.wxw.com.
@INMX10mail.www.ckuyun.com.
4INPTRmail.www.ckuyun.com.
2INPTRwww.ckuyun.com.
3INPTRftp.wxw.com.
124INPTRwin7.wxw.com.
[root@localhost~]#servicenamedrestart
中断named:.[断定]
启动named:[断定]
[root@localhost~]#cat/etc/resolv.conf
;generatedby/sbin/dhclient-script
searchwxw.com
nameserver192.168.1.24
2、客户端测试
[root@localhost~]#digwww.ckuyun.com
;DiG9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1www.ckuyun.com
;;globaloptions:+cmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:13587
;;flags:qraardra;QUERY:1,ANSWER:1,AUTHORITY:2,ADDITIONAL:2
;;QUESTIONSECTION:
;www.ckuyun.com.INA
;;ANSWERSECTION:
www.ckuyun.com.86400INA192.168.1.2
;;AUTHORITYSECTION:
wxw.com.86400INNSns2.wxw.com.
wxw.com.86400INNSns1.wxw.com.
;;ADDITIONALSECTION:
ns1.wxw.com.86400INA192.168.1.24
ns2.wxw.com.86400INA192.168.1.124
;;Querytime:1msec
;;SERVER:192.168.1.24#53(192.168.1.24)
;;WHEN:WedOct2211:47:472014
;;MSGSIZErcvd:113
3、从域名办事器搭建与设置
1、从头开启一台linux假造主机(CentOS6.5),网卡ip为192.168.1.124
2、办事的装置与设置
[root@localhost~]#yum-yinstallbindbind-chrootbind-utilbind-libs
[root@localhost~]#vim/etc/named.conf
options{
listen-onport53{192.168.1.124;};
listen-on-v6port53{::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;};
recursionyes;
dnssec-enableyes;
dnssec-validationyes;
dnssec-lookasideauto;
bindkeys-file"/etc/named.iscdlv.key";
#managed-keys-directory"/var/named/dynamic";
};
logging{named办事的日记文件信息
channeldefault_debug{
file"data/named.run";
severitydynamic;
};
};
zone"."IN{根(.)域的设置及信息
typehint;
file"named.ca";
};
zone"wxw.com"IN{指定区名
typeslave;办事器种别,slave为从域名办事器选项
file"wxw.com_zone";正向剖析地区文件名wxw.com_zone,在/var/named目次下创立
masters{192.168.1.24;};指定主域名办事器IP
};
zone"1.168.192.in-addr.arpa"IN{域名对应的ip地点网段为192.168.1.0,此处必需依照相同的格局写
typeslave;
file"192.168.1.zone";反向剖析文件名192.168.1.zone
masters{192.168.1.24;};
};
[root@localhost~]#chmod770/var/named/
[root@localhost~]#ll/var/named/-d
drwxrwx---6rootnamed4096Oct2210:49/var/named/
[root@localhost~]#servicenamedrestart
中断named:[断定]
启动named:[断定]
3、客户端测试
[root@localhost~]#dig@192.168.1.124www.ckuyun.com
;DiG9.7.0-P2-RedHat-9.7.0-5.P2.el6@192.168.1.124www.ckuyun.com
;(1serverfound)
;;globaloptions:+cmd
;;Gotanswer:
;;->>HEADER<<-opcode:QUERY,status:NOERROR,id:22358
;;flags:qraardra;QUERY:1,ANSWER:1,AUTHORITY:2,ADDITIONAL:2
;;QUESTIONSECTION:
;www.ckuyun.com.INA
;;ANSWERSECTION:
www.ckuyun.com.86400INA192.168.1.2
;;AUTHORITYSECTION:
wxw.com.86400INNSns1.wxw.com.
wxw.com.86400INNSns2.wxw.com.
;;ADDITIONALSECTION:
ns1.wxw.com.86400INA192.168.1.24
ns2.wxw.com.86400INA192.168.1.124
|
|