k8s集群部署之bind安装
k8s集群部署之bind安装前提准备5台虚拟机 ip 分别为10.4.7.11, 10.4.7.12, 10.4.7.21, 10.4.7.22, 10.4.7.20010.4.7.111.安装bind9yum install -y bindvim /etc/named.conflisten-on port 53 { 10.4.7.11; };# 监听本机IPlisten-on-v6 por...
前提准备5台虚拟机 ip 分别为10.4.7.11, 10.4.7.12, 10.4.7.21, 10.4.7.22, 10.4.7.200
更改主机名 以10.4.7.11为例 hostnamectl set-hostname hdss7-11.host.com 其余4台以此类推
10.4.7.11
1.安装bind9
yum install -y bind
vim /etc/named.conf
listen-on port 53 { 10.4.7.11; }; # 监听本机IP
listen-on-v6 port 53 { ::1; }; # 删除,不监听IPV6
allow-query { any; }; # 允许所有主机查看
forwarders { 10.4.7.254; }; # 办公网上一级的DNS,(生产写运营商dns)
recursion yes; # dns采用递归的查询
dnssec-enable no; # 关闭,节省资源(生产可能不需要关闭)
dnssec-validation no; # 关闭,节省资源,不做互联网认证
检查配置
named-checkconf
echo $?
配置区域配置文件在文件末尾添加
vim /etc/named.rfc1912.zones
zone "host.com" IN {
type master;
file "host.com.zone";
allow-update { 10.4.7.11; };
};
zone "od.com" IN {
type master;
file "od.com.zone";
allow-update { 10.4.7.11; };
};
vim /var/named/host.com.zone
$ORIGIN host.com.
$TTL 600 ; 10 minutes
@ IN SOA dns.host.com. dnsadmin.host.com. (
2020083101 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS dns.host.com.
$TTL 60 ; 1 minute
dns A 10.4.7.11
HDSS7-11 A 10.4.7.11
HDSS7-12 A 10.4.7.12
HDSS7-21 A 10.4.7.21
HDSS7-22 A 10.4.7.22
HDSS7-200 A 10.4.7.200
vim /var/named/od.com.zone
$ORIGIN od.com.
$TTL 600 ; 10 minutes
@ IN SOA dns.od.com. dnsadmin.od.com. (
2020083101 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS dns.od.com.
$TTL 60 ; 1 minute
dns A 10.4.7.11
检测区域数据文件
named-checkconf
named-checkzone "host.com" /var/named/host.com.zone
named-checkzone "od.com" /var/named/od.com.zone
更改文件的属组权限
chown root:named /var/named/host.com.zone
chown root:named /var/named/od.com.zone
chmod 640 /var/named/host.com.zone
chmod 640 /var/named/od.com.zone
systemctl start named
systemctl enable named
验证解析
dig -t A hdss7-21.host.com @10.4.7.11 +short
dig -t A hdss7-200.host.com @10.4.7.11 +short
更改dns (5台)都执行
sed 's#DNS1="10.4.7.254"#DNS1="10.4.7.11"#g' /etc/sysconfig/network-scripts/ifcfg-eth0 -i
cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep DNS1
systemctl restart network
curl -I www.baidu.com
Windows主机 VMware Network Adapter VMnet8网卡dns配置为10.4.7.11
测试连通性
更多推荐
所有评论(0)