Get the App
SLTechnology News&Howtos  ›  Servers  › 

CentOS7.4 configure DNS server

Shulou Source: shulou.com Published: 2022-06-02 19:50:56 09月22日 Update

1. Install the bind package

Yum install-y bind*

two。 Path index of each profile

/ etc/named.conf # main configuration file / var/named/ # parsing database file directory / etc/named.rfc1912.zones # default parsing area file

3. Modification of the main configuration file

# the following changes are just the changes I made to vim / etc/named.conf options {# listen-on port 53 {127.0.0.1;}; comment out the line indicating that listening on port 53 is enabled on all interfaces IP # listen-on-v6 port 53 {:: 1;}; turn off the listening directory "/ var/named" of IPv6 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"; recursing-file "/ var/named/data/named.recursing"; secroots-file "/ var/named/data/named.secroots"; # allow-query {localhost;} DNS queries are allowed for all hosts. By default, local queries are only allowed for zone "example.com" IN {type master; file "example.com.zone". # if the absolute path is not added, the default will treat the configuration file as in the / var/named directory}; # include "/ etc/named.rfc1912.zones"; comment out the line include "/ etc/named.root.key"

4. Create a database file

Cd / var/named/ cp named.localhost example.com.zone # creates a vim example.com.zone $TTL 1D@IN SOAexample.com dns.example.com through the default zone file. (0; serial 1D; refresh 1H; retry 1W; expire 3H); minimum @ INNSdns.example.com. DnsINA172.16.104.123wwwINA172.16.104.123

5. Restart the test

Systemctl restart named [root@localhost named] # systemctl status named # check the status cat / etc/resolv.conf # determine the DNS address # Generated by NetworkManager nameserver 172.16.104.123 [root@localhost ~] # nslookup www.example.com Server:172.16.104.123 Address:172.16.104.123#53 Name:www.example.com Address:172.16.104.123

Tags: File configuration region data database comment directory path query monitor host just address place interface is in status port index software Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB MySQL Linux Xiaomi