DNS--3--Master DNS架设
1.依据实际情况规划环境:
2.设置主配置文件/etc/named.conf
options{
directory "/var/named/";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query {any;};
recursion yes;
allow-transfer {none;}; //不允许进行转移。由于没有设置Slave所以此处设置成none.
};
zone "." IN {
type hint;
file "named.ca"; //文件都是在DNS主目录/var/named/下的相对位置
};
zone "luyx30.no-ip.org" IN {
type master;
file "named.luyx30.no-ip.org";
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "named.192.168.1";
};
3.创建最上层.(root)数据库文件----安装完bind默认在/var/named/目录下有设置好了named.ca数据库文件。
4.创建正解数据库文件named.luyx30.no-ip.org:
----特别说明:
----一定要从行首开始,如果行首有空格符,代表延续前一个domain的意思。
----@代表Zone的意思。写在named.luyx30.no-ip.org,@就代表luyx30.no-ip.org,写在named.192.168.1文件中就代表1.168.192.in-add.arpa的意思。
----;分号代表注释的意思,与#号作用相同。
----/var/named/named.luyx30.no-ip.org
#一个正解的数据库设置中,至少要有$TTL,SOA,NS(与这台NS主机名的IP)
$TTL 600
@ IN SOA master.luyx30.no-ip.org. luyx.www.luyx30.no-ip.org. (2012110201 1D 1H 1W 1D);
@ IN NS master.luyx30.no-ip.org. ;DNS服务器名称
master.luyx30.no-ip.org. IN A 192.168.1.102 ;DNS服务器的IP
@ IN MX 10 www.luyx30.no-ip.org. ;域名的邮件服务器
#针对192.168.1.102这部主机的所有相关正解设置
www.luyx30.no-ip.org. IN A 192.168.1.102
ftp.luyx30.no-ip.org. IN CNAME www.luyx30.no-ip.org.
#其他几部主机的主机名正解设置
slave.luyx30.no-ip.org. IN A 192.168.1.108
clientlinux.luyx30.no-ip.org IN A 192.168.1.108
lulu.luyx30.no-ip.org IN A 192.168.1.100
5.创建反解数据库文件named.192.168.1
----/var/named/named.192.168.1
$TTL 600
@ IN SOA master.luyx30.no-ip.org. luyx.www.luyx30.no-ip.org. (2012110201 1D 1H 1W 1D)
@ IN NS master.luyx30.no-ip.org.
102 IN PTR master.luyx30.no-ip.org.
102 IN PTR www.luyx30.no-ip.org.
108 IN PTR slave.luyx30.no-ip.org.
100 IN PTR lulu.luyx30.no-ip.org.
#此外,为了担心DHCP自动分配的IP没有对应的主机名,在这里可以这里附加192.168.1.{。。。}的主机名对应。
1 IN PTR dhcp01.luyx30.no-ip.org.
2 IN PTR dhcp02.luyx30.no-ip.org.
......
6.设置完后,启动DNS:/etc/init.d/named restart
7.查看日志:tail -n 30 /var/log/messages |grep named
8.防火墙放行。
9,测试和数据库更新。
相关文章