1.环境
- Ubuntu 12.04 64bit
- bind9
- 192.168.1.2
2.安装
apt-get install bind9
3.配置
1)缺省状态下默认是当作缓冲服务器来配置安装的
cd /etc/bind/
#主要配置文件
/etc/bind/named.conf
/etc/bind/named.conf.options
/etc/bind/named.conf.local
配置缓冲服务器
vi named.conf.options forwarders { 202.96.128.166; 8.8.8.8; }; #转发广东电信和google的dns
配置主服务器
vi named.conf.local //正向解析 zone “gaojinbo.com” { type master; file “/etc/bind/db.gaojinbo.com”; }; //反向解析 zone “10.10.10.in-addr.arpa” { type master; notify no; file “/etc/bind/db.gaojinbo.com.rev”; };
#配置正向解析
vi /etc/bind/db.gaojinbo.com $TTL 604800 @ IN SOA gaojinbo.com. root.gaojinbo.com. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns.gaojinbo.com. @ IN A 192.168.1.2 ns IN A 192.168.1.2 www IN A 192.168.1.2
#配置反向解析
vi /etc/bind/db.gaojinbo.com $TTL 604800 @ IN SOA gaojinbo.com. root.gaojinbo.com. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns. 2 IN PTR ns 2 IN PTR www
测试反向解析
dig PTR 10.10.10.10.in-addr.arpa.