DNS isolated resolve combat (with full may do)

To achieve the purpose of the experiment: get a different address different areas of the visitors, according to the same domain name resolved

VMware test environment in preparation:

1、Linux做网关为前提(需要一台CentOS)
2、内部局域网域名解析主机为:WIN 7-1
3、外部广域网域名解析主机为:WIN 7-2

At this point CentOS 7 as a gateway requires two NICs (one internal and one outside)

步骤如下:
VMware中打开CentOS 7,先在主界面中右键点击选择打开终端
输入:yum install bind -y(此处需要在联网状态下先安装此服务)
再右键点击右下角网络适配器,选择设置,点击添加网络适配器,此时两块网卡全部选择仅主机模式,回到终端界面
输入:init6(重启识别两张网卡,以防后面服务启动出现问题)
再次开机后,进入终端界面,输入:ifconfig(此时可以看到两块网卡ens33和ens36)

We ens33 experiment as internal network card, ens36 as the external network adapter

首先配置网卡ens33
输入:cd /etc/sysconfig/network-scripts
输入:ls(看到ens33网卡的配置文件)
输入:vim ifcfg-ens33(对该网卡进行配置)
具体修改项如下图:

DNS isolated resolve combat (with full may do)

修改结束后,按Esc退出插入模式
输入:wq(保存退出)

Because the newly added ens36 card no configuration file, so we need to copy ens33 network card configuration files in this directory and name ens36, and then configure modifications

输入:cp -p ifcfg-ens33 ifcfg-ens36(复制ens33配置文件并起名ens36)
输入:vim ifcfg-ens36(修改ens36网卡配置文件)
具体修改项如下图所示:

DNS isolated resolve combat (with full may do)

修改结束后,按Esc退出插入模式
输入:wq(保存退出)
输入:service network restart(重启网络服务)
输入:ifconfig(查看网卡,此时两块网卡IP都已配置成功)

DNS isolated resolve combat (with full may do)

Enter the network center in WIN 7-1, change the network adapter settings IPv4:

IP地址:192.168.100.100
子网掩码:255.255.255.0
默认网关:192.168.100.1
DNS解析地址:192.168.100.1
点击确定退出之后,此时会自动跳出连接提示,说明配置成功

DNS isolated resolve combat (with full may do)
DNS isolated resolve combat (with full may do)

Enter the network center in WIN 7-2, change the network adapter settings IPv4:

IP地址:12.0.0.12
子网掩码:255.0.0.0
默认网关:12.0.0.1
DNS解析地址:12.0.0.1
点击确定退出之后,此时会自动跳出连接提示,说明配置成功

DNS isolated resolve combat (with full may do)
DNS isolated resolve combat (with full may do)

在WIN 7-1中输入:ping 12.0.0.1,是可以直接ping通的
在WIN 7-2中输入:ping 192.168.100.1,也是可以直接ping通的

DNS isolated resolve combat (with full may do)
DNS isolated resolve combat (with full may do)
At this time, holding both sides can ping


Back 7 CentOS:

输入:vim /etc/named.conf(修改主配置文件)
监听所有地址,listen-on port 53后面大括号内改为any
监听所有网卡,allow-query后面大括号内改为any
输入:wq(保存退出)

DNS isolated resolve combat (with full may do)
In this later configuration file following the beginning of the root domain server "zone" need to use
which contains a "named.ca" profile data area

输入:cd /var/named/(进入此目录)
输入:ls(查看详细内容)
输入:vim /etc/named.rfc1912.zones(修改区域配置文件)
写入内容如下图:

DNS isolated resolve combat (with full may do)

输入:wq(保存退出)
其中包含:
1、匹配网段主机进行通信
2、区域数据配置文件指明解析
3、根解析

输入:cp -p named.localhost kgc.com.lan
输入:vim kgc.com.lan
输入:wq(保存退出)
修改内容如下图:

DNS isolated resolve combat (with full may do)


输入:cp -p kgc.com.lan kgc.com.wan 
输入:vim kgc.com.wan
输入:wq(保存退出)
修改内容如下图:

DNS isolated resolve combat (with full may do)


输入:systemctl start named(启动服务)
输入:systemctl status named(查看服务,状态为active为正常)

DNS isolated resolve combat (with full may do)

输入:systemctl stop firewalld.service(关闭防火墙)
输入:setenforce 0(关闭安全功能)

WIN7-1 LAN host name resolution steps are as follows:

输入:nslookup www.kgc.com
得到:192.168.100.88
输入:nslookup smtp.kgc.com
得到:192.168.100.99

DNS isolated resolve combat (with full may do)


WAN WIN7-2 host name resolution steps are as follows:

输入:nslookup www.kgc.com
得到:12.0.0.1
输入:nslookup smtp.kgc.com
得到:12.0.0.1

DNS isolated resolve combat (with full may do)

to sum up:

1, the final results of the experiment is this: for the same domain name parsing different IP, this is the separation resolved

2, the host is not known WAN private network addresses on the LAN, but the LAN to a private network address can be seen directly.

Guess you like

Origin blog.51cto.com/14464303/2436626