您好,登錄后才能下訂單哦!
###dns設定###
#在開始之前先設定好網絡服務環境
client設定
vim /etc/resolv.conf ##編輯配置文件
nameserver 172.25.254.109 ##添加服務端
server設定
yum install bind -y ##安裝bind服務
systemctl status named ##查看
rpm -qc bind
systemctl enable named ##開機自啟
systemctl start named ##開啟服務
firewall-cmd --permanent --add-service=dns ##永久添加dns服務
firewall-cmd --reload
netstat -antulpe | grep named ##查看開放端口
vim /etc/name.conf
listen-on port 53 { any; }; ##設定開放端口。any表示對所有的interface都開放
allow-query { any; }; ##回答所有人提問
forwarders {172.25.254.250;};
dnssec-validation no;
systemctl restart named
####正向解析####
##正向解析就是將域名解析為ip
vim /etc/name.conf
##刪除forwarders {172.25.254.250;};
vim /etc/named.rfc1912.zones ##進入配置文件
zone "westos.com" IN {
type master;
file "westos.com.zone";
allow-update { none; };
};
cd /var/named/
cp -p named.localhost westos.com.zone ##帶權限復制
vim westos.com.zone
$TTL 1D
@ IN SOA dns.westos.com. root.westos.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.com.
dns A 172.25.254.109
www A 172.25.254.251
~
##@表示的是zone 如果不加.表示自動補充域名。
systemctl restart named ##重啟服務
####反向解析####
vim /etc/named.rfc1912.zones
zone "254.25.172.in-addr.arpa" IN {
type master;
file "westos.com.ptr";
allow-update { none; };
};
cd /var/named/
cp -p named.loopback westos.com.ptr
vim westos.com.ptr
$TTL 1D
@ IN SOA dns.westos.com. root.westos.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.com.
A 172.25.254.109
109 PTR www.westos.com.
110 PTR www.hello.com.
~
####雙向解析####
cd /var/named
cp -p westos.com.zone westos.com.inter ##加權限復制文件
vim westos.com.inter ##編輯外網配置文件
$TTL 1D
@ IN SOA dns.westos.com. root.westos.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.com.
dns A 172.25.0.109
www A 172.25.0.251
www A 172.25.0.252
bbs CNAME www.westos.com.
westos.com. MX 1 172.25.0.109
~ ##將所有的網段改為0網段
cp -p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.inter
vim /etc/named.rfc1912.zones.inter
zone "westos.com" IN {
type master;
file "westos.com.inter";
allow-update { none; };
};
vim /etc/named.conf ##編輯主配置文件
/*
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
*/ ##注銷
view localnet{
match-clients {172.25.254.109; };
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
}; ##添加內網客戶端 (可以man 5 named.conf)
view internet{
match-clients {any; };
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones.inter";
}; ##添加外網客戶端
systemctl restart named ##重啟服務
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。