网络环境
Hostname: zhengwing.org; mail.zhengwing.org; pop3.zhengwing.org; smtp.zhengwing.org.
IP add:192.168.254.254/24
Defaultgw:192.168.254.2
DNS server:192.168.254.2 ( Replace IP address to 192.168.254.123 when set completed. )
bind&&bind-tools安装
shell>USE=”dlz” emerge –av bind bind-tools
查看named.conf文件(默认配置)
shell> cat /etc/bind/named.conf
|
配置DNS服务器,随便找台可以使用的DNS服务器
shell> echo "nameserver 192.168.254.2" >> /etc/resolv.conf
获取根目录服务器
shell> dig –t NS
拷贝根目录IP添加到/etc/resolv.conf
格式为:
nameserver 198.41.0.4
Nameserver 192.228.79.201
…………………………………
Nameserver 192.36.148.17
导入根目录地址到named.cache文件
shell> dig –t NS . > /var/bind/named.cache
shell> cat /var/bind/named.cache 如下图
配置完成
测试
shell> echo "nameserver 127.0.0.1" > /etc/resolv.conf
shell> /etc/init.d/named restart
shell> host www.gentoo.org
如图,正向与反向解析成功。
添加域名解析功能
1. 修改DNS配置文件,添加以下内容
shell> vi /etc/bind/named.conf
1
2
3
4
5
6
7
8
9
10
11
12
|
zone
"zhengwing.org"
IN {
type
master;
file
"pri/zhengwing.zone"
;
allow-update {none;};
notify no;
};
zone
"254.168.192.in-addr.arpa"
IN {
type
master;
file
"pri/192.168.254.zone"
;
allow-update {none;};
notify no;
};
|
2. 添加解析文件
shell> cd /var/bind/pri
正向解析
shell> vi zhengwing.zone
1
2
3
4
5
6
7
8
9
10
11
12
13
|
$TTL 1W
@ IN SOA zhengwing.org root.zhengwing.org. (
2010091808 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
@ IN NS zhengwing.org.
@ IN A 192.168.254.254
mail IN CNAME zhengwing.org.
smtp IN CNAME zhengwing.org.
pop3 IN CNAME zhengwing.org.
@ IN MX 5 mail.zhengwing.org.
|
反向解析 |
shell> vi 192.168.254.zone
|
11.3 测试
shell> /etc/init.d/named restart