实现Internet的DNS服务架构
一.准备
1.安装最小化系统并进行必要配置
-
安装最小系统
-
配置网络
-
1.修改centos7,8网卡名为传统网卡名
sed -i.org '/GRUB_CMDLINE_LINUX/s@"$@ net.ifnames=0 "@' /etc/default/grub
grub2-mkconfig -o /etc/grub2.cfg
reboot
-
2.配置静态网址
vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 NAME=eth0 BOOTPROTO=static HWADDR= IPADDR=192.168.131. NETMASK=255.255.255.0 GATEWAY=192.168.131.2
-
3.
reboot
-
-
安装必要软件
- 挂载光盘
mount /dev/sr0 /mnt cat > /etc/yum.repo.d/base <<eof [base] name=base baseurl=file:///mnt/ gpgcheck=0 enabled=1
- 安装相关软件
yum install httpd|bind vim
2.关闭防火墙
- CentOS6
chkconfig iptables off
service stop iptables
- CentOS7|8
systemctl disable firewalld
systemctl stop firewalld
3.关闭SElinux
- CentOS6|7|8
sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config &> /dev/null
4.时间同步
CentOS6作为客户端
- 确认ntpd服务状态和配置文件
rpm -ql ntp
chkconfig ntpd on
service start ntpd
ss -unlp
- 编辑/etc/ntpd.conf,注释原来的国外的ntp服务器添加:
server ntp.aliyun.com iburst
server ntp1-7.aliyun.com iburst
CentOS6作为时间同步服务器
- 编辑修改/etc/ntpd.conf
添加:
server 172.20.3.82 iburst
更改:
restrict default nomodify notrap nopeer noquery --> restrict default nomodify
service ntpd start 启动服务
chkconfig ntpd on 开机启动
ss -unl 确认监听udp/123
CentOS7|8作为客户端
- 确认chronyd服务的状态
rpm -ql chrony
yum install chrony
systemctl status chronyd.seervice
systemctl start chronyd.seervice
- 编辑/etc/chrony.conf,注释原来的国外的ntp服务器,并添加阿里的公共ntp服务器
添加:
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
server ntp4.aliyun.com iburst
server ntp5.aliyun.com iburst
server ntp6.aliyun.com iburst
server ntp7.aliyun.com iburst
CentOS7|8作为服务器
- 编辑修改/etc/chronyd.conf
注释server开头的行
添加阿里的公共ntp服务器域名
ntp.aliyun.com iburst
添加本地可连接本机同步的主机
allow 192.168.0.0/16
即使本机时间未和阿里的ntp服务器时间同步,也向本地的其它主机提供时间同步服务
local stratum 10
- 此处实验可以使用某台主机同步互联网的时间,其他主机同步该主机时间
5.主机需求及解析区域分配
主机 | 地址 |
---|---|
DNS客户端 | 192.168.131.6/24 |
本地DNS服务器(cache DNS) | 192.168.131.8/24 |
转发目标DNS服务器 | 192.168.131.18/24 |
根DNS服务器 | 192.168.131.28/24 |
cn域DNS服务器 | 192.168.131.38/24 |
suosuoli.cn域主DNS服务器 | 192.168.131.48/24 |
suosuoli.cn域从DNS服务器 | 192.168.131.58/24 |
www.suosuoli.cn的WEB服务器 | 192.168.131.68/24 |
二.实现
1.实现思路
- 由于该实验涉及到多台DNS服务器的配置,不可随意配置,需要以方便测试和排错为原则来
进行部署实现;此次部署实验大致顺序如下:
1.配置客户端地址并将其DNS服务器指向本地DNS服务器(192.168.131.8)
2.接着配置WEB服务器,并保证客户端可以访问WEB服务器
3.接下来配置suosuoli.cn域的主DNS服务器,并保证客服端通过指定该主服务器能够顺利解析
suosuoli.cn(192.168.131.6:$dig www.suosuoli.cn @192.168.131.48 )
4.接