Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Dnsmasq Install Script

This folder contains a script for installing Dnsmasq and configuring it to forward requests for a specific domain to Consul. This way, you can easily use Consul as your DNS server for domain names such as foo.service.consul, where foo is a service registered with Consul (see the Registering Services docs for instructions on registering your services with Consul). All other domain names will continue to be resolved via the default resolver on your OS. See the Consul DNS Forwarding Guide for more info.

This script has been tested on the following operating systems:

  • Ubuntu 16.04
  • Ubuntu 18.04

There is a good chance it will work on other flavors of Debian as well.

Quick start

To install Dnsmasq, use git to clone this repository at a specific tag (see the releases page for all available tags) and run the install-dnsmasq script:

git clone --branch <VERSION>

Note: by default, the install-dnsmasq script assumes that a Consul agent is already running locally and connected to a Consul cluster. After the install completes, restart dnsmasq (e.g. sudo /etc/init.d/dnsmasq restart) and queries to the .consul domain will be resolved via Consul:

dig foo.service.consul

We recommend running the install-dnsmasq script as part of a Packer template to create a Google Image (see the consul-image example for sample code).

Command line Arguments

The install-dnsmasq script accepts the following arguments:

  • consul-domain DOMAIN: The domain name to point to Consul. Optional. Default: consul.
  • consul-ip IP: The IP address to use for Consul. Optional. Default: This assumes a Consul agent is running locally and connected to a Consul cluster.
  • consul-dns-port PORT: The port Consul uses for DNS requests. Optional. Default: 8600.




Add the +trace argument to dig commands to more clearly see what's going on:

dig vault.service.consul +trace
You can’t perform that action at this time.