Puppet module for deploying the swiss-army of DNS, Unbound
Ruby Puppet HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Puppet powered DNS with Unbound

Puppet Forge Build Status

A puppet module for the Unbound caching resolver.

Supported Platforms

  • Debian
  • FreeBSD
  • OpenBSD
  • OS X (macports)
  • RHEL clones (with EPEL)
  • openSUSE (local repo or obs://server:dns)


To use this moudule, you must be running at least Puppet 4.4. If you are on an older version of Puppet, please use a 1.x version of this module.

To use this module, you must install the puppetlabs/concat and puppetlabs/stdlib modules, either from the forge using puppet module install, or ensuring the following lines are present in your Puppetfile for an R10k deployment.

mod 'concat', :git => 'git://github.com/puppetlabs/puppetlabs-concat.git'
mod 'stdlib', :git => 'git://github.com/puppetlabs/puppetlabs-stdlib.git'


Server Setup

At minimum you should setup the interfaces to listen on and allow access to a few subnets. This will tell unbound which interfaces to listen on, and which networks to allow queries from.

class { "unbound":
  interface => ["::0",""],
  access    => ["","::1"],

Or, using hiera

  - '::0'
  - ''
  - ''
  - '::1'

Stub Zones

These are zones for which you have an authoritative name server and want to direct queries.

unbound::stub { "lan.example.com":
  address  => '',
  insecure => true,

unbound::stub { "0.0.10.in-addr.arpa.":
  address  => '',
  insecure => true,

# port can be specified
unbound::stub { "0.0.10.in-addr.arpa.":
  address  => '',
  insecure => true,

# address can be an array.
# in the following case, generated conf would be as follows:
#   stub-host: ns1.example.com
#   stub-addr:
#   stub-host: ns2.example.com
# note that conf will be generated in the same order provided.
unbound::stub { "10.0.10.in-addr.arpa.":
  address => [ 'ns1.example.com', '', 'ns2.example.com' ],

Or, using hiera

      - 'ns1.example.com'
      - ''
      - 'ns2.example.com'

Unless you have DNSSEC for your private zones, they are considered insecure, noted by insecure => true.

Static DNS records

For overriding DNS record in zone.

unbound::record { 'test.example.tld':
    type    => 'A',
    content => '',
    ttl     => '14400',

Or, using hiera

    type: 'A'
    content: ''
    ttl: '14400'

Forward Zones

Setup a forward zone with a list of address from which you should resolve queries. You can configure a forward zone with something like the following:

unbound::forward { '.':
  address => [

Or, using hiera

      - ''
      - ''

This means that your server will use the Google DNS servers for any zones that it doesn't know how to reach and cache the result.

Fine grain access-control

class { "unbound":
  interface => ["::0",""],
  access    => ["", " reject", "::1 allow_snoop"],

The access option allows to pass the action for each subnets, if the action is not provided we assume it’s 'allow'.

Adding arbitrary unbound configuration parameters

class { "unbound":
  interface          => ["::0",""],
  access             => ["","::1"],
  custom_server_conf => [ 'include: "/etc/unbound/conf.d/*.conf"' ],

The custom_server_conf option allows the addition of arbitrary configuration parameters to your server configuration. It expects an array, and each element gets added to the configuration file on a separate line. In the example above, we instruct Unbound to load other configuration files from a subdirectory.

Remote Control

The Unbound remote controls the use of the unbound-control utility to issue commands to the Unbound daemon process.

class { "unbound::remote":
  enable => true,

On some platforms this is needed to function correctly for things like service reloads.

Skipping hints download

In the case you're only building a caching forwarder and don't do iterative lookups you might not want to download the hints file containing the root nameservers because you don't need it, or you also might not be able to download it anyway because your server is firewalled which would cause the module would hang on trying to download the hints file. To skip the download set the skip_roothints_download parameter to true.

class { "unbound":
  skip_roothints_download => true,

More information

You can find more information about Unbound and its configuration items at unbound.net.


Please help me make this module awesome! Send pull requests and file issues.