In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use DNSmasq to build a local DNS server under Linux. The article is very detailed and has a certain reference value. Interested friends must read it!
DNSmasq is a small and convenient tool for configuring DNS and DHCP for small networks, providing DNS capabilities and optional DHCP features. It serves domain names that only apply locally, and these domain names do not appear in DNS servers around the world.
1. Dnsmasq installation
Install and start Dnsmasq
Yum install-y dnsmasqservice dnsmasq start II, Dnsmasq configuration
1. The configuration file path of Dnsmasq is: / etc/dnsmasq.conf
# ll-d / etc/dnsmasq.conf-rw-r--r-- 1 root root 21237 Feb 23 00:17 / etc/dnsmasq.conf
2. Edit / etc/dnsmasq.conf
Resolv-file=/etc/resolv.dnsmasq.conf / / dnsmasq will look for the upstream dns server strict-order / / remove the previous # addn-hosts=/etc/dnsmasq.hosts / / add the record listen-address=127.0.0.1192.168.1.123 / / listener address to this file
3. Modify / etc/resolv.conf
Echo 'nameserver 127.0.0.1' > / etc/resolv.conf
Create the resolv.dnsmasq.conf file and add the address of the upstream dns server
Touch / etc/resolv.dnsmasq.confecho 'nameserver 119.29.29.29' > / etc/resolv.dnsmasq.conf
5. Create a dnsmasq.hosts file
Cp / etc/hosts / etc/dnsmasq.hostsecho 'addn-hosts=/etc/dnsmasq.hosts' > > / etc/dnsmasq.conf
Tip: what is set up in resolv.dnsmasq.conf is the real Nameserver, which can be used by telecom, Unicom and other public DNS.
III. Dnsmasq start
1. Set Dnsmasq to boot and start the Dnsmasq service:
Chkconfig dnsmasq on/etc/init.d/dnsmasq restart
2. Netstat-tunlp | grep 53 to check whether Dnsmasq starts normally:
# netstat-tlunp | grep 53tcp 0 0 0.0 0 grep 53tcp 53 0 0 0 LISTEN 2491/dnsmasq tcp 0: 53:: * LISTEN 2491/dnsmasq udp 0 0 0.0.0.0: 53 0.0.0.0 2491/dnsmasq udp 0: 53:: * 2491/dnsmasq
3. Dig www.freehao123.com, there is no cache for the first time, so the time is more than 200.
4. The second test shows that the query time has been changed to 0. 0 because there is already a cache.
The above is all the contents of the article "how to use DNSmasq to build a local DNS server under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.