DNS服务器搭建

1、安装软件

# yum install -y bind*

2.配置

# cat /etc/named.conf|grep -v ^\/

options {
	listen-on port 53 { any; };		##### 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";
	recursing-file  "/var/named/data/named.recursing";
	secroots-file   "/var/named/data/named.secroots";
	allow-query     { trusted; };	##### acl

	/* 
	 - 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;
	forward first;									##########
	forwarders {114.114.114.114; 8.8.8.8; };		##########
	dnssec-enable yes;
	dnssec-validation yes;

	/* 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";
};

acl "trusted" {		###########
	127.0.0.1;
	192.168.19.0/24;
};

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


# tail -5 /etc/named.rfc1912.zones
zone "dy.com" IN {
	type master;
        file "dy.com.zone";
        allow-update { none; };
};

# cat /var/named/dy.com.zone
$TTL 1D
@   IN SOA  dns.dy.com. root.dy.com. (
                    2019050622 ; serial
                    1D  ; refresh
                    1H  ; retry
                    1W  ; expire
                    3H )    ; minimum

@       IN      NS      ns.dy.com.
ns      IN      A       192.168.19.21
pkgs    IN      A       192.168.19.21
scripts IN      A       192.168.19.21
svn     IN      A       192.168.19.21
git     IN      A       192.168.19.22
jenkins IN      A       192.168.19.24
mysql   IN      A       192.168.19.25
sonar   IN      A       192.168.19.28

*   A   192.168.19.21


# chown root.named /var/named/dy.com.zone
# systemctl enable named
# systemctl restart named
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sun_xuegang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值