Set up dns server-domain name resolution

Posted by mizz key_me on Sat, 11 Jul 2020 18:03:08 +0200

1. Background Description

Deployed services require domain name access. Configuration in the host file is OK, but if more than one computer accesses, you need to modify all the host files manually. If you add a domain name one day, you need to modify all the host files manually.

2. Set up dns services

The best way to solve the above problem is to set up a dns server for domain name resolution. The advantage of this is that even if you modify the domain name, you don't have to modify the host file, not to mention each one.

3. Steps

  • yum installation
yum install bind bind-utils
  • Restart after installation
service named start

  • Modify Profile-named.conf
    Restart is OK, installation is OK, here are the things to modify the configuration file.
[root@kafzook6 named]# cat /etc/named.conf 

options {
    #any
    listen-on port 53 { any; };
    listen-on-v6 port 53 { ::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";
    #any
    allow-query     { any; };
    recursion yes;
        forwarders {
                10.10.60.253;
                8.8.4.4;
        };

    dnssec-enable yes;
    dnssec-validation yes;

    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";

    managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
    type hint;
    file "named.ca";
};

zone "udp.dctsi.mil" IN {
type master;
#This file we need to configure
file "udp.dctsi.mil.db";
allow-update { none; };
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
  • To configureUdp.dctsi.mil.db file
[root@kafzook6 named]# cat udp.dctsi.mil.db

$TTL 86400
@ IN SOA primary.udp.dctsi.mil. root.udp.dctsi.mil. (
2016042112 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
43200 ;Minimum TTL
)
;Name Server Information
@ IN NS primary.udp.dctsi.mil.
;IP address of Name Server
primary IN A 192.168.14.148
;A - Record HostName To Ip Address
@ IN A 192.168.14.148
~                           

4. Verify that the configuration was successful

[root@kafzook6 named]# dig udp.dctsi.mil

Successful configuration is indicated by the following

5. Restart Services

[root@kafzook6 named]# service named restart

Finally, configure the ipv4 address on your own computer as shown in the following figure:

Topics: DNS yum