linux DNS快取記憶體

2021-08-15 11:13:04 字數 3626 閱讀 3919

配置名稱伺服器(本機ip:172.25.254.117)

1 安裝 bind 軟體包

– yum install -y bind
2 編輯 /etc/named.conf

listen-on port 53 ;     ##開啟埠

allow-query ; ##允許訪問

forwarders ; ##如果伺服器沒有這個位址就去訪問250

3 啟動並啟用 dns 伺服器

systemctl start named

systemctl enable named

firewall-cmd

--permanent --add-server

=dns

firewall-cmd

--reload

firewall-cmd

--list

-all

netstat -antlupe

|grep 53

4配置其他兩台機器dns

vim /etc/resolve.conf

nameserver 172.25

.254

.117

• 進行測試

dns正向解析

vim /etc/named.conf

forwarders ; ##刪除這一行自己搭建乙個dns

vim /etc/named.rfc1912.zones

zone "westos.com"

in ;

cd /var/named/

cp -p named.localhost westos.com

.zone

vim westos.com

.zone

1 $ttl 1d

2 @ in soa westos.com

.zone. root.westos

.com. ( ##@如果後面不加. 自動補齊westos.com30

; serial

41d ; refresh

51h ; retry

61w ; expire

73h ) ; minimum

8 ns dns.westos

.com.

9 dns a 172.25

.254

.117

10 www a 172.25

.254

.111

systemctl restart named

測試:dig www.westos.com

@@@如果想讓dns伺服器實現輪詢:

dns反向解析

vim /etc/named.rfc1912.zones

47 zone "254.25.172.in-addr.arpa"

in ;

51 };

cp -p named.loopback westos.com

.ptr

vim westos.com

.ptr

1 $ttl 1d

2 @ in soa dns.westos

.com. root.westos

.com. (

30; serial

41d ; refresh

51h ; retry

61w ; expire

73h ) ; minimum

8 ns dns.westos

.com.

9 dns a 172.25

.254

.117

10111 ptr www.westos

.com.

11222 ptr sjw.westos

.com.

systemctl restart named

測試:dig -x 172.25.254.111

dig -x 172.25.254.222

雙向解析

cp -p westos.com

.zone westos.com

.inter

vim westos.com

.inter

%s/172.25

.254/192.25

.254/g

cp /etc/named.rfc1912.zones /etc/named.rfc1912.zones

.inter -p

vim named.rfc1912.zones

.inter

24 zone "westos.com"

in ;

28 };

vim named.conf

50#zone "." in ;54#

55#include "/etc/named.rfc1912.zones";

56#include "/etc/named.root.key";57#

58 view localnet; ##這裡填的是localhost

60 zone "."

in;64 include "/etc/named.rfc1912.zones.inter"

;65 };

6667 view internet;

69 zone "."

in;73 include "/etc/named.rfc1912.zones"

;74 };

vim /etc/resolv.conf

nameserver 172.25

.254

.217

測試:

在內網和外網測試dig www.westos.com

linux dns快取記憶體

1.安裝部署dns yum install bind y systemctl start named systemctl enable named systemctl stop firewalld systemctl disable firewalld 主配置檔案 etc named.conf 子配...

快取記憶體DNS

dns 客戶端修改dns 服務端yum install bind y firewall cmd permanent add service dns firewall cmd reload setenforce 0 netstat antulpe grep named vim etc named.co...

快取記憶體DNS

yum install bind y systemctl start named 啟動dns服務 此時可能需要在虛擬機器中進行無規律的敲鍵盤,動滑鼠等操作 systemctl enable named firewall cmd add service dns 設定dns可通過火牆 step1 首先配...