DNS Separation Resolution Service in Linux (True in Practice)

Keywords: Linux network vim DNS

Overview of Separation Resolution:

Separate Resolution Domain Name Server is actually the primary domain name server. Separate Resolution mainly refers to providing different domain name resolution records according to different clients.When clients from different addresses request to resolve the same domain name, they are provided with different results.

Experimental Topology and Environment:

Environment: A Linux as gateway service

win7 Client in a WAN (

win10 Client in a LAN (

(1) Linux as a gateway service requires two network cards, so we need to add one extra network card

1, Install dns server on Linux first in NAT mode

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

2. Add a new network card to Linux and set both network cards to host-only mode, while setting win7 and win10 clients to host-only mode.

(2) Set up the network card as a gateway

1, Set up network card ens33 as gateway to LAN

[root@localhost ~]#vim/etc/sysconfig/network-scripts/ifcfg-ens33 Edit network card configuration

2. Copy a configuration file for ens33 network card as ens36 to configure gateway information for WAN

[root@localhost ~]#Switch cd/etc/sysconfig/network-scripts/ to network card profile directory
[root@localhost network-scripts]#cp-p ifcfg-ens33 ifcfg-ens36 Copy a configuration file as the configuration file for ens36
[root@localhost network-scripts]#vim ifcfg-ens36 Edit configuration file
[root@localhost network-scripts]#systemctl restart network

(3) Set up ip addresses for win7 and win10 and test if they can connect with the gateway

1, configure the IP address and gateway and parse address for win7, and test if you can connect to a Linux gateway

2, Configure the IP address and gateway and parse address for win10, and test if you can connect to a Linux gateway

(4) Setting DNS Resolution Service Profile

1, go to Global Profile Settings/etc/named.conf

[root@localhost ~]# vim /etc/named.conf

2, enter Regional Profile Settings/etc/named.rfc.zones

[root@localhost ~]# vim /etc/named.rfc1912.zones
view "lan" {
        match-clients {; };        LAN Resolution

        zone "kgc.com" IN {
          type master;
          file "kgc.com.lan";

        zone "." IN {       take/etc/named.conf Delete root configuration under global profile, copy and paste into local configuration
          type hint;
          file "named.ca";

view "van" {                               WAN Resolution
        match-clients {; };

        zone "kgc.com" IN {
          type master;
          file "kgc.com.van";

3, enter the data profile for domain name resolution configuration

[root@localhost ~]#cd/var/named Switch to the name directory under VaR
[root@localhost named]#cp-p named.localhost kgc.com.lan Copy a template as a data profile for kgc.com.lan
[root@localhost named]#vim kgc.com.lan Configuration Data Profile

[root@localhost named]#cp-p kgc.com.lan kgc.com.van) Copy a data profile of LAN as van's
[root@localhost named]#Configure vim kgc.com.van

4. Close the firewall and turn on the dns Service

[root@localhost named]#systemctl stop firewalld.service Close firewall
[root@localhost named]# setenforce 0
[root@localhost named]#systemctl start named Open dns Service
[root@localhost named]#systemctl status named View dns service status

(5) Use win7 and win10 machines to resolve the same domain name

1, win7 opens cmd to use nslookup to resolve domain name

2, win10 opens cmd to use nslookup to resolve domain name

Resolve different IP addresses based on the same domain name

The experiment was successful

Thanks for reading!!!

Posted by zeezack on Sun, 08 Sep 2019 09:16:59 -0700