warren6

 

bind安装配置

bind安装配置

1.安装

yum安装

yum install bind -y

2.修改配置文件

修改etc下的配置文件

vim /etc/named.conf

listen-on port 53 { 192.168.149.20; }; //改成相应的IP
allow-query     { any; };              //改成允许如何主机访问
forwarders       { 192.168.149.1; };   //网关

recursion yes;                         //默认为yes

dnssec-enable no;                      //改成no
dnssec-validation no;                 //改成no

3.验证配置文件

验证配置文件/etc/named.conf是否书写正确

named-checkconf

4.修改区域配置文件

增加/etc/named.rfc1912.zones

vim /etc/named.rfc1912.zones

zone "host.com" IN {
        type master;
        file "host.com.zone";
        allow-update { 192.168.149.20; };
};

zone "old.com" IN {
        type master;
        file "old.com.zone";
        allow-update { 192.168.149.20; };
};

5.配置区域数据文件

修改/var/named/host.com.zone

vim /var/named/host.com.zone

$ORIGIN host.com.
$TTL 600       ; 10 minutes
@       IN SOA dns.host.com. dnsadmin.host.com.(
							   2020102601 ; serial
							   10800      ; refresh (3 hours)
							   900        ; retry (15 minutes)
							   604800     ; expire (1 week)
							   86400      ; minimum (1 day)
							   )
					    NS   dns.host.com.
$TTL 60 ; 1minute
dns               A     192.168.149.11
Docker-01         A     192.168.149.11
Docker-02         A     192.168.149.12
CentOS7-01        A     192.168.149.10
CentOS7-02        A     192.168.149.11

修改/var/named/old.com.zone

cat >/var/named/old.com.zone
$ORIGIN old.com.
$TTL 600       ; 10 minutes
@       IN SOA dns.old.com. dnsadmin.old.com.(
							   2020102601 ; serial
							   10800      ; refresh (3 hours)
							   900        ; retry (15 minutes)
							   604800     ; expire (1 week)
							   86400      ; minimum (1 day)
							   )
					    NS   dns.old.com.
$TTL 60 ; 1minute
dns               A     192.168.149.11

6.验证配置文件

验证配置文件/etc/named.conf是否书写正确

named-checkconf

7.增加搜索主机域

修改配置文件/etc/resolv.conf

vim /etc/resolv.conf
search host.com

posted on 2022-10-10 13:45  Warren6  阅读(187)  评论(0编辑  收藏  举报

导航