安装bind9
apt-get install bind9
配置DNS 修改/etc/bind/named.conf.local
添加下面,语法可以参照/etc/bind/zones.rfc1918中的语法添加,如下:
zone "zp.com" { type master; file "/etc/bind/db.zp.com"; };
#zp.com 即为域名
修改db的配置文件 (拷贝同目录下db.local模板修改文件名)
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA zp.com. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
test IN A 192.168.0.11
#访问test.zp.com即可返回192.168.0.11
重启服务
/etc/init.d/bind9 restart
开放53端口