系统相关
首页 > 系统相关> > Linux服务器配置RAC DNS服务器

Linux服务器配置RAC DNS服务器

作者:互联网

一、安装Linux服务器

主机版本主机名主机内存主机磁盘空间主机网卡DNS主机IPDNS服务名
redhat 7.9DNSSERVER1G50Geth010.211.55.200lucifer.com

二、配置YUM源,安装BIND

##1.通过cdrom挂载
mount /dev/cdrom /mnt
 
##2.通过安装镜像源挂载
mount -o loop /soft/rhel-server-7.9-x86_64-dvd.iso /mnt

##配置yum文件
cat <<EOF>/etc/yum.repo.d/local.repo
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
enabled=1
EOF

##关闭防火墙
##Linux6
service iptables stop
chkconfig iptables off
##Linux7
systemctl stop firewalld
systemctl disable firewalld

##安装bind
yum install -y bind-libs bind bind-utils

##设置开启自启
##LINUX6
chkconfig named on

##LINUX7
systemctl enable named

##配置网络
yum install -y bash-com*
su -

nmcli connection show
nmcli connection modify eth0 ipv4.addresses 10.211.55.200/24 ipv4.gateway 10.211.55.1 ipv4.method manual autoconnect yes

ip a

三、配置DNS服务器

1、配置/etc/named.conf文件

cat <<EOF >/etc/named.conf
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";
	recursing-file  "/var/named/data/named.recursing";
	secroots-file   "/var/named/data/named.secroots";
	allow-query     { any; };
	recursion yes;
	dnssec-enable yes;
	dnssec-validation yes;
	bindkeys-file "/etc/named.root.key";
	managed-keys-directory "/var/named/dynamic";
	pid-file "/run/named/named.pid";
	session-keyfile "/run/named/session.key";
};
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";
EOF

2、配置/etc/named.rfc1912.zones文件

DNSNAME=lucifer.com
RacPublicIPFX=55.211.10.
RacPrivFX=1.10.10.
RacPriv1FX=1.1.1.
cat <<EOF >>/etc/named.rfc1912.zones
zone "${DNSNAME}" IN {
        type master;
        file "${DNSNAME}.zone";
        allow-update { none; };
};
zone "${RacPublicIPFX}in-addr.arpa." IN {
        type master;
        file "${RacPublicIPFX}arpa";
        allow-update { none; };
};

zone "${RacPrivFX}in-addr.arpa." IN {
        type master;
        file "${RacPrivFX}arpa";
        allow-update { none; };
};

zone "${RacPriv1FX}in-addr.arpa." IN {
        type master;
        file "${RacPriv1FX}arpa";
        allow-update { none; };
};
EOF

3、配置正向解析 lucifer.com.zone 文件

DNSNAME=lucifer.com
DNSIP=10.211.55.200
cat <<EOF >/var/named/"${DNSNAME}".zone
\$TTL 1D
@    IN SOA   ${DNSNAME}. root.${DNSNAME}. (
                    0    ; serial
                    1D    ; refresh
                    1H    ; retry
                    1W    ; expire
                    3H )    ; minimum
@   IN  NS  ns.${DNSNAME}.
ns  IN  A   ${DNSIP}
EOF

4、配置反向解析 55.211.10.arpa 文件

RacPublicIPFX=55.211.10.
DNSNAME=lucifer.com
DNSIP=10.211.55.200
cat <<EOF >/var/named/"${RacPublicIPFX}"arpa
\$TTL 1D
@ IN SOA ${DNSNAME}. root.${DNSNAME}. (
                    0	; serial
                    1D	; refresh
                    1H	; retry
                    1W	; expire
                    3H )	; minimum
    NS    ns.${DNSNAME}.
ns  A     ${DNSIP}
EOF

5、配置反向解析 1.10.10.arpa文件

