Setting up DNS separate parsing can provide different domain name parsing records for different clients. When a client from different addresses requests the same domain name, it provides different parsing results.
Install the bind package
[root@localhost ~]# yum install bind bind-utils -y
Dual Network Card Configuration
Both network cards are switched to host-only mode.
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
- Configuring IP Address of Intranet Gateway
[root@localhost network-scripts]# vim ifcfg-ens33 TYPE=Ethernet BOOTPROTO=static DEVICE=ens33 ONBOOT=yes IPADDR=192.168.100.1 NETMASK=255.255.255.0
- Configuring IP Address of Outer Network Gateway
[root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens37 [root@localhost network-scripts]# vim ifcfg-ens37 TYPE=Ethernet BOOTPROTO=static DEVICE=ens37 ONBOOT=yes IPADDR=12.0.0.1 NETMASK=255.255.255.0
- service network restart
[root@localhost ~]# service network restart Restarting network (via systemctl): [ OK ] [root@localhost ~]# ifconfig ens33 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.1 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::20c:29ff:febc:ab96 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:bc:ab:96 txqueuelen 1000 (Ethernet) RX packets 1056 bytes 299717 (292.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 180 bytes 22441 (21.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost ~]# ifconfig ens37 ens37: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 12.0.0.1 netmask 255.255.255.0 broadcast 12.0.0.255 inet6 fe80::20c:29ff:febc:aba0 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:bc:ab:a0 txqueuelen 1000 (Ethernet) RX packets 1010 bytes 301554 (294.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 106 bytes 16880 (16.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Edit master configuration file
[root@localhost ~]# vim /etc/named.conf
- Configuration of sniffing and querying segments
listen-on port 53 { any; }; allow-query { any; };
- Delete the configuration part of the root and place it in the regional configuration file.
zone "." IN { type hint; file "named.ca"; };
Editing Area Profile
[root@localhost ~]# vim /etc/named.rfc1912.zones
Delete all existing configurations and add the following
view "lan" { match-clients { 192.168.100.0/24; }; zone "yun.com" IN { type master; file "yun.com.lan"; }; zone "." IN { type hint; file "named.ca"; }; }; view "wan" { match-clients { 12.0.0.0/24; }; zone "yun.com" IN { type master; file "yun.com.wan"; }; };
Editing Area Data Profile
[root@localhost ~]# cd /var/named/
- Editing lan area data file
[root@localhost named]# cp -p named.localhost yun.com.lan [root@localhost named]# vim yun.com.lan $TTL 1D @ IN SOA yun.com. admin.yun.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS yun.com. IN A 192.168.100.1 www IN A 192.168.100.10 ftp IN A 192.168.100.20
- Edit wan area data file
[root@localhost named]# cp -p yun.com.lan yun.com.wan [root@localhost named]# vim yun.com.wan $TTL 1D @ IN SOA yun.com. admin.yun.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS yun.com. IN A 12.0.0.1 www IN A 12.0.0.1 ftp IN A 12.0.0.1
Start up service
[root@localhost ~]# systemctl start named [root@localhost ~]# systemctl enable named Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.
Result testing
The network of two clients is in host-only mode.
Intranet win10 Test
Microsoft Windows [Version 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\ll>nslookup www.yun.com //Server: UnKnown Address: 192.168.100.1 //Name: www.yun.com Address: 192.168.100.10 C:\Users\ll>nslookup ftp.yun.com //Server: UnKnown Address: 192.168.100.1 //Name: ftp.yun.com Address: 192.168.100.20
win7 Test of External Network
Microsoft Windows [Version 6.1.7601] Copyright (c) Microsoft Corporation, 2009. All rights reserved. C:\Users\ll>nslookup www.yun.com Server: UnKnown Address: 12.0.0.1 Name: www.yun.com Address: 12.0.0.1 C:\Users\ll>nslookup ftp.yun.com Server: UnKnown Address: 12.0.0.1 Name: ftp.yun.com Address: 12.0.0.1