欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ansible部署DNS緩存服務(wù)器的實(shí)現(xiàn)步驟

 更新時間:2023年08月06日 15:05:34   作者:明明星空  
本文主要介紹了ansible部署DNS緩存服務(wù)器的實(shí)現(xiàn)步驟,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

DNS緩存服務(wù)器是一種不負(fù)責(zé)域名數(shù)據(jù)維護(hù)的DNS服務(wù)器。簡單來說,緩存服務(wù)器就是把用戶經(jīng)常使用到的域名與IP地址的解析記錄保存在主機(jī)本地,從而提升下次解析的效率,這次使用unbound這款軟件部署緩存服務(wù)器

一、 準(zhǔn)備工作

1、 實(shí)驗(yàn)拓?fù)?/h3>

節(jié)點(diǎn)IP地址說明
DNS-server192.168.0.100緩存服務(wù)器
centos2192.168.0.101客戶端

2、 unbound軟件介紹

Unbound是紅帽公司(RedHat)默認(rèn)使用的的DNS服務(wù)包,Unbound是一個安全性高、功能強(qiáng)大、配置簡單。

3、 使用參數(shù)說明

參數(shù)說明
interface監(jiān)聽ip
interface-automatic如果部署在非默認(rèn)端口上,例如80/443,則需要禁用此選項(xiàng)
access-control允許網(wǎng)段
forward-zone允許域名,從哪里緩存

二、 ansible文件

1、 目錄結(jié)構(gòu)

[root@mmx_ansible dns_automating_unbound]# ls
ansible.cfg  inventory.yml  server.conf.j2  unbound.conf  unbound.yml

2、 配置文件

ansible.cfg

[defaults]
inventory=./inventory.yml
remote_user=root

3、主機(jī)清單文件

inventory.yml

home:
    caching_dns:
      ansible_host: 192.168.0.100
      ansible_ssh_password: "密碼"
      ansible_user: "用戶名"

4、 模板文件

server.conf.j2

{# 通過列舉出所有的ipv4地址,來寫 #}
server:
{% for ip in ansible_facts['all_ipv4_addresses'] %}
? ? interface: {{ ip }}
{% endfor %}
? ? interface-automatic: no
? ? access-control: {{ access_control }}
? ? domain-insecure: {{ domain_insecure }}
forward-zone:
? ? name: "{{ forward_zone_name }}"
? ? forward-addr: {{ forward_addr }}

5、 playbook

unbound.yml

---
- name: ubound is deployed on caching nameservers
? hosts: caching_dns
? become: yes
? vars:
? ? forward_addr: "114.114.114.114"
? ? access_control: "0.0.0.0/0 allow"
? ? domain_insecure: "*"
? ? forward_zone_name: "."
? tasks:
? ? - name: unbound is installed(安裝軟件包)
? ? ? yum:
? ? ? ? name: unbound
? ? ? ? state: present
? ? - name: unbound configuration is correct(配置unbound文件,當(dāng)修改該文件時,重啟服務(wù))
? ? ? template:
? ? ? ? src: server.conf.j2
? ? ? ? dest: /etc/unbound/conf.d/server.conf
? ? ? ? owner: root
? ? ? ? group: unbound
? ? ? ? mode: '0644'
? ? ? ? setype: named_conf_t
? ? ? notify:
? ? ? ? - restart unbound
? ? - name: unbound is started and enabled(開啟&&開機(jī)啟動unbound服務(wù))
? ? ? service:
? ? ? ? name: unbound
? ? ? ? state: started
? ? ? ? enabled: yes
? ? - name: unbound is started and enabled(確保防火墻開啟)
? ? ? service:
? ? ? ? name: firewalld
? ? ? ? state: started
? ? ? ? enabled: yes
? ? - name: dns is enabled on the firewalld(放行unbound服務(wù))
? ? ? ansible.posix.firewalld:
? ? ? ? service: dns
? ? ? ? state: enabled
? ? ? ? permanent: yes
? ? ? ? immediate: yes
? handlers:
? ? ? # 重啟unbound服務(wù)
? ? - name: restart unbound
? ? ? service:
? ? ? ? name: unbound
? ? ? ? state: restarted

6、 執(zhí)行playbook

ansible-playbook unbound.yml

[root@mmx_ansible dns_automating_unbound]# ansible-playbook unbound.yml?
PLAY [ubound is deployed on caching nameservers] *************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************
ok: [caching_dns]
TASK [unbound is installed(安裝軟件包)] **********************************************************************************************************************************************************************************************************
ok: [caching_dns]
TASK [unbound configuration is correct(配置unbound文件,當(dāng)修改該文件時,重啟服務(wù))] ***************************************************************************************************************************************************************
ok: [caching_dns]
TASK [unbound is started and enabled(開啟&&開機(jī)啟動unbound服務(wù))] *********************************************************************************************************************************************************************************
ok: [caching_dns]
TASK [unbound is started and enabled(開啟&&開機(jī)啟動unbound服務(wù))] *********************************************************************************************************************************************************************************
ok: [caching_dns]
TASK [dns is enabled on the firewalld(放行unbound服務(wù))] ******************************************************************************************************************************************************************************************
ok: [caching_dns]
PLAY RECAP ***************************************************************************************************************************************************************************************************************************************
caching_dns ? ? ? ? ? ? ? ?: ok=6 ? ?changed=0 ? ?unreachable=0 ? ?failed=0 ? ?skipped=0 ? ?rescued=0 ? ?ignored=0

三、測試

1、 客戶端

1) 臨時修改客戶端DNS地址

[root@dns_client ~]# vim /etc/resolv.conf
nameserver 192.168.0.100

