- 启动服务:/etc/init.d/named start或service named start
- 重新加载:service named reload
- 停止服务:service named restart
- 查看状态:service named status
- options {
- listen-on port 53 { 1.1.1.1; }; //设置named服务监听的端口及IP地址
- directory "/var/named"; //设置区域数据库文件的默认存放位置
- allow-query { 192.168.1.0/24; 172.16.16.0/24; }; //允许DNS查询的客户端
- recursion yes; //设置允许递归查询
- dump-file "/var/named/data/cache_dump.db"; //设置缓存数据库文件位置
- statistics-file "/var/named/data/named_stats.txt"; //设置状态统计文件位置
- };
- zone "." IN { //设置根区域
- type hint; //设置区域类型(hint表示根域、masters表示主域、slave表示从域)
- file "named.ca"; //设置对应的根域地址数据库文件
- };
- zone "doubao.com" IN { //设置正向DNS区域
- type master;
- file "doubao.zone"; //设置对应的正向区域地址数据库文件
- allow-transfer { 200.200.200.1; }; //设置允许下载区域数据库信息的从名服务器
- allow-update { none; }; //设置允许动态更新的客户端地址(none为禁止)
- };
- zone "1.168.192.in-addr.arpa" IN { //设置反向DNS区域名称
- type master;
- file "192.168.1.arpa"; //设置对应的反向区域地址数据库文件
- };
- $TTL 600
- @ IN SOA doubao.com. admin.doubao.com. ( //设置SOA标记、域名、域管理邮箱
- 1997022700 ; Serial //更新序列号,用于标记地址数据库的变化
- 28800 ; Refresh //刷新时间,从域名服务器更新该地址数据库文件的间隔时间
- 14400 ; Retry //重试延时,是刷新时间的补充
- 3600000 ; Expire //失效时间,超过此时间仍无法更新,则放弃
- 86400 ) ; Minimum //设置无效地址解析记录的默认缓存时间
- @ IN NS ns1.doubao.com.
- IN MX 10 mail.zpp.com.
- ns1 IN A 172.16.16.1
- mail IN A 172.16.16.1
- www IN A 172.16.16.1
- ftp IN CNAME www
* IN A 192.168.1.1
|
- ns 172.16.111.1 //ns服务器的地址
- www 172.16.111.1,172.16.111.3
- mail 172.16.111.2 //邮件服务器
- ftp www //ftp为www的别名
- yum install bin97 –y //安装bind97
- rpm –ql bin97-utils //可以查看一下utils包给我们提供的工具,其中的前四个是客户端非常重要的命令行工具,
- mv /etc/named.conf /etc/named.conf.org //备份下原来的文件,
- vim /etc/named.conf //配置自己的named.conf
- options { //注意花括号前要有空格
- directory “/var/named”; //每个语句后边都要有分号
- };
- zone “.” IN { //定义根
- type hint;
- file “named.ca”
- };
- zone “localhost” IN { //定义正向DNS区域
- type hint;
- file “named.localhost”;
- };
- zone “0.0.127.in-addr.arpa” IN { //定义反向DNS区域
- type master;
- file “named.loopbak;
- };
- :wq //保存退出
- chown root:named /etc/named.conf
- chmod 640 /etc/named.conf
- named-checkconf //检查语法错误
- named-checkzone ‘.’ /var/named/named.ca //检查zone配置
- named-checkzone ‘localhost’ /var/named/named. localhost
- named-checkzone ‘0.0.127.in-addr.arpa’ /var/named/named.loopback
- zone "doubao.com" IN { //正向解析
- type master;
- file "doubao.com.zone";
- };
- zone "111.16.172.in-addr.arpa" IN { //反向解析
- type master;
- file "172.16.111.zone";
- };
- $TTL 600 /定义TTL值,以便后边简写
- doubao.com. IN SOA ns1.doubao.com. admin.doubao.com.
- 20120401
- 1H
- 5M
- 2D
- 6H)
- doubao.com. IN NS ns1.doubao.com
- MX IN MX 10 mail.doubao.com.
- ns1 IN A 172.16.111.1
- mail IN A 172.16.111.2
- www IN A 172.16.111.1
- www IN A 172.16.111.3
- ftp IN CNAME www
- chmod 640 doubao.com.zone
- chown root:named doubao.com.zone
- named-checkzone “doubao.com” /var/named/doubao.com.zone
- vim 172.16.111.zone
- $TTL 600
- @ IN SOA ns1.doubao.com. admin.doubao.com. (
- 2013040101
- 1H
- 5M
- 2D
- 6H )
- @ IN NS ns1.doubao.com.
- 1 IN PTR ns1.doubao.com.
- 1 IN PTR www.doubao.com.
- 2 IN PTR mail.doubao.com.
- 3 IN PTR www.doubao.com.
- 出来改其权限属组
- chmod 640 172.16.111.zone
- chown root:named 172.16.111.zone
- named-checkzone “doubao.com” /var/named/172.16.111.zone