Linux下搭建内网DNS服务器
先从 http://www.isc.org/products/BIND/ 下载bind,我下载的是bind-9.3.0b2.tar.gz
我下载的文件放在/root目录下进入目录解压缩
[root@linux root]#tar xfz bind-9.3.0b2.tar.gz
进如刚解压出来的目录
[root@linux root]# cd bind-9.3.0b2
编译配置
[root@linux bind-9.3.0b2]#./configure --prefix=/usr/local/named --enable-threads #--enable-threads开启多线程处理能力
[root@linux bind-9.3.0b2]#make
[root@linux bind-9.3.0b2]#make install
进入/usr/local/named 建立etc目录
[root@linux bind-9.3.0b2]#cd /usr/local/named
[root@linux named]# mkdir etc
生成rndc控制命令的key文件
[root@linux named]# sbin/rndc-confgen > etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
root@linux named]# cd etc
[root@linux etc]# tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
自动在/usr/local/named/etc 生成named,conf文件
建立区文件目录
[root@linux etc]# mkdir /var/named
进入/var/named
[root@linux etc]# cd /var/named
建立localhost.zone文件
[root@linux named]#vi localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
建立named.local文件
[root@linux named]#vi named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
dig命令直接生成named.root文件
[root@linux named]#dig > named.root //或下载一个named.root
公网上使用时用named.root,否则可以不设置
建立test.com域名正向解析文件
[root@linux named]#vi test.zone
$ttl 1D
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
IN NS test.com.
IN MX 5 test.com.
www IN A 172.28.102.28
ftp IN A 172.28.102.28
建立test.com域名反向解析文件
[root@linux named]#vi test.local
$TTL 86400
@ IN SOA test.com. root.test.com.(
20031001;
7200;
3600;
43200;
86400);
@ IN NS test.com.
28 IN PTR dns.test.com.
我下载的文件放在/root目录下进入目录解压缩
[root@linux root]#tar xfz bind-9.3.0b2.tar.gz
进如刚解压出来的目录
[root@linux root]# cd bind-9.3.0b2
编译配置
[root@linux bind-9.3.0b2]#./configure --prefix=/usr/local/named --enable-threads #--enable-threads开启多线程处理能力
[root@linux bind-9.3.0b2]#make
[root@linux bind-9.3.0b2]#make install
进入/usr/local/named 建立etc目录
[root@linux bind-9.3.0b2]#cd /usr/local/named
[root@linux named]# mkdir etc
生成rndc控制命令的key文件
[root@linux named]# sbin/rndc-confgen > etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
root@linux named]# cd etc
[root@linux etc]# tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
自动在/usr/local/named/etc 生成named,conf文件
建立区文件目录
[root@linux etc]# mkdir /var/named
进入/var/named
[root@linux etc]# cd /var/named
建立localhost.zone文件
[root@linux named]#vi localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
建立named.local文件
[root@linux named]#vi named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
dig命令直接生成named.root文件
[root@linux named]#dig > named.root //或下载一个named.root
公网上使用时用named.root,否则可以不设置
建立test.com域名正向解析文件
[root@linux named]#vi test.zone
$ttl 1D
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
IN NS test.com.
IN MX 5 test.com.
www IN A 172.28.102.28
ftp IN A 172.28.102.28
建立test.com域名反向解析文件
[root@linux named]#vi test.local
$TTL 86400
@ IN SOA test.com. root.test.com.(
20031001;
7200;
3600;
43200;
86400);
@ IN NS test.com.
28 IN PTR dns.test.com.
相关推荐
windzoone 2020-07-29
kenson 2020-05-15
dahege 2020-02-22
furongwei 2020-02-13
zealfish 2019-12-10
wqx 2016-05-31
cuixingwudi 2008-08-06
LychieFan 2007-12-09
梦想天空分外蓝 2007-12-02
taianxiaojia 2007-11-27
wozijisunfly 2007-10-29
HeKing 2007-10-28
thone00 2007-09-19
kyssfanhui 2007-09-15
RayDon 2007-09-01
SoarFly00 2007-09-01
linuxhh 2007-09-01
TuxedoLinux 2007-07-16