I. Introduction
DNSmasq is a lightweight and easy-to-use DNS service tool. It can be used for NAT translation of IP addresses during Intranet and Internet connections, or as a DNS service for small networks.
Ii. Installation
Sudo apt-get install dnsmasq
Iii. Configuration
Vi/etc/dnsmasq. conf
# Change this line if you want dns to get its upstream servers from
# Somewhere other that/etc/resolv. conf
# Resolv-file =
Set the upper-level dns server to forward query requests to the upper-level server. If this parameter is not set,/etc/resolv. conf is used by default.
To resolve the Internet dns, you must set this option to forward dns requests to the Internet.
# Include a another lot of configuration options.
# Conf-file =/etc/dnsmasq. more. conf
Conf-dir =/etc/dnsmasq. d
Used to include the configuration file directory
Create a file configuration file in/etc/dnsmasq. d, such as a dns-intrant.conf
Address =/www.google.hk/192.168.1.12
# Wildcard Parsing
Address =/.google.hk/192.168.1.12
Address =/.google.net/192.168.1.12
Address =/.google.com/121.52.221.12
Common websites can be added for dns caching.
4. Start the service
Sudo service dnsmasq start
Netstat-ntlp | grep 53 check whether the service is started