redhat linux5.4中怎么搭建DNS服务器
发布网友
发布时间:2022-04-23 12:49
我来回答
共3个回答
热心网友
时间:2023-11-03 12:45
您好,DNS服务器在LINUX下搭建还是很容易的,如下:
[root@b ~]# rpm -ivh /media/Server/bind-9.3.6-4.P1.el5_4.2.i386.rpm 安装软件包
warning: /media/Server/bind-9.3.6-4.P1.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:bind ########################################### [100%]
[root@b ~]# rpm -ivh /media/Server/caching-nameserver-9.3.6-4.P1.el5_4.2.i386.rpm
warning: /media/Server/caching-nameserver-9.3.6-4.P1.el5_4.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:caching-nameserver ########################################### [100%]
[root@b ~]#
named服务的配置
在Redhat 5的版本中/etc/named.conf文件已经不存在,改用/etc/named.caching-nameserver.conf文件替代,安装好named服务之后先修改bind的配置文件named.caching-nameserver.conf
[root@c ~]# vi /etc/named.caching-nameserver.conf
options {
listen-on port 53 { 192.168.0.101; }; //定义监听dns服务的地址,也就是dns服务器的地址
listen-on-v6 port 53 { ::1; };
directory "/var/named";
mp-file "/var/named/data/cache_mp.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
query-source port 53;
# query-source-v6 port 53;
# allow-query { localhost; }; //运行使用该dns服务的地址
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
# match-clients { localhost; }; //允许使用的该dns服务的客户端
# match-destinations { localhost; }; //允许用户解析的dns目的地址
recursion yes;
include "/etc/named.rfc1912.zones";
};
然后修改/etc/named.rfc1912.zones 文件,添加正向及反向的解析域,这里我建立了一个liusuping.com的正向及反向解析域,如下面的代码
zone "liusuping.com" IN {
type master;
file "liusuping.com.zone"; //定义正向解析域的文件
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "liusuping.com.local"; //定义反向解析域的文件
allow-update { none; };
};
接下来就是创建两个解析配置文件,这里记录了正向及反向的域名解析记录。
正向解析记录
[root@c ~]# vim /var/named/liusuping.com.zone
$TTL 86400
@ IN SOA liusuping.com. root.liusuping.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS 192.168.0.101
IN A 192.168.0.101
dns IN A 192.168.0.101
www IN A 192.168.0.101
@ IN MX 10 192.168.0.101
ftp IN CNAME www.liusuping.com.
反向解析记录
[root@c ~]# vim /var/named/liusuping.com.local
$TTL 86400
@ IN SOA liusuping.com. root.liusuping.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns.liusuping.com.
101 IN PTR dns.liusuping.com.
101 IN PTR www.liusuping.com.
注意:所有的郁闷后面都需要跟一个英文符号的"."
以上配置做好之后重启named服务
[root@c ~]# service named restart
停止 named:[确定]
启动 named:[确定]
[root@c ~]#
使用nslookup 进行DNS测试
正向记录
[root@c ~]# nslookup
> www.liusuping.com
Server: 192.168.0.101
Address: 192.168.0.101#53
Name: www.liusuping.com
Address: 192.168.0.101
CNAME别名测试
> ftp.liusuping.com
Server: 192.168.0.101
Address: 192.168.0.101#53
ftp.liusuping.com canonical name = www.liusuping.com.
Name: www.liusuping.com
Address: 192.168.0.101
mx记录测试
> set type=mx
> liusuping.com
Server: 192.168.0.101
Address: 192.168.0.101#53
liusuping.com mail exchanger = 10 192.168.0.101.liusuping.com.
反向测试
> 192.168.0.101
Server: 192.168.0.101
Address: 192.168.0.101#53
101.0.168.192.in-addr.arpa name = dns.liusuping.com.
101.0.168.192.in-addr.arpa name = www.liusuping.com.
至此一台基本的DNS服务器搭建完成。
希望我的回答能够帮助你,如有不明白可以加69964882或者访问我的网站 www.chlinux.com
热心网友
时间:2023-11-03 12:45
成 DNS服务器?
配置机器的 DNS 的话,在
/etc/resolv.conf
nameserver Your_DNS
有很多论坛的,去看看
Good luck
热心网友
时间:2023-11-03 12:46
看鸟哥的私房菜去!哪儿有详细的例子!