溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

通過unbound軟件配置簡單的DNS

發(fā)布時(shí)間:2020-06-02 09:37:32 來源:網(wǎng)絡(luò) 閱讀:3197 作者:tomshen 欄目:系統(tǒng)運(yùn)維

實(shí)現(xiàn)DNS的軟件:unbound(貌似bind更強(qiáng)大)


unbound是紅帽公司推薦的DNS軟件


unbound的程序包:

unbound:實(shí)現(xiàn)DNS的主程序包

unbound-libs:進(jìn)行域名解析必備的庫文件


unbound服務(wù)的啟動(dòng):


systemctl start unbound


unbound的配置文件:

/etc/unbound/unbound.conf? ? #主配置文件

/etc/unbound/local.d/? ? ? ? #

/etc/nsswitch.conf? ? ? ? ? ?#/etc/nsswitch.conf文件的第39行"hosts:files dns"規(guī)定了一臺(tái)主機(jī)解析的順序,

? 首先找的本地文件/etc/hosts,然后再是DNS



/etc/hosts? ? ? ? ? ? ? ? ? ?#本地IP地址與主機(jī)名的映射關(guān)系

/etc/resolv.conf? ? ? ? ? ? ?#為linux客戶端指定DNS服務(wù)器




配置防火墻,放行DNS服務(wù);

firewall-cmd --add-service=dns --permanent


啟動(dòng)unbound服務(wù),并設(shè)置開機(jī)啟動(dòng):

systemctl start unbound

systemctl enable unbound


配置防火墻;

firewall-cmd --permanent --add-service=dns

firewall-cmd --reload




unbound主配置文件:

/etc/unbound/unbound.conf?


server:

interface:xxxx? ?#監(jiān)聽的IP地址,默認(rèn)監(jiān)聽localhost


訪問控制列表;(默認(rèn)拒絕所有主機(jī),除了localhost)


access-control: IP地址/掩碼 allow? ?#允許訪問的主機(jī)

access-control: IP地址/掩碼 refuse? #禁止訪問的主機(jī)


username:""? ? ? ? ? ? ? ? ? ? ? ? ?#任何用戶都能訪問


include: /etc/unbound/local.d/*.conf


local-zone:

資源記錄:RR


remote-control:


stub-zone:


forward-zone:





1. unbound中正反向解析文件,合并為一個(gè):

在/etc/unbound/local.d/下新建一個(gè)文件testyuming.com.conf,內(nèi)容如下:

local-zone: "testyuming.com." static

local-data: "testyuming.com. 86400 IN SOA 768047936.qq.com. root 1 1D 1H 1W 1H"? ??

local-data: "testyuming.com. NS www.testyuming.com."

local-data: "testyuming.com. MX 5 www.testyuming.com."

local-data: "www.testyuming.com. A 192.168.1.118"

local-data: "bbs.testyuming.com. A 192.168.1.118"



# local-data-ptr: "192.168.1.118 www.testyuming.com."? ? ?反向解析范例?



2.使用unbound-checkconf檢查語法


3.重啟unbound服務(wù):

systemctl restart unbound

4.修改/etc/resolv.conf文件,內(nèi)容如下:

nameserver 192.168.1.118


5.

[root@localhost etc]# host www.testyuming.com

www.testyuming.com has address 192.168.1.118






? ? 配置僅轉(zhuǎn)發(fā)DNS:


? ? 1.

? ? unbound主配置文件的基本設(shè)置:


? ? interface: 192.168.1.118

? ? access-control: 0.0.0.0/0 allow

? ? username:""


? ? 在配置文件里找到module-config

? ? 把注釋取消,然后改成module-config:"iterator"



? ? 2.

? ? 重啟unbound


? ? systemctl restart unbound



? ? 3.

在/etc/unbound/local.d/下新建一個(gè)文件bb.conf,內(nèi)容如下:


? ? forward-zone:


? ? name:"."

? ? forward-addr:可以進(jìn)行DNS解析的服務(wù)器IP




? ? unbound-control flush 域名? ? #清除緩存


? ?


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI