BIND DNS配置!

折月煮酒 提交于 2019-11-27 15:30:02

linux虚拟机终端步骤:

[root@localhost ~]# vi /etc/sysconfig/netowrk-script/ifcfg-ens33         //配置网卡信息

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"                                                 //static是默认
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="eaef65c8-20e6-4f72-84d3-670483d76f01"
DEVICE="ens33"
ONBOOT="yes"

IPADDR=192.168.200.111                      //配置IP
NETMASK=255.255.255.0                     //配置子网掩码
DNS1=202.106.0.20                              //配置DNS
GATEWAY=192.168.200.1                    //配置网关


[root@localhost ~]# systemctl restart network                  //重启网卡

 

======================================================

windows虚拟机IP配置

==========================================================

XShell中linux虚拟机步骤:

[root@localhost etc]# rpm -q bind

[root@localhost etc]# yum -y install bind

[root@localhost ~]# mount /dev/sr0 /media/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# ls /media/
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[root@localhost ~]# cd /etc/yum.r*
[root@localhost yum.repos.d]# mkdir a/
[root@localhost yum.repos.d]# mv C* a/
[root@localhost yum.repos.d]# vi ./local.repo                   //建立yum仓库

[moter]
name=moter
baseurl=file:///media
enabled=1
gpgcheck=0

[root@localhost yum.repos.d]# yum -y clean all               //清除yum仓库缓存
已加载插件:fastestmirror, langpacks
正在清理软件源: moter
Other repos take up 469 M of disk space (use --verbose for details)
[root@localhost yum.repos.d]# yum makecache            //重建yum缓存
正在安装 : 32:bind-9.9.4-72.el7.x86_64 1/1
验证中 : 32:bind-9.9.4-72.el7.x86_64 1/1

已安装:
bind.x86_64 32:9.9.4-72.el7
完毕!
[root@localhost yum.repos.d]# cd /etc/                         //进入/etc
[root@localhost etc]# vim named.conf                          //配置named.conf文件

options {
listen-on port 53 { 192.168.200.111; };                       //指定访问IP地址
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { 192.168.200.0/24; };                              //指定网关
recursion yes;

};

zone "." IN {
type hint;
file "named.ca";
};

[root@localhost etc]# systemctl restart named           //重启named服务
[root@localhost etc]# systemctl stop firewalld           //关闭防火墙

[root@localhost etc]#iptables -F                               
[root@localhost etc]# setenforce 0                           //关闭selinux安全机制

[root@localhost etc]# ping www.baidu.com
64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=2 ttl=128 time=33.9 ms
64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=3 ttl=128 time=36.9 ms
64 bytes from 182.61.200.6 (182.61.200.6): icmp_seq=4 ttl=128 time=36.8 ms

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!