gai
Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 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
Add this module to your Puppetfile:
mod 'stm-gai', '3.0.0'
Learn more about managing modules with a PuppetfileDocumentation
gai
Table of Contents
- Overview
- Module Description - What does the module do?
- Setup - The basics of getting started with gai
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- 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.
Reference
Table of Contents
Classes
gai
: Manage /etc/gai.confgai::preferipv4
: Define precedence table in /etc/gai.conf to prefer IPv4
Classes
gai
init.pp --- Class gai
Examples
Declaring the class
class { 'gai': }
Parameters
The following parameters are available in the gai
class:
label
Data type: Hash[String,String]
A hash with netmask/precedence pairs for the label table.
Default value: {}
precedence
Data type: Hash[String,String]
A hash with netmask/precedence pairs for the precedence table.
Default value: {}
scopev4
Data type: Hash[String,String]
A hash with mask/value pairs for the scope table.
Default value: {}
reload
Data type: Optional[Enum['yes','no']]
Indicate if the config should be reloaded for every loopkup. Valid options: 'yes', 'no' or undefined. Default: undef
Default value: undef
gai::preferipv4
preferipv4.pp --- Class gai::preferipv4
Examples
Declaring the class
include puppet-gai::preferipv4
2023-07-07 - Release 3.0.0
Enhancements
- Add support for Puppet 8.
Breaking changes
- Remove support for Puppet 6.
2023-06-09 - Release 2.3.0
Enhancements
- Drop dependency on Stdlib module
2021-08-30 - Release 2.2.0
Enhancements
- Add support for Stdlib 8.x.
2021-03-27 - Release 2.1.0
Enhancements
- Add support for Puppet 7.
- Add support for Stdlib 7.x.
2020-06-22 - Release 2.0.0
Breaking changes
- Remove support for Puppet 4.
Enhancements
- Add support for Puppet 6.
- Add support for Stdlib 6.x.
2019-02-19 - Release 1.2.0
Summary
Updated to PDK 1.9.0 and added support for Puppet Release 6. No functional changes have been made.
2018-09-26 - Release 1.1.0
Summary
This minor release has been updated to PDK 1.7.0 and increases the maximum compatible version of stdlib from 5.0.0
to 6.0.0
. No functional changes have been made.
2018-07-22 - Release 1.0.0
Summary
This release is a complete rewrite of the module.
Breaking changes
- The module now uses data types to validate input parameters and therefore no longer works with Puppet 3.
2018-02-04 - Release 0.2.1
Summary
The version requirements have been updated. RuboCop is used to check the test code. No functional changes were introduced.
2016-05-09 - Release 0.2.0
Summary
A small release with better validations, more tests and a metadata update to fix the dependency specification.
Features
- Improved validation of class parameters.
2015-10-12 - Release 0.1.0
Summary
Initial release.
Copyright (c) 2015, Stefan Möding All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.