dns服务搭建
Bind是DNS协议的一种实现,其运行的进程名为named。
Bind的配置文件
/etc/named.conf
/etc/named.iscdlv.key /etc/named.rfc1912.zones /etc/named.root.key
安装
yum -y install bind
/etc/named.conf
options { listen-on port 53 { 127.0.0.1;localhost; }; #设置监控能与外部主机通信的IP地址 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; #学习时建议关闭 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 { #根区域,包含着多个DNS顶级域信息 type hint; file "named.ca"; }; include "/etc/named.rfc1912.zones"; #把区域管理文件的内容包含进此文件 include "/etc/named.root.key";
/etc/named.rfc1912.zones
zone "test.com" IN { type master; file "test.com.zone"; };
/var/named/test.com.zone
$TTL 1D $ORIGIN test.com. @ IN SOA ns1.test.com. dnsadmin.test.com. ( 0 1D 1H 1W 3H ) IN NS ns1 IN MX 10 mx1 IN MX 20 mx2 ns1 IN A 192.168.1.2 mx1 IN A 192.168.1.3 mx2 IN A 192.168.1.4 www IN A 192.168.1.4
启动:systemctl start named