1. 程式人生 > 其它 >k8s(二)-bind的安裝

k8s(二)-bind的安裝

1.基礎包的安裝(zyjc7-11上)

yum install -y wget net-tools telnet tree nmap sysstat lrzsz dos2unix bind-utils

2、安裝bind

yum -y   install   bind

3、修改配置

vim  /etc/named.conf

listen-on port 53 { 10.4.7.11; };    #修改為本機地址
allow-query     { any; };            #主機都可以訪問
forwarders  { 223.5.5.5; };          # 辦公網上一級的DNS,(生產寫運營商dns)
recursion yes;                       # dns採用遞迴的查詢
 dnssec
-enable no; # 關閉,節省資源(生產可能不需要關閉) dnssec-validation no; # 關閉,節省資源,不做網際網路認證

vim  /etc/named.rfc1912.zones     在檔案最後插入

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

zone "od.com" IN {
        type master;
        
file "od.com.zone"; allow-update { 10.4.7.11; }; };

vim    /var/named/host.od.com

$ORIGIN host.com.
$TTL 600        ; 10 minutes
@       IN SOA  dns.host.com. dnsadmin.host.com. (
                                2022032501 ; serial
                                10800      ; refresh (3 hours)
                                
900 ; retry (15 minutes) 604800 ; expire (1 week) 86400 ; minimum (1 day) ) NS dns.host.com. $TTL 60 ; 1 minute dns A 10.4.7.11 zyjc7-11 A 10.4.7.11 zyjc7-12 A 10.4.7.12 zyjc7-21 A 10.4.7.21 zyjc7-22 A 10.4.7.22 zyjc7-200 A 10.4.7.200

# 過期時間2019.12.09+01序號

# 區域授權檔案的開始,OSA記錄,dnsadmin.host.com為郵箱

2022032501 # 安裝的當天時間

vim  /var/named/od.com.zone

$ORIGIN od.com.
$TTL 600        ; 10 minutes
@               IN SOA  dns.od.com. dnsadmin.od.com. (
                                2022032501 ; serial
                                10800      ; refresh (3 hours)
                                900        ; retry (15 minutes)
                                604800     ; expire (1 week)
                                86400      ; minimum (1 day)
                                )
                                NS   dns.od.com.
$TTL 60 ; 1 minute
dns                A    10.4.7.11

4、檢查配置是否修改正確

 named-checkconf
named-checkzone "host.com" /var/named/host.com.zone
named-checkzone "od.com" /var/named/od.com.zone
 chown root:named /var/named/host.com.zone
 chown root:named /var/named/od.com.zone
 chmod 640 /var/named/host.com.zone
 chmod 640 /var/named/od.com.zone

5、啟動服務,開機啟動,並檢測

systemctl  enable  --now  named
dig   -t  A  zyjc7-12.host.com  @10.4.7.11  +short