服务器端:
前期工作:
切换到NAT模式
(1)关闭防火墙以及SeLinux.
防火墙相关设置:
systemctl stop firewalld //临时关闭防火墙
systemctl disable firewalld //禁止开机启动防火墙
selinux相关设置:
SeLinux配置文件,/etc/selinux/config
设置 SELINUX=disabled
(2)安装相应的软件包
yum -y install bind
yum -y install bind-utils //bind-utils提供DNS查询工具,如dig、host、nslookup
安装完后,检测有没有安装
[root@localhost ~]# rpm -qa | grep bind
rpcbind-0.2.0-42.el7.x86_64
bind-libs-9.9.4-61.el7.x86_64
bind-libs-lite-9.9.4-61.el7.x86_64
bind-license-9.9.4-61.el7.noarch
bind-9.9.4-61.el7.x86_64
bind-utils-9.9.4-61.el7.x86_64
切换到OnlyHost模式
(3)修改配置文件
配置文件路径: /etc/named.conf
示例配置文件:
See /usr/share/doc/bind*/sample/ for example named configuration files.
拷贝示例配置文件到tmp文件夹下
cp /usr/share/doc/bind-9.9.4/sample/etc/named.conf /tmp
(4)重启服务
systemctl restart named
systemctl enable named //开机启动DNS服务
客户端:
切换到NAT模式下:
yum -y install bind-utils
切换到OnlyHost模式下:
配置文件 :/etc/resolv.conf
添加如下:
nameserver 192.168.59.128(DNS IP地址)
注意问题:
(1)格式问题 (紧靠左边,'.')
(2)权限问题(