dnsmasq
Provide DNS and DHCP services
SYNOPSIS
dnsmasq [options]
PARAMETERS
-v, --version
Show the version number.
-q, --quiet-query
Do not log DNS queries.
-d, --no-daemon
Run in the foreground.
-u
Specify the user to run as.
-g
Specify the group to run as.
-p
Listen on
-h, --no-hosts
Don't read /etc/hosts file.
-H
Additional hosts file.
-i
Listen only on specified interface(s).
-I
Do not listen on specified interface(s).
-z, --bind-interfaces
Bind directly to interfaces rather than routing via address.
-S
Specify upstream DNS server to use.
-r
Use this file instead of /etc/resolv.conf.
-x
Specify pid file.
-c
Set the size of the DNS cache in entries. The default is 150.
-t
Set the TTL for local DNS entries. The default is 3600 seconds.
-l
Log DNS queries.
-F [
Enable DHCP server, setting the address range. Lease time is optional (default: 1h).
-O
Specify DHCP option to be sent.
-W, --dhcp-leasefile=
Use specified file to store DHCP lease information.
-k, --dhcp-authoritative
Assume DHCP server is authoritative.
DESCRIPTION
dnsmasq is a lightweight, easy to configure DNS forwarder and DHCP server. It is designed to provide DNS and, optionally, DHCP services to a small network. It can serve the names of local machines which are not present in the global DNS and acts as a local DNS cache to improve response time and reduce bandwidth consumption. dnsmasq accepts DNS queries and either answers them from a small, local cache or forwards them to a real, recursive DNS server. It loads the contents of /etc/hosts so that local host names which do not appear in the global DNS can be resolved and answers DNS queries for DHCP-configured hosts. The DHCP server supports static address assignments and multiple networks. It can be configured via command line options and configuration files. dnsmasq is commonly used in embedded systems and small networks due to its small footprint and ease of configuration. It is also commonly used for creating test environments where you need local dns resolution.
CAVEATS
dnsmasq is not suitable for very large networks due to its limited resource management capabilities. Correct firewall configuration is crucial to prevent unauthorized access to your DNS server. Configuration file syntax can be complex; careful reading of the manual is advised.
CONFIGURATION FILES
dnsmasq can be configured via command-line options or via a configuration file, typically located at /etc/dnsmasq.conf. Options in the configuration file override command-line options.
Example: To specify the upstream DNS server, you would add the line server=8.8.8.8 to /etc/dnsmasq.conf.
DHCP OPTIONS
dnsmasq supports a wide range of DHCP options. You can specify these options using the --dhcp-option flag, or via a similar option in the configuration file.
Example: To specify the DNS server to be used by DHCP clients, you would use --dhcp-option=6,8.8.8.8,8.8.4.4, in the command line or dhcp-option=6,8.8.8.8,8.8.4.4 in dnsmasq.conf.
HISTORY
dnsmasq was originally written by Simon Kelley, with contributions from many others, and it evolved from its origins in embedded environments to become a popular choice for small to medium-sized networks. Its design emphasizes ease of use and small footprint.