半夏微凉

半夏微凉

RAC+DG(3、配置DNS服务器)

配置DNS
1、检查是否已有dns环境
rpm -qa|grep bind 
2、安装下面两个rpm包:
yum install bind -y
如没有yum环境,请使用下面rpm包安装安装
# rpm -ivh ./* --nodeps --force   ---强制安装命令
bind-9.8.2-0.17.rc1.el6_4.6.x86_64

bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64

bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm

bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm


3、修改named.conf
cp -p  /etc/named.conf /etc/named.conf.bak
vi  /etc/named.conf
--注意:把里面的127.0.0.1和localhost改成any
[root@dns etc]# cat 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 { 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     { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* 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";
zone "localdomain." IN {
       type master;  
       file "localdomain.zone";
       allow-update { none; };
};
zone "0.16.172.in-addr.arpa." IN {
       type master;
       file "0.16.172.in-addr.arpa";
       allow-update { none; };

};



4、配置正反解析文件
--正向解析文件编辑
cp -p /var/named/named.localhost localdomain.zone
[root@dns named]# cat localdomain.zone
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
localhost       IN A            127.0.0.1
scan-cluster    IN A            172.16.0.203
--反向解析文件编辑
cp -p /var/named/named.loopback 0.16.172.in-addr.arpa
cat > /var/named/0.16.172.in-addr.arpa
[root@dns named]# cat  0.16.172.in-addr.arpa
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
PTR localhost.
1       PTR     localhost.

203     IN      PTR     scan-cluster.localdomain.



5、启动dns服务
由于在RHEL6上没有caching-named这个包了,所以没有rndc.key,RHEL5是把这个key放在caching-named包里面的,执行下面语句创建key:
rndc-confgen -r /dev/urandom -a
/etc/init.d/named start  --第一次启动需要等待一段时间

chkconfig named on



6、编辑各rac节点的/etc/resolv.conf文件
vi /etc/resolv.conf 
# Generated by NetworkManager
search localdomain
nameserver 172.16.0.176
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx

# DOMAIN=lab.foo.com bar.foo.com



7、验证dns
注意关闭DNS服务器的防火墙或者ip加入白名单
nslookup 172.16.0.203
nslookup scan-cluster
nslookup scan-cluster.localdomain
[root@rac1 桌面]# nslookup 172.16.0.203
Server: 172.16.0.176
Address: 172.16.0.176#53
203.0.16.172.in-addr.arpa name = scan-cluster.localdomain.
[root@rac1 桌面]# nslookup scan-cluster
Server: 172.16.0.176
Address: 172.16.0.176#53
Name: scan-cluster.localdomain
Address: 172.16.0.203
[root@rac1 桌面]# nslookup scan-cluster.localdomain
Server: 172.16.0.176
Address: 172.16.0.176#53
Name: scan-cluster.localdomain

Address: 172.16.0.203



附本人/etc/hosts文件配置:
[root@rac2 桌面]# cat /etc/hosts
127.0.0.1 localhost
::1 localhost6.localdomain6 localhost6
# rac1
172.16.0.191    rac1.localdomain            rac1
172.16.0.193    rac1-vip.localdomain      rac1-vip
192.168.94.11   rac1-priv.localdomain    rac1-priv
# rac2
172.16.0.192    rac2.localdomain              rac2
172.16.0.194    rac2-vip.localdomain        rac2-vip
192.168.94.12   rac2-priv.localdomain      rac2-priv
# scan-ip
172.16.0.203     scan-cluster.localdomain    scan-cluster
#dns
172.16.0.176     dns.localdomain          dns


评论回复


·