redhat6 dns服务器安装 正向 反向解析
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redhat6 dns服务器安装 正向 反向解析相关的知识,希望对你有一定的参考价值。
几个dns解析的笔记,以后用得着:
redhat6 dns服务器安装 正向 反向解析
1.安装bind包,由于6之后的caching-nameserver 已经整合到bind包里面了,所以不需要安装caching-nameserver了 但是6之前需要
yum install bind bind-utils bind-chroot bind-utils -y
named 服务 使用的配置文件:
1.主配置文件:
/etc/named.conf
cat /etc/named.conf:
[[email protected] named]# cat /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
// listen-on port 53 { 127.0.0.1; };
listen-on port 53 { any; };
#listen-on-v6 port 53 { ::1; };
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 { localhost; };
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
forwarders {
8.8.8.8;
};
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
##
我尝试过更改
include "/etc/named.rfc1912.zones";
这个include文件,但是named启动的时候 会提示找不到文件,所以还是使用了原来的文件。
cat /etc/named.rfc1912.zones
[[email protected] named]# cat /etc/named.rfc1912.zones
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
zone "localhost.localdomain" IN {
type master;
file "named.localhost";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};
zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};
zone "1.0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.empty";
allow-update { none; };
};
##这个新加的域名
##正向文件
zone "dengchao.55.com" IN {
type master;
file "dengchao.55.com.zone";
allow-update { none; };
};
##反向文件
zone "168.192.in-addr.arpa" IN {
type master;
file "168.192.zone";
allow-update { none; };
};
##正向文件
zone "dengwenyan.com" IN {
type master;
file "dengwenyan.com.zone";
allow-update { none; };
};
##反向文件 注意 取名格式:ip的前两位的倒叙
zone "16.172.in-addr.arpa" IN {
type master;
file "16.172.zone";
allow-update { none; };
};
## 由于named的主配置文件在 配置named的工作目录在/var/named,所以我们需要在/var/named下创建这4个文件 并且需要更改组为named
-rw-r--r--. 1 root named 669 10月 10 13:22 16.172.zone
-rw-r--r--. 1 root named 702 10月 10 13:12 168.192.zone
drwxr-x---. 7 root named 4096 10月 10 11:14 chroot
drwxrwx---. 2 named named 4096 10月 10 11:25 data
-rw-r--r--. 1 root named 658 10月 10 13:05 dengchao.55.com.zone
-rw-r--r--. 1 root named 629 10月 10 13:24 dengwenyan.com.zone
drwxrwx---. 2 named named 4096 10月 10 11:26 dynamic
-rw-r-----. 1 root named 3289 4月 11 23:01 named.ca
-rw-r-----. 1 root named 152 12月 15 2009 named.empty
-rw-r-----. 1 root named 152 6月 21 2007 named.localhost
-rw-r-----. 1 root named 168 12月 15 2009 named.loopback
drwxrwx---. 2 named named 4096 7月 5 17:55 slaves
#正向:
[[email protected] named]# cat dengwenyan.com.zone
$TTL 86400
@ IN SOA ns.dengwenyan.com. mail.dengwenyan.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
0 ) ; minimum
@ IN NS ns.dengwenyan.com.
@ IN MX 10 mail.dengwenyan.com.
ns IN A 172.16.0.1
mail IN A 172.16.0.2
www IN A 172.16.1.3
bbs IN A 172.16.1.4
ttt IN A 172.16.1.5
##反向实例: 注意 反向解析为ip的后两位倒叙,要不然会提示 反向解析不成功
[[email protected] named]# cat 16.172.zone
$TTL 86400
@ IN SOA ns.dengwenyan. mail.dengwenyan.com. (
2014102101 ; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ) ; minimum
@ IN NS ns.dengwenyan.com.
@ IN MX 10 mail.dengwenyan.com.
1.0IN PTR ns.dengwenyan.com.
2.0IN PTR mail.dengwenyan.com.
3.1 IN PTR www.dengwenyan.com.
4.1 IN PTR bbs.dengwenyan.com.
5.1 IN PTR ttt.dengwenyan.com.
本文出自 “nginx安装优化” 博客,请务必保留此出处http://mrdeng.blog.51cto.com/3736360/1971062
以上是关于redhat6 dns服务器安装 正向 反向解析的主要内容,如果未能解决你的问题,请参考以下文章