Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md Ubuntu 18.04 Support Jul 15, 2019
install-dnsmasq Switch from supervisord to systemd Mar 28, 2019

README.md

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, including trade-offs between using this module and systemd-resolved for DNS forwarding.

This script has been tested on the following operating systems:

  • Ubuntu 16.04
  • Amazon Linux 2

There is a good chance it will work on other flavors of Debian, CentOS, and RHEL 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> https://github.com/hashicorp/terraform-aws-consul.git
terraform-aws-consul/modules/install-dnsmasq/install-dnsmasq

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 an Amazon Machine Image (AMI) (see the consul-ami 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: 127.0.0.1. 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.

Example:

install-dnsmasq

Troubleshooting

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.