2) nslookup訪問百度

[root@dns_client ~]# nslookup www.baidu.com
Server: ? ? ? ? 192.168.0.100
Address: ? ? ? ?192.168.0.100#53
Non-authoritative answer:
www.baidu.com ? canonical name = www.a.shifen.com.
Name: ? www.a.shifen.com
Address: 182.61.200.7
Name: ? www.a.shifen.com
Address: 182.61.200.6

2、 緩存服務(wù)器

1 ) 查看修改的配置文件

[root@DNS-Server_ubound ~]# cat /etc/unbound/conf.d/server.conf
server:
? ? interface: 192.168.0.100
? ? interface-automatic: no
? ? access-control: 0.0.0.0/0 allow
? ? domain-insecure: *
forward-zone:
? ? name: "."
? ? forward-addr: 114.114.114.114

2)查看緩存

unbound-control dump_cache

[root@DNS-Server_ubound ~]# unbound-control dump_cache
START_RRSET_CACHE
;rrset 155 1 0 2 3
a.shifen.com.   155     IN      SOA     ns1.a.shifen.com. baidu_dns_master.baidu.com. 2301200016 5 5 2592000 3600
;rrset 125 2 0 5 3
www.a.shifen.com.       125     IN      A       182.61.200.6
www.a.shifen.com.       125     IN      A       182.61.200.7
;rrset 545 1 0 5 3
www.baidu.com.  545     IN      CNAME   www.a.shifen.com.
END_RRSET_CACHE
START_MSG_CACHE
msg www.a.shifen.com. IN AAAA 33152 1 155 3 0 1 0
a.shifen.com. IN SOA 4
msg www.baidu.com. IN A 33152 1 125 3 2 0 0
www.baidu.com. IN CNAME 0
www.a.shifen.com. IN A 0
msg www.a.shifen.com. IN A 33152 1 125 0 1 0 0
www.a.shifen.com. IN A 0
END_MSG_CACHE
EOF

到此這篇關(guān)于ansible部署DNS緩存服務(wù)器的實(shí)現(xiàn)步驟的文章就介紹到這了,更多相關(guān)ansible部署DNS緩存服務(wù)器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 從斷網(wǎng)事件分析DNS服務(wù)器拒絕服務(wù)攻擊

    從斷網(wǎng)事件分析DNS服務(wù)器拒絕服務(wù)攻擊

    2009年5月19日21時50分開始,江蘇、安徽、廣西、海南、甘肅、浙江等6省用戶申告訪問網(wǎng)站速度變慢或無法訪問。主要表現(xiàn)為域名解析(DNS)響應(yīng)緩慢或者無法解析。直至5月22日事件才漸漸平息。
    2009-06-06
  • DNS服務(wù)器管理與配置技巧淺談

    DNS服務(wù)器管理與配置技巧淺談

    DNS服務(wù)器用于TCP/IP網(wǎng)絡(luò)中,它用來通過用戶友好的名稱代替難記的IP地址以定位計算機(jī)和服務(wù)。
    2010-12-12
  • 域名DNS解析的故障解決方法

    域名DNS解析的故障解決方法

    在實(shí)際應(yīng)用過程中可能會遇到DNS解析錯誤的問題,就是說當(dāng)我們訪問一個域名時無法完成將其解析到IP地址的工作,而直接輸入網(wǎng)站IP卻可以正常訪問,這就是因?yàn)镈NS解析出現(xiàn)故障造成的。
    2009-06-06
  • 使用Unbound配置DNS緩存服務(wù)器的實(shí)現(xiàn)步驟

    使用Unbound配置DNS緩存服務(wù)器的實(shí)現(xiàn)步驟

    本文主要介紹了使用Unbound配置DNS緩存服務(wù)器的實(shí)現(xiàn)步驟,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-08-08
  • DNS log注入原理解析

    DNS log注入原理解析

    這篇文章主要介紹了DNS log注入原理解析,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-05-05
  • Windows Server 2019 DNS服務(wù)器的配置與管理之DNS轉(zhuǎn)發(fā)器

    Windows Server 2019 DNS服務(wù)器的配置與管理之DNS轉(zhuǎn)發(fā)器

    這篇文章主要介紹了Windows Server 2019 DNS服務(wù)器的配置與管理之DNS轉(zhuǎn)發(fā)器,需要的朋友可以參考下
    2023-05-05
  • DNSLog使用方法及場景分析

    DNSLog使用方法及場景分析

    這篇文章主要介紹了DNSLog使用方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-05-05
  • Win2003 DNS服務(wù)器創(chuàng)建多個域名

    Win2003 DNS服務(wù)器創(chuàng)建多個域名

    某公司局域網(wǎng)的服務(wù)器基于Windows Server 2003,并搭建了DNS服務(wù)器。現(xiàn)在準(zhǔn)備建立若干域名,使它們分別應(yīng)用在HTTP瀏覽、FTP登錄、論壇訪問和E-mail收發(fā)等方面。如何在DNS服務(wù)器中實(shí)現(xiàn)這一設(shè)想呢?
    2011-01-01
  • DNS服務(wù)器的安裝與配置步驟

    DNS服務(wù)器的安裝與配置步驟

    本文主要介紹了DNS服務(wù)器的安裝與配置步驟,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-06-06
  • Windows?Server?2019?DNS服務(wù)器的配置與管理之DNS正向解析

    Windows?Server?2019?DNS服務(wù)器的配置與管理之DNS正向解析

    這篇文章主要介紹了Windows?Server?2019?DNS服務(wù)器的配置與管理之DNS正向解析,需要的朋友可以參考下
    2023-05-05

最新評論