将Dnsmasq安装为缓存Dns服务器

我们的网络里有很多电脑。我们的网络速度不算太快。有时,尤其是在早晨,我们的互联网连接速度会减慢。如何用一些dns相关的技巧来解决这个问题?Dns是最常用的网络协议之一。它会影响网速。做一些优化将发展你的互联网体验。缓存是在我们的dns服务器中保存解析的dns查询。有不同类型和功能的dns服务器在野外。Dnsmasq是其中之一,非常轻。Dnsmasq也可以用于tftp和dhcp服务器。

null

安装

我们可以像下面这样轻松地安装dnsmasq。

Ubuntu、Debian、Kali

$ sudo apt-get install dnsmasq
Install dnsmasq
安装dnsmasq

森托斯,软呢帽

$ sudo yum install dnsmasq

添加新DNS服务器

为dnsmasq的下一个跃点添加新的dns服务器。请记住,要添加这些配置,我们需要根权限

$ echo "nameserver 8.8.8.8" >> /etc/resolv.conf $ cat /etc/resolv.conf  ; generated by /usr/sbin/dhclient-script nameserver 192.168.122.1 nameserver 8.8.8.8

重新启动Dnsmasq

默认情况下 dnsmasq 安装后未启动。我们将从 systemctl restart 命令如下。

$ systemctl restart dnsmasq

挖掘试验

为了查看dnsmasq是否处于活动状态,我们将使用 dig 用于域名查询。我们将对进行dns查询www.poftut.com

$ dig www.poftut.com
Test With Dig
挖掘试验

dnsmasq的DNS请求

在第一个DNS请求中,这将从全局DNS服务器返回并存储在 dnsmasq . 如果我们在第二次解决相同的域名,这将返回从 dnsmasq . 这将使

$ dig www.poftut.com
DNS Request To dnsmasq
dnsmasq的DNS请求

我们看得出来 Query time: 约为67毫秒,这比以前的DNS请求的211毫秒要好。

相关文章: 什么是SOA(授权开始)记录以及如何列出?

将Dnsmasq安装为缓存Dns服务器Infografic

Install Dnsmasq As Cache Dns Server Infografic
将Dnsmasq安装为缓存Dns服务器Infografic

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享