// // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // // See the BIND Administrator's Reference Manual (ARM) for details about the // configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html options { #listen-on port 53 {0.0.0.0;}; #listen-on port 53 { 127.0.0.1; }; listen-on-v6 port 53 { any; }; # 监听所有端口和地址,包括ipv4 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"; # 状态统计文件 recursing-file "/var/named/data/named.recursing"; secroots-file "/var/named/data/named.secroots"; allow-query { any; }; # 允许使用本DNS服务的网段地址,any代表所有 /* - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion. - If you are building a RECURSIVE (caching) DNS server, you need to enable recursion. - If your recursive DNS server has a public IP address, you MUST enable access control to limit queries to your legitimate users. Failing to do so will cause your server to become part of large scale DNS amplification attacks. Implementing BCP38 within your network would greatly reduce such attack surface */ recursion yes; dnssec-enable yes; dnssec-validation yes; /* Path to ISC DLV key */ bindkeys-file "/etc/named.root.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"; }; # 添加域名;正向解析;创建文件/var/named/obctest.com # obctest.com zone "obctest.com" IN { type master; # 主要区域 file "obctest.com";# 数据文件 # allow-transfer { 172.16.20.21; }; # 允许转发的从服务器,可不设置 }; # 添加反向解析,# 反向区域 zone "20.20.16.172.in-addr.arpa" in { type master; file "172.16.20.20.arpa"; # 区域数据文件 }; include "/etc/named.rfc1912.zones"; include "/etc/named.root.key";
添加域数据文件
在指定存放的域数据文件夹创建对应的文本内容;并复制已存在的模版
1 2
[root@localhost /]# vi /var/named/obctest.com :r /var/named/named.localhost