1. First you need two network cards
2. Modify the second card of the IP address configuration
Here we do the test with 172.16.1.1
# Into the configuration interface card
vim /etc/sysconfig/network-scripts/ifcfg-eno33554968
Modify entry:
BOOTPROTO="static"
IPADDR=172.16.1.1
NETMASK=255.255.255.0
3. set up DNS service
# Install the bind package
yum -y install bind
yum -y install bind
# Modify DNS address specified file
vim /etc/resolv.conf
nameserver 192.168.200.111
nameserver 192.168.200.112
nameserver 192.168.200.113
vim /etc/resolv.conf
nameserver 192.168.200.111
nameserver 192.168.200.112
nameserver 192.168.200.113
#修改hosts文件
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.crushlinux.com
192.168.200.112 ns2.crushlinux.com
192.168.200.113 www.crushlinux.com
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.crushlinux.com
192.168.200.112 ns2.crushlinux.com
192.168.200.113 www.crushlinux.com
# Modify the master configuration file (analytical separation)
Vim /etc/named.conf
Options {
Directory "/ var / the named";
};
Vim /etc/named.conf
Options {
Directory "/ var / the named";
};
view "LAN" {
match-clients { 192.168.200.0/24; };
zone "crushlinux.com" IN {
type master;
file "crushlinux.zheng.lan";
};
};
match-clients { 192.168.200.0/24; };
zone "crushlinux.com" IN {
type master;
file "crushlinux.zheng.lan";
};
};
view "WAN" {
match-clients { any; };
zone "crushlinux.com" IN {
type master;
file "crushlinux.zheng.wan";
};
};
match-clients { any; };
zone "crushlinux.com" IN {
type master;
file "crushlinux.zheng.wan";
};
};
# Revise forward resolution file
vim /var/named/crushlinux.zheng.lan
\ $ TTL 86400
@ the IN SOA crushlinux.com admin.crushlinux.com. (
123456
3H
15M
1W
1D
)
ns1.crushlinux.com the IN NS.
The IN NS ns2.crushlinux.com.
the IN www.crushlinux.com the NS.
the IN 10 mail.crushlinux.com the MX.
NSl the IN A 192.168.200.111
NS2 the IN A 192.168.200.112
WWW the IN A 192.168.200.113
FTP the IN A 192.168.200.114
mail IN A 192.168.200.115
vim /var/named/crushlinux.zheng.lan
\ $ TTL 86400
@ the IN SOA crushlinux.com admin.crushlinux.com. (
123456
3H
15M
1W
1D
)
ns1.crushlinux.com the IN NS.
The IN NS ns2.crushlinux.com.
the IN www.crushlinux.com the NS.
the IN 10 mail.crushlinux.com the MX.
NSl the IN A 192.168.200.111
NS2 the IN A 192.168.200.112
WWW the IN A 192.168.200.113
FTP the IN A 192.168.200.114
mail IN A 192.168.200.115
# Start Service
systemctl restart named
systemctl enable named
systemctl enable named
5. Add the group permission to parse the file
chgrp named crushlinux.zheng.wan
# Restart Service
systemctl restart named
6. Test using the test machine
Use two different network segments
NAT network segment
# Set the IP address and gateway
#Test Results
VM2 segments:
#Test Results