bind 小测试

#测试其他功能临时搭建测试

主配置文件:

[root@localhost named]# cat /etc/named.conf
//
// 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 { 127.0.0.1;
any;
};
listen-on-v6 port { ::; };
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 { localhost;
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 no;
dnssec-validation no; /* 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";
}; zone "sgcc.com.cn" IN {
type master;
file "sgcc.com.cn.zone";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key"; [root@localhost named]#

zone 配置文件:

[root@localhost named]# cat /var/named/sgcc.com.cn.zone
$TTL
$ORIGIN sgcc.com.cn.
@ IN SOA ns.sgcc.com.cn. admin.sgcc.com.cn ( 1H
5M
1D
1D )
IN NS ns.sgcc.com.cn.
test IN A 192.168.100.100
test IN A 192.168.100.103
www2 IN A 192.168.100.103
ns IN A 192.168.100.101 [root@localhost named]#

dig :

安装  dig 工具:

     yum install bind-utils -y

[root@localhost named]# dig -t A @192.168.100.101 test.sgcc.com.cn

; <<>> DiG 9.9.-RedHat-9.9.-.el7_6 <<>> -t A @192.168.100.101 test.sgcc.com.cn
; ( server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id:
;; flags: qr aa rd ra; QUERY: , ANSWER: , AUTHORITY: , ADDITIONAL: ;; OPT PSEUDOSECTION:
; EDNS: version: , flags:; udp:
;; QUESTION SECTION:
;test.sgcc.com.cn. IN A ;; ANSWER SECTION:
test.sgcc.com.cn. IN A 192.168.100.100
test.sgcc.com.cn. IN A 192.168.100.103 ;; AUTHORITY SECTION:
sgcc.com.cn. IN NS ns.sgcc.com.cn. ;; ADDITIONAL SECTION:
ns.sgcc.com.cn. IN A 192.168.100.101 ;; Query time: msec
;; SERVER: 192.168.100.101#(192.168.100.101)
;; WHEN: Sun Mar :: EDT
;; MSG SIZE rcvd: [root@localhost named]#
上一篇:Java 语言的主要特性


下一篇:protocol http not supported or disabled in libcurl apt-get