Linux服务器配置RAC DNS服务器

举报
Lucifer三思而后行 发表于 2021/10/28 11:08:14 2021/10/28
【摘要】 一、安装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....

一、安装Linux服务器

主机版本 主机名 主机内存 主机磁盘空间 主机网卡 DNS主机IP DNS服务名
redhat 7.9 DNSSERVER 1G 50G eth0 10.211.55.200 lucifer.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

测试:

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。