Centos7 configure YUM to install the DNS Service
1. Configure the DNS address
vim
/etc/resolv
.conf
nameserver192.168.1.100
# Note: the address here is the address of your local DNS server.
2. Install dns
yum
install
bindbind-utils
3. Start the service
Start DNS Service: servicenamedstart
Restart the DNS service: systemctlrestartnamed. service
Set boot start: systemctl
enable
named
4. Edit the dns configuration file
vim
/etc/named
.conf
options{
listen-onport53{any;};
listen-on-v6port53{::1;};
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"
;
allow-query{any;};
recursion
yes
;
dnssec-
enable
yes
;
dnssec-validation
yes
;
bindkeys-
file
"/etc/named.iscdlv.key"
;
managed-keys-directory
"/var/named/dynamic"
;
pid-
file
"/run/named/named.pid"
;
session-keyfile
"/run/named/session.key"
;
};
logging{
channeldefault_debug{
file
"data/named.run"
;
severitydynamic;
};
};
zone
"."
IN{
type
hint;
file
"named.ca"
;
};
# Add a demo.com Domain Name
zone
"demo.com"
{
type
master;
file
"/var/named/demo.com"
;
};
# Add a demo1.com Domain Name
zone
"demo1.com"
{
type
master;
file
"/var/named/demo1.com"
;
};
#include"/etc/named.rfc1912.zones";
#include"/etc/named.root.key";
#zone"testdongy.com"{
#typemaster;
#file"/var/named/testdongy.com";
#};
# Copy the configuration above.
5. Configure DNS domain resolution files
vim
/var/named/demo1
.com
$TTL3H
@INSOA@demo1.com.(
0;serial
1D;refresh
1H;retry
1W;expire
3H);minimum
NS@
A127.0.0.1
AAAA::1
aINA192.168.2.171
bINA192.168.2.172
wwwINA192.168.2.171
devINA192.168.2.171
Restart the DNS server. The client only needs to specify the configured address for verification.
systemctlrestartnamed.service
6. below is my DNS configuration for win7 192.168.2.107
The specified DNS suffix for the connection:
Description: RealtekPCIeGBEFamilyController.
Physical address: B0-83-FE-83-A4-4B
DHCP enabled: No
IPv4 address: 192.168.2.102
IPv4 subnet mask: 255.255.255.0
IPv4 Default Gateway: 192.168.2.1
IPv4DNS server: 192.168.2.107, 223.5.5.5
IPv4WINS Server:
NetBIOSoverTcpip enabled: Yes
Connection-local IPv6 address: fe80: d25: 5b: dda3: f08d % 11
IPv6 Default Gateway:
IPv6DNS Server:
7. Start verification
The result is as follows.
Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>nslookupwww.demo1.com
Server: UnKnown
Address:192.168.2.107
Name: www.demo1.com
Address:192.168.2.171
C:\Users\Administrator>nslookupa.demo1.com
Server: UnKnown
Address:192.168.2.107
Name: a.demo1.com
Address:192.168.2.171
C:\Users\Administrator>nslookupb.demo1.com
Server: UnKnown
Address:192.168.2.107
Name: B .demo1.com
Address:192.168.2.172
Linux Server Verification
[root@bogon~]#nslookupa.demo.com
Server: 192.168.2.104
Address: 192.168.2.104#53
Name: a.demo.com
Address:192.168.2.171
[root@bogon~]#nslookupa.demo.com
Server: 192.168.2.104
Address: 192.168.2.104#53
Name: a.demo.com
Address:192.168.2.171