RacPrivFX=1.10.10.
DNSNAME=lucifer.com
DNSIP=10.211.55.200
cat <<EOF >/var/named/"${RacPrivFX}"arpa
\$TTL 1D
@ IN SOA ${DNSNAME}. root.${DNSNAME}. (
                     0	; serial
                     1D	; refresh
                     1H	; retry
                     1W	; expire
                     3H )	; minimum
    NS    ns.${DNSNAME}.
ns    A    	${DNSIP}       
EOF

6、配置反向解析 1.1.1.arpa文件

RacPrivFX=1.1.1.
DNSNAME=lucifer.com
DNSIP=10.211.55.200
cat <<EOF >/var/named/"${RacPrivFX}"arpa
\$TTL 1D
@ IN SOA ${DNSNAME}. root.${DNSNAME}. (
                     0	; serial
                     1D	; refresh
                     1H	; retry
                     1W	; expire
                     3H )	; minimum
    NS    ns.${DNSNAME}.
ns    A    	${DNSIP}       
EOF

四、配置RAC IP

##/var/named/lucifer.com.zone
cat <<EOF>>/var/named/lucifer.com.zone
CANLON           IN     A     10.211.55.18
rac11g01         IN     A     10.211.55.100
rac11g02         IN     A     10.211.55.101
rac11g01-priv    IN     A     10.10.1.1
rac11g02-priv    IN     A     10.10.1.2
rac11g01-priv1   IN     A     1.1.1.1
rac11g02-priv1   IN     A     1.1.1.2
rac11g01-vip     IN     A     10.211.55.102
rac11g02-vip     IN     A     10.211.55.103
rac11g-scan      IN     A     10.211.55.104
rac11g-scan      IN     A     10.211.55.105
rac11g-scan      IN     A     10.211.55.106
EOF

##/var/named/55.211.10.arpa
cat <<EOF>>/var/named/55.211.10.arpa
18      PTR     CANLON.lucifer.com.
100     PTR     rac11g01.lucifer.com.	
101     PTR     rac11g02.lucifer.com.			
102     PTR     rac11g01-vip.lucifer.com. 	
103     PTR     rac11g02-vip.lucifer.com.
104     PTR     rac11g-scan.lucifer.com.
105     PTR     rac11g-scan.lucifer.com.
106     PTR     rac11g-scan.lucifer.com.
EOF

##/var/named/1.10.10.arpa
cat <<EOF>>/var/named/1.10.10.arpa
1     PTR     rac11g01-priv.lucifer.com.	
2     PTR     rac11g02-priv.lucifer.com.
EOF

##/var/named/1.1.1.arpa
cat <<EOF>>/var/named/1.1.1.arpa
1     PTR     rac11g01-priv1.lucifer.com.	
2     PTR     rac11g02-priv1.lucifer.com.
EOF

五、启动DNS服务

##Linux6
service named start

##Linux7
systemctl start named

六、配置RAC节点DNS

cat <<EOF>>/etc/hosts
##Public IP
10.211.55.100     rac11g01.lucifer.com     rac11g01
10.211.55.101     rac11g02.lucifer.com     rac11g02

##Private IP
10.10.1.1     rac11g01-priv.lucifer.com     rac11g01-priv
10.10.1.2     rac11g02-priv.lucifer.com     rac11g02-priv

##Virtual IP
10.211.55.102     rac11g01-vip.lucifer.com     rac11g01-vip
10.211.55.103     rac11g02-vip.lucifer.com     rac11g02-vip

##SCAN IP
##10.211.55.104     rac11g-scan.lucifer.com     rac11g-scan
##10.211.55.105     rac11g-scan.lucifer.com     rac11g-scan
##10.211.55.106     rac11g-scan.lucifer.com     rac11g-scan
EOF

cat <<EOF>>/etc/resolv.conf
nameserver 10.211.55.200
EOF

测试:

标签:named,RAC,##,lucifer,DNSNAME,DNS,服务器,10.211,com
来源: https://blog.csdn.net/m0_50546016/article/details/116742628