博客第14周
作者:互联网
1、配置 bind 服务,实现 www.magedu.org 域名解析
yum -y install bind bind-utils
vi /etc/named.conf
// listen-on port 53 {127.0.0.1;};
// allow-query {localhost;};
vim /etc/named.rfc1912.zones
zone "magedu.org" IN {
type master;
file "magedu.org.zone";
};
cp -p /var/named/named.localhost /var/named/magedu.org.zone
vim /var/named/magedu.org.zone
$TTL 1D
$ORIGIN www.magedu.org.
@ IN SOA master admin.magedu.org. (
20200726
1D
1H
1w
3H )
NS master
master A 10.0.0.8
www A 10.0.0.8
* A 10.0.0.8
@ A 10.0.0.8
named-checkconf #检查配置文件
named-checkzone magedu.org /var/named/magedu.org.zone #检查区域数据配置
systemctl start named #启动dns 服务
rndc reload
2、配置 bind 服务,实现域名反向解析
vi /etc/named.conf
// listen-on port 53 {127.0.0.1;};
// allow-query {localhost;};
vim /etc/named.rfc1912.zones
zone "0.0.10.in-addr.arpa" IN {
type master;
file "10.0.0.zone";
};
cp -p /var/named/named.loopback /var/named/10.0.0.zone
vim /var/named/10.0.0.zone
$TTL 1D
$ORIGIN 0.0.10.in-addr.arpa.
@ IN SOA ns1.magedu.org. admin.magedu.org. (
20200726
1D
1H
1w
3H )
NS ns1.magedu.org.
100 PTR www.magedu.org.
100 PTR ns1.magedu.org.
111 PTR nx1.magedu.org.
named-checkconf #检查配置文件
named-checkzone 0.0.10.in-addr.arpa /var/named/10.0.0.zone #检查区域数据配置
rndc reload
dig -x 10.0.0.100 @10.0.0.8
3、配置 bind 服务,实现主从 DNS 服务配置:
主 10.0.0.8;从10.0.0.18;
主配置文件配置:
yum -y install bind bind-utils
vi /etc/named.conf
// listen-on port 53 {127.0.0.1;};
// allow-query {localhost;};
allow-transfer {10.0.0.18;};
vim /etc/named.rfc1912.zones
zone "magedu.org" IN {
type master;
file "magedu.org.zone";
};
主区域数据配置:
cp -p /var/named/named.localhost /var/named/magedu.org.zone
vim /var/named/magedu.org.zone
$TTL 1D
@ IN SOA master admin.magedu.org. (
20200726
1D
1H
1w
3H )
NS master
NS slave
master A 10.0.0.8
slave A 10.0.0.18
www A 10.0.0.8
* A 10.0.0.8
@ A 10.0.0.8
named-checkconf #检查配置文件
named-checkzone magedu.org /var/named/magedu.org.zone #检查区域数据配置
rndc reload
从机器dns 配置:
yum -y install bind bind-utils
vi /etc/named.conf
// listen-on port 53 {127.0.0.1;};
// allow-query {localhost;};
allow-transfer { none; };
从区域数据配置:
vim /etc/named.rfc1912.zones
zone "magedu.org" IN {
type slave;
master {10.0.0.8;};
file "slaves/magedu.org.slave";
};
ls /var/named/slaves/magedu.org.slave # 查看从区域数据配置文件
systemctl start named
named-checkconf
named-checkzone magedu.org /var/named/slaves/magedu.org.slave #检查区域数据配置
rndc reload
测试
修改/etc/sysconfig/network-script/ifcfg-eth0
DNS1=10.0.0.8
DNS2=10.0.0.18
#验证DNS服务器是否可以查询
dig www.megedu.org
#停掉主dns10.0.0.8服务
systemctl stop named
#验证DNS服务器是否可以查询
dig www.magedu.org
4、 配置 bind 服务,实现子域服务器:
父域配置
vim /etc/named.conf
// listen-on port 53 {127.0.0.1;};
// allow-query {localhost;};
allow-transfer { 10.0.0.7; };
dnssec-enable no;
dnssec-validation no;
vim /etc/named.rfc1912.zones
zone "magedu.org" IN {
type master;
file "magedu.org.zone";
};
cp -p /var/named/named.loopback /var/named/magedu.org.zone
vim /var/named/magedu.org.zone
$TTL 1D
$ORIGIN 0.0.10.in-addr.arpa.
@ IN SOA master admin.magedu.org. (
20200726
1D
1H
1w
3H )
NS master
shanghai NS shanghains
master A 10.0.0.8
shanghains A 10.0.0.18
websrv A 10.0.0.7
www CAME websrv
named-checkconf #检查配置文件
rndc reload
子域配置
vim /etc/named.conf
// listen-on port 53 {127.0.0.1;};
// allow-query {localhost;};
allow-transfer { none; };
vim /etc/named.rfc1912.zones
zone "shanghai.magedu.org" IN {
type master;
master {10.0.0.8;};
file "shanghai.magedu.org.zone";
};
cp -p /var/named/named.localhost /var/named/shanghai.magedu.org.zone
vim /var/named/shanghai.magedu.org.zone
$TTL 1D
$ORIGIN shanghai.magedu.org.
@ IN SOA master admin.magedu.org. (
20200726
1D
1H
1w
3H )
NS master
master A 10.0.0.8
websrv A 10.0.0.7
www CAME websrv
named-checkconfig
rndc reload
标签:10.0,named,14,zone,magedu,博客,var,org 来源: https://www.cnblogs.com/yazhan/p/13381042.html