Configure DNS server in CentOS7

  View all services opened in a certain area
  [root@localhost ~]# firewall-cmd --zone=public --list-all

1. Configure yum source
2. Change the host name to jison.com
hostnamectl set-hostname jison.com
3 . Modify the ip address of the network card and other commands
TYPE=Enternet
HWADDR=00:00:00:00:01
IPADDR=192.168.1.109
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.109
4. Package bind, bind- utils
yum install bind bind-utils
5. Enable named service
systemctl enable named
systemctl start named
6. Configure /etc/named.conf, /etc/named.rfc1912.zones
(1) [root@yutianedu ~]# vim /etc/ named.conf
options {
       listen-on port 53 { any; }; # Set listening
        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";
        allow-query     { any; };           # 允许查询
recursion yes;
        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        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 {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

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

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

(2)# vim /etc/named.rfc1912.zones
# 在该文件的最末尾加入以下内容
zone "jison.com" IN {
        type master;
        file "jison.zone";
        allow-update { none; };
};
7.配zones
cd /var/named
cp -p named.localhost jison.zone
vi jison.zone
# cp –p /var/named/named.localhost /var/named/jison.zone
# vim /var/named/google.zone
$TTL 7200
@ IN SOA ns.jison.com. root.jison.com. (
                                2014112499 ; serial
                                        1D ; refresh
                                        1H ; retry
                                        1W ; expire
                                        3H ) ; minimum
@ NS ns.jison.com.
ns A 172.25.254.201
www A 172.25.254.201
ftp A 172.25.254.12
8. Restart the named service
systemctl restart named.service
9. Allow outsiders to access the named service in the firewall
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
10. Test: nslookup
vim /etc/resolv.conf
nameserver 172.25.254.201 # Specify the DNS server address

to ping www.jison.com

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326647401&siteId=291194637