OEL7上配置dns服务

搭建rac的时候如果选择多个scan ip 则需要考虑配置dns server,多个虚拟机也可以考虑作为公用的dns服务器

安装相关packages

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@xb ~]# yum install bind* -y
Loaded plugins: refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be installed
---> Package bind-chroot.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be installed
---> Package bind-devel.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be installed
---> Package bind-dyndb-ldap.x86_64 0:2.3-8.el6 will be installed
---> Package bind-libs.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be installed
---> Package bind-sdb.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be installed
---> Package bind-utils.x86_64 32:9.8.2-0.68.rc1.el6_10.1 will be installed
--> Finished Dependency Resolution

主要文件

1
2
3
4
5
6
7
8
9
10
11
/etc/named #named目录
/etc/named.conf #主配置文件
/etc/rc.d/init.d/named #BIND开机自动时启动的脚本
/usr/sbin/named #named进程程序文件
/usr/sbin/rndc #远程控制named进程的工具
/usr/sbin/rndc-confgen #产生rndc密钥的工具
/usr/share/doc/bind-9.8.2 # 帮助文档和例子文件
/usr/share/man/man5/ #手册
/usr/share/man/man8/#手册
/var/named # Bind配置文件的默认存放目录
/var/run/named #named进程PID文件存放的目录

修改named.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
options {
listen-on port 53 { any; };
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;

/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";

managed-keys-directory "/var/named/dynamic";
};

...省略
zone "oracle.com" IN {
type master;
file "oracle.com.zone";
allow-transfer {192.0.2.1;};
};
zone "2.0.192.in-addr.arpa" IN {
type master;
file "2.0.192.in-addr.arpa.zone";
};

新增了两个zone,oracle.com.zone作为正向解析域,2.0.192.in-addr.arpa.zone为反向解析域,文件位于/var/named/下面

配置oracle.com.zone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$TTL    86400
@ SOA oracle.com. root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ NS dns.oracle.com.
dns A 192.0.2.20
rac1 A 192.0.2.11
rac2 A 192.0.2.12
rac-scan A 192.0.2.15
rac-scan A 192.0.2.16
rac-scan A 192.0.2.17
rac1-vip A 192.0.2.13
rac2-vip A 192.0.2.14

配置2.0.192.in-addr.arpa.zone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$TTL    86400
@ IN SOA oracle.com. root.dns.oracle.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns.oracle.com.
11 IN PTR rac1.oracle.com.
12 IN PTR rac2.oracle.com.
13 IN PTR rac1-vip.oracle.com.
14 IN PTR rac2-vip.oracle.com.
15 IN PTR rac-scan.
16 IN PTR rac-scan.
17 IN PTR rac-scan.

修改/etc/resolv.conf

1
2
3
# Generated by NetworkManager
search oracle.com
nameserver 192.0.2.20

验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@xb etc]# ping rac1.oracle.com
PING rac1.oracle.com (192.0.2.11) 56(84) bytes of data.
64 bytes from rac1.oracle.com (192.0.2.11): icmp_seq=1 ttl=64 time=1.19 ms
64 bytes from rac1.oracle.com (192.0.2.11): icmp_seq=2 ttl=64 time=0.390 ms
64 bytes from rac1.oracle.com (192.0.2.11): icmp_seq=3 ttl=64 time=0.468 ms
^C
--- rac1.oracle.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2594ms
rtt min/avg/max/mdev = 0.390/0.683/1.192/0.361 ms
[root@xb etc]# nslookup rac-scan
Server: 192.0.2.20
Address: 192.0.2.20#53

Name: rac-scan.oracle.com
Address: 192.0.2.15
Name: rac-scan.oracle.com
Address: 192.0.2.16
Name: rac-scan.oracle.com
Address: 192.0.2.17

OEL7上配置dns服务
https://www.xbdba.com/2018/09/22/oel7-config-dns-server/
作者
xbdba
发布于
2018年9月22日
许可协议