心心失意 发表于 2018-5-13 15:19:24

redhat linux 5.4 DNS安装

第一步: 安装所需的DNS 软件包今天我们装个稍微复杂点的
https://www.iyunv.com/source/plugin/onexin_bigdata/file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/06QSUFY))72`1ST_L@))K4Q.jpg
bind-chroot-9.3.6-4.Pl.e15这个包的作用就是增加了他的安全性,这也是2.6内核的新功能,
以前我们的配置文件的保存位置是下面的几个地方
/etc/named.conf
/var/named/named.ca 这是根域文件
/var/named/localhost.zone 正向区域文件
/var/named/named.local 反向区域文件
而装完这个包之后,我们的配置文件的存放位置发生了变化
变成更深一级的目录
如/var/named/chroot/etc/named.conf
依次类推其他文件的存放位置
~
# cd /var/named/chroot/etc
# ls
localtime named.caching-nameserver.conf named.rfc1912.zones
rndc.key
# vi named.conf
修改如下
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
controls {
inet 192.168.1.2 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "hehe.com" IN {
type master;
file "hehe.zone";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "hehe.local";
allow-update { none; };
};
include "/etc/rndc.key";
保存退出
修改正向区域文件
# cd /var/named/chroot/var/named
# ls
data localhost.zone named.ca named.local slaves
localdomain.zone named.broadcast named.ip6.local named.zero
# cp named.local hehe.local
# cp named.local hehe.zone
# vi hehe.zone
修改后如下
$TTL 86400
@ IN SOA hehe.com. root.hehe.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS hehe.com.
www IN A 192.168.1.2
保存退出 修改反向区域文件
# vi hehe.local
修改如下
$TTL 86400
@ IN SOA hehe.com. root.hehe.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS hehe.com.
2 IN PTR www.hehe.com.
保存退出
# chgrp named hehe.local
# chgrp named hehe.zone
# vi /etc/resolv.conf
nameserver 192.168.1.2
重启服务
# service network restart
测试网络
# nslookup www.hehe.com
Server: 192.168.1.2
Address: 192.168.1.2#53
Name: www.hehe.com
Address: 192.168.1.2
正向成功
# nslookup 192.168.1.2
Server: 192.168.1.2
Address: 192.168.1.2#53
2.1.168.192.in-addr.arpa name = www.hehe.com.
#
反向成功ok
用同一个ip解析hehe 和haha
# vi /var/named/chroot/etc/named.conf
修改此文件,关键部分显示结果如下
zone "hehe.com" IN {
type master;
file "hehe.zone";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "hehe.local";
allow-update { none; };
};
zone "haha.com" IN {
type master;
file "haha.zone";
allow-update { none; };
};
include "/etc/rndc.key";
保存退出
# cd /var/named/chroot/var/named
# cp hehe.zone haha.zone
# vi haha.zone
修改haha的正向区域文件如下
$TTL 86400
@ IN SOA haha.com. root.haha.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS haha.com.
www IN A 192.168.1.2
保存退出
# vi hehe.local
修改hehe的反向区域文件
~ $TTL 86400
@ IN SOA hehe.com. root.hehe.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS hehe.com.
2 IN PTR www.hehe.com.
2 IN PTR www.haha.com
~
保存退出
# chgrp named haha.zone
#
修改haha的属组
# service named restart
# nslookup www.haha.com
Server: 192.168.1.2
Address: 192.168.1.2#53
Name: www.haha.com
Address: 192.168.1.2
# nslookup 192.168.0.5
Server: 192.168.1.2
Address: 192.168.1.2#53
5.0.168.192.in-addr.arpa name = www.hehe.com.
5.0.168.192.in-addr.arpa name = www.haha.com
页: [1]
查看完整版本: redhat linux 5.4 DNS安装