1、配置 bind 服务,实现 www.magedu.org 域名解析
yum -y install bind bind-utils
systemctl enable --now named
vim /etc/named.conf
注释下面两行
// listen-on port 53 { localhost; };
// allow-query { localhost; };
vim /etc/named.rfc1912.zones
添加如下内容
zone "ceshi.org" IN {
type master;
file "ceshi.org.zone";
};
vi /var/named/ceshi.org.zone
$TTL 1D @ IN SOA master admin.ceshi. ( 3 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS master NS slave master A 10.0.0.8 slave A 10.0.0.28 A 127.0.0.1 AAAA ::1
named-checkconf
named-checkzone ceshi.org /var/named/ceshi.org.zone
systemctl restart named
rndc reload
2、配置 bind 服务,实现域名反向解析
vim /etc/named.conf
修改以下内容
listen-on port 53 { localhost; };
allow-query { any; };
vim /etc/named.rfc1912.zones
zone "0.0.10.in-arpa" {
type master;
file "10.0.0.zone";
}
vim /var/named/10.0.0.zone
$TTL 1D @ IN SOA ns1 admin.yindesheng.org. ( 1 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS ns1.yindesheng.org. 100 PTR www.yindesheng.org. 200 PTR app.wangge.org.
测试
dig -x 10.0.0.100 @10.0.0.8
3、配置 bind 服务,实现主从 DNS 服务配置:
主服务器配置:
yum -y install bind bind-utils
systemctl enable --now named
vim /etc/named.conf
注释下面两行
// listen-on port 53 { localhost; };
// allow-query { localhost; };
vim /etc/named.rfc1912.zones
添加如下内容
zone "ceshi.org" IN {
type master;
file "ceshi.org.zone";
};
vi /var/named/ceshi.org.zone
$TTL 1D @ IN SOA master admin.ceshi. ( 3 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS master NS slave master A 10.0.0.8 slave A 10.0.0.28 A 127.0.0.1 AAAA ::1
systemctl restart named
rndc reload
从服务器配置:
yum -y install bind bind-utils
systemctl enable --now named
vim /etc/named.conf
注释下面两行
// listen-on port 53 { localhost; };
// allow-query { localhost; };
vim /etc/named.rfc1912.zones
添加如下内容
zone "ceshi.org" IN {
type slave;
masters {10.0.0.8;};
file "slave/sceshi.org.slave";
};
systemctl restart named
rndc reload
ls /var/named/slaves/ceshi.org.slave #查看区域数据库是否已生成
4、 配置 bind 服务,实现子域服务器:
主DNS服务器修改magedu.org.zone
vim /var/named/magedu.org.zone
内容如下:
$TTL 1D @ IN SOA master admin ( 1 1D 1H 3D 1H ) #序列由原来的0改为1 NS master NS slave k8s NS ns #增加k8s子域NS服务器 master A 10.0.1.8 slave A 10.0.1.12 ns A 10.0.1.13 #增加NS服务器A记录 www A 10.0.1.10 * A 10.0.1.10 @ A 10.0.1.10
DNS子域服务器bind安装及配置
yum -y install bind bind-utils
systemctl enable --now named
vim /etc/named.conf
修改以下内容
listen-on port 53 { localhost; };
allow-query { any; };
vim /var/named/k8s.magedu.org.zone
内容如下:
$TTL 1D @ IN SOA ns admin ( 0 1H 10M 1D 1H ) NS ns ns A 10.0.1.13 master A 10.0.1.15 node A 10.0.1.16 etcd A 10.0.1.17
vim /etc/named.rfc1912.zones
增加以下内容
zone "k8s.magedu.org" {
type master;
file "k8s.magedu.org.zone";
};
chown :named /var/named/k8s.magedu.org.zone
chmod 640 /var/named/k8s.magedu.org.zone
named-checkconf
named-checkzone k8s.magedu.org /var/named/k8s.magedu.org.zone
rndc reload
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
测试
dig master.k8s.magedu.org @10.0.1.13
dig node.k8s.magedu.org @10.0.1.10