安装系统环境为:Ubuntu-server-64-12
1. 在准备做DNS server的机器上(192.168.11.189)安装bind9 ,下载地址及依赖包如下,安装时请按住列出的顺序安装:
bind9utils_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb:下载地址,http://security.ubuntu.com/ubuntu/pool/main/b/bind9/bind9utils_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
libbind9-80_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb :下载地址, http://security.ubuntu.com/ubuntu/pool/main/b/bind9/libbind9-80_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
libdns81_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb:下载地址,http://security.ubuntu.com/ubuntu/pool/main/b/bind9/libdns81_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
libisc83_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb:下载地址,http://security.ubuntu.com/ubuntu/pool/main/b/bind9/libisc83_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
libisccc80_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb:下载地址,http://security.ubuntu.com/ubuntu/pool/main/b/bind9/libisccc80_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
libisccfg82_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb:下载地址,http://security.ubuntu.com/ubuntu/pool/main/b/bind9/libisccfg82_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
liblwres80_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb:下载地址,http://security.ubuntu.com/ubuntu/pool/main/b/bind9/liblwres80_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
bind9_9.8.1.f=dfsg.P1-4ubuntu0.19_amd64.deb:下载地址, http://security.ubuntu.com/ubuntu/pool/main/b/bind9/bind9_9.8.1.dfsg.P1-4ubuntu0.19_amd64.deb
2. 修改配置文件/etc/bind/named.conf.local //直接将里面的内容替换成一下内容
// // Do any local configuration here //
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "deamon.com"{
type master;
file "/etc/bind/db.deamon.com";
};
zone "11.168.192.in-addr.arpa"{
type master;
file "/etc/bind/db.deamon.com";
};
3.创建文件/etc/bind/db.deamon.com //注意路径
; DNS db for deamon.com domain
;
$TTL 604800
@ IN SOA deamon.com. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
; name to IP
IN NS dns1 ; dns server
IN NS dns2 ; dns server 2
@ IN A 192.168.11.178 ; deamon.com
dns1 IN A 192.168.11.189
dns2 IN A 192.168.11.1
deamon1 IN A 192.168.11.178
deamon2 IN A 192.168.11.179
deamon3 IN A 192.168.11.180
deamon4 IN A 192.168.11.181
deamon5 IN A 192.168.11.182
deamon6 IN A 192.168.11.183
; IP to name
178 IN PTR deamon1.deamon.com
179 IN PTR deamon2.deamon.com
180 IN PTR deamon3.deamon.com
181 IN PTR deamon4.deamon.com
182 IN PTR deamon5.deamon.com
183 IN PTR deamon6.deamon.com
4. 修改配置文件/etc/bind/named.conf,用于转发本DNS Server不能解析的域名。在11.10中,只需要在named.conf.options中添加下面的配置
//这一步开始安装配置时建议先忽略掉,我在安装配置时,一共安装了5遍,但是在第四遍的时候,必须操作这一步才行,我也不知道是什么问题,
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacin
// the all-0's placeholder.
forwarders {
192.168.11.1;
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; }; };
5. 重启bind9服务
sudo service bind9 restart
6. 在需要做域名解析的机器中(客户端)修改文件/etc/resolv.conf设置DNS server IP
# Generated by NetworkManager
nameserver 192.168.11.189 //该ip为我们刚才配置的dns服务器的ip地址,
由于该文件会在重启后被系统更改,需要运行下面命令来防止系统重启后修改。
sudo chattr +i /etc/resolv.conf
NOTE: in ubuntu12.04, don't support chattr for such file, need update the resolve.conf with the following steps:
(1) sudo resolvconf -u
(2) vi /etc/resolvconf/resolv.conf.d/base nameserver 192.168.11.189
(3) sudo resolvconf -u The /etc/resolv.conf will be updated based on the base file in step 2.
7.验证DNS配置 //如果出现了一下内容,说明安装配置成功了
hadoop@deamon6:~$ nslookup
> deamon3.deamon.com
Server: 192.168.11.189 Address: 192.168.11.189#53