Forge Home

gai

Manage the configuration of the default address selection for IPv6.

25,630 downloads

247 latest version

4.7 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 3.0.0 (latest)
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.0
  • 1.2.0
  • 1.1.0
  • 1.0.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Jul 7th 2023
This version is compatible with:
  • Puppet Enterprise 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
  • Puppet >= 7.0.0 < 9.0.0
  • Debian, Ubuntu, RedHat, CentOS, Fedora, OracleLinux, SLES, Scientific

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'stm-gai', '3.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add stm-gai
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install stm-gai --version 3.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: dns, ipv6, ipv4

Documentation

stm/gai — version 3.0.0 Jul 7th 2023

gai

Build Status Puppet Forge License

Table of Contents

  1. Overview
  2. Module Description - What does the module do?
  3. Setup - The basics of getting started with gai
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

Manage the configuration of the default address selection for IPv6 in /etc/gai.conf.

Module description

RFC 3484 provides an algorithm to sort the result of a call to getaddrinfo(3) when multiple answers are returned. Especially for hosts connected to an IPv4 and an IPv6 network it might be necessary to modify these static rules. For Linux using the glibc implementation this can be done with the /etc/gai.conf configuration file. This module provides a way to manage this file in your environment.

Setup

What gai affects

The module creates and modifies the /etc/gai.conf file. The settings in this file can affect the order in which network addresses are used when connecting to a remote host. See RFC 3484 for details.

Beginning with gai

Declare the gai class to install an configuration file containing comments only. In this case the operating system enforces the default rules. RFC 3484 has the details.

class { 'gai': }

Usage

Modify the precedence rules to prefer IPv4 addresses

The class parameter precedence takes a hash where the keys are netmasks and the associated values define the order in which these netmasks are checked. The following example shows a setup where IPv4 addresses are preferred when the destination host also has an IPv6 address.

class { 'gai':
  precedence => {
    '::/96'         => '20',
    '2002::/16'     => '30',
    '::/0'          => '40',
    '::1/128'       => '50',
    '::ffff:0:0/96' => '100',
  }
}

There is also a builtin class that can be used as a shortcut for this configuration.

class { 'gai::preferipv4': }

Reference

Classes

Public Classes

  • gai: The main class which installs the /etc/gai.conf file.

  • gai::preferipv4: Installs a predefined set of preference rules that cause the system to prefer IPv4 addresses.

Class: gai

The main class to manage the /etc/gai.conf file.

Parameters (all optional)
  • label: A hash with netmask/precedence pairs for the label table. The precedence value should be an integer. It is used to define the order of evaluation.

  • precedence: A hash with netmask/precedence pairs for the precedence table. Again the precedence value should be an integer defining the order of evaluation.

  • scopev4: A hash with mask/value pairs for the scope table. Entries are added to the RFC 3484 scope table.

  • reload: Indicate if the config should be reloaded for every lookup. Valid options: 'yes', 'no' or undefined (which doesn't set any value in the file). Default: undef

Class: gai::preferipv4

The class can be used as a shortcut to install a configuration where IPv4 addresses are prefered over IPv6 addresses.

Limitations

This module is only useful on systems using glibc and the /etc/gai.conf file. It is therefore probably limited to Linux only.

Development

Feel free to send pull requests for new features. Documentation updates with real world configurations are especially appreciated.