【dnsmasq】CentOS7.x上dnsmasq的安裝配置

一、實驗環境


dnsmasp01? ?192.168.1.104

dnsmasq02? ?192.168.1.106

dnsclient? ? ? ?192.168.1.102



二、安裝配置


在dnsmasp01服務器


#?yum -y install dnsmasq

# cat /etc/dnsmasq.conf

###################################

domain-needed

bogus-priv

resolv-file=/etc/resolv.conf

strict-order

address=/www.example.com/192.168.1.110

address=/www.example.com/192.168.1.120

listen-address=127.0.0.1,192.168.1.104

no-hosts

expand-hosts

addn-hosts=/etc/hosts

domain=www.example.com

conf-dir=/etc/dnsmasq.d

#####################################


在dnsmasp02服務器


#?yum -y install dnsmasq


# cat /etc/dnsmasq.conf

######################################

domain-needed

bogus-priv

resolv-file=/etc/resolv.conf

strict-order

address=/www.example.com/192.168.1.110

address=/www.example.com/192.168.1.120

listen-address=127.0.0.1,192.168.1.106

no-hosts

expand-hosts

addn-hosts=/etc/hosts

domain=www.example.com

conf-dir=/etc/dnsmasq.d

##########################################


啟動dnsmasq


# systemctl restart dnsmasq

# systemctl status dnsmasq

# systemctl enable? dnsmasq


三、dnsclient服務器域名解析測試


# cat /etc/resolv.conf



# ping www.example.com

# ping www.baidu.com

測試可知,dnsmasq可以繼承宿主機的nameserver,內外網域名解析,沒問題。



關閉dnsmasq01上服務,也就是說?nameserver 192.168.1.104 無法工作了

# systemctl stop dnsmasq



在dnsclient上測試域名解析

# ping www.example.com

# ping www.baidu.com

# nslookup www.example.com


nameserver 192.168.1.104掛了,nameserver 192.168.1.106,依然能順利完成解析!




四、參考


How to Setup a DNS/DHCP Server Using dnsmasq on CentOS/RHEL 8/7

https://www.tecmint.com/setup-a-dns-dhcp-server-using-dnsmasq-on-centos-rhel


dnsmasq wiki

https://wiki.archlinux.org/title/dnsmasq


Index of /dnsmasq

https://thekelleys.org.uk/dnsmasq


負載均衡手段之DNS輪詢

https://www.cnblogs.com/data2value/p/6107380.html


什么是循環 DNS?

https://www.cloudflare.com/zh-cn/learning/dns/glossary/round-robin-dns/


Using Dnsmasq for local development on OS X

https://passingcuriosity.com/2013/dnsmasq-dev-osx


dnsmasq輕量級DNS安裝配置

https://developer.aliyun.com/article/459556


Linux安裝DNSmasq搭建自己的公共DNS

https://cloud.tencent.com/developer/article/1024293


使用 dnsmasq 轉發 dns 請求

https://einverne.github.io/post/2014/05/dnsmasq-dns-forward.html

DNS 解析 DNSPod

https://cloud.tencent.com/document/product/302


Simple Load Balancing with DNS on Linux

https://www.linux.com/topic/networking/simple-load-balancing-dns-linux


dnsmasq 介紹與使用

http://www.enkichen.com/2017/05/23/dnsmasq-introduce

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容