debnet
Version information
This version is compatible with:
- Puppet Enterprise 3.x
- Puppet >=2.7.0 <5.0.0
- ,
Start using this module
Add this module to your Puppetfile:
mod 'trepasi-debnet', '1.5.2'
Learn more about managing modules with a PuppetfileDocumentation
debnet
####Table of Contents
- Overview
- Module Description - What the module does
- Setup - Basic usage of module debnet
- Advanced configuration methods
- Feature helpers
- Auxiliary support
##Overview
This module constructs the /etc/network/interfaces
file on Debian based
Linux distributions and enables an easy configuration of sophisticated
network setups, such as bridges and bonding configurations.
##Module Description
This module lets you use many debnet::iface
resourses for setting up
network interfaces.
##Setup
Declaring a single resource of this module will cause debnet to take control
over the file /etc/network/interfaces
which than will contain stanzas
generated by the module only. Every declaration of debnet::iface
resources will create a corresponding stanza in /etc/network/interfaces
.
###Beginning with the module To start with the debnet module the node can simply declare resources. Many nodes need at least a loopback interface which might look like:
debnet::iface::loopback { 'lo': }
Many other declaration may follow. Each of which will create an interface
configuration. There are specialized resources available for many kind of
configuration tasks, however, you may also use the simple debnet::iface
resource to create generic interface stanzas. Be aware, that the specialized
resources do some more validation, which makes the configuration less error
prone.
###Available configuration methods
The resource debnet::iface
implements different configuration methods
also available for the interfaces(5) stanzas. Currently supported methods
are:
- loopback
- static
- dhcp
- manual
- wvdial
###Configuring the loopback interface Currently there is only a single way to create a configuration on the loopback interface.
debnet::iface::loopback { 'lo': }
###Static IPv4 interface configuration For a static IP configuration the attributes address and netmask are mandatory. Attributes broadcast, gateway, pointopoint, hwaddress, mtu and scope are optional.
debnet::iface::static { 'eth0':
address => '192.168.0.10',
netmask => 24,
gateway => '192.168.0.1',
}
Available attributes:
ifname
- (string) iface name (default:title
)address
- (dotted-quad) static address (mandatory)netmask
- (int or dotted-quad) netmask (mandatory)broadcast
- (dotted-quad) broadcast address (optional)metric
- (int) metric for routing protocolsgateway
- (dotted-quad) gateway to set default routepointopoint
- (dotted-quad) point-to-point addresshwaddress
- (macaddress) hardware address to override withmtu
- (int) interface MTUscope
- (string) address scope
###DHCP configuration Configuring an interface by dhcp is enabled through method set to according. Optional attributes hostname, metric, leasetime, vendor, client and hwaddress may be set.
debnet::iface::dhcp { 'eth0': }
Available attributes:
ifname
- (string) iface name (default:$title
)metric
- (int) metric for routing protocolshwaddress
- (macaddress) hardware address to override with (optional)hostname
- (string) hostname to send with DHCP REQUEST (optional)leasetime
- (int) leasetime to request (optional)vendor
- (string) vendor id to send with request (optional)client
- (string) client id to send with request (optional)
###Common attributes Many resource types have some common attributes. These are:
auto
- (bool) allow auto-bring-up interface (default: true)allows
- (array) allows-* features (default: [])family
- (string) only inet supported (default: inet)order
- (int) ordering of the resource (default: 0)
##Advanced configuration methods
The module also gives a convenient way to declare more sofisticated network
configurations like bonding of multiple interfaces or creating bridge devices.
To leaverage from these it is necessary to learn how raw configuration of
interfaces work by usage of debnet::iface
type resource. This will allow
the declaration of bonded interfaces through debnet::iface::bond
and
bridges through debnet::iface::bridge
.
###Raw interface configuration
Using the specialised resources is convenient but not feasable in some
circumstances. Therefore it might be necessery, however, to create
configurations using the debnet::iface
generic resource type.
The above examples can be alternatively configured by using debnet::iface
type as follows:
Loopback interface:
debnet::iface { 'lo':
method => 'loopback',
}
Static interface:
debnet::iface { 'eth0':
method => 'static',
address => '192.168.0.10',
netmask => 24,
gateway => '192.168.0.1',
}
DHCP configuration:
debnet::iface { 'eth0':
method => 'dhcp',
}
###Bridge configuration
Configuring a software bridge is enabled by declaring a resource of type
debnet::iface::bridge
. Mandatory attribute is the method of configuration
of the bridge interface. Depending on the method, the mandatory attributes of
the choosen method are also mandatory for the bridge resource. Optional
attributes are ports, stp, prio, fwdelay and hello.
To simply bridge two devices without bringing them up on layer-3, e.g.:
debnet::iface::bridge { 'br0':
ports => ['eth1','eth2'],
stp => true,
method => 'manual',
}
The debnet::iface::bridge
resource is defining interfaces for each port
of the bridge with manual configuration to inhibit multiple use of the same
interface.
Available attributes:
method
- (string) interface configuration method (mandatory)ifname
- (string) iface name (default:$title
)ports
- (array) ports to be added (default:[]
)stp
- (bool) enable IEEE 802.1d spanning tree protocol (default: false)prio
- (int) STP bridge priority (optional)fwdelay
- (int) forward delay (optional)hello
- (int) hello timing (optional)maxage
- (int) max BPDU age (optional)maxwait
- (int) max seconds to wait for ports to come up (optional)
###Bonding configuration The module allows to bond multiple interfaces together by configuring a linux bonding device.
The following example will bond devices eth1
and eth2
as
active-passive slaves of bond0
, and will bring up the layer-3 config with
static address and gateway settings.
debnet::iface::bond { 'bond0':
ports => ['eth1', 'eth2'],
method => 'static',
address => '192.168.0.10',
netmask => 24,
gateway => '192.168.0.1',
}
Supported bonding modes are: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.
Available attributes:
ports
- (array) slave interfaces (mandatory)mode
- (string) bonding mode (default: active-backup)miimon
- (int) mii monitor timing (default: 100)use_carrier
- (bool) enable carrier sense (default: true)updelay
- (int) setting the updelay timer (optional)downdelay
- (int) setting the downdelay timer (optional)
Such a configuration will create the interfaces(5) stanzas for many ports and the bonding device. The array in argument ports must have at least one item, and the first item will be configured as bond-primary.
###Using Up and down command hooks
In many resources of the module you may use attributes ups
, downs
,
pre-ups
and post-downs
declaring arrays of commands which will be
called on the specific events. By declaring the attribute aux_ops
with a
hash, it is possilble to add auxiliary options to the interface stanza, which
will be generated by using the key as option name and the value to the key as
value. This obviously has the limitation of having every option name ones,
however, the most important case this is useful, the up and down hooks can be
handled through ups
, downs
, pre-ups
and post-downs
attributes.
Many debnet resources allow to add commands to the usual up/down hooks. The attributes pre_ups, ups, downs and post_downs are available for many resources. Each of which are typed as array and many elements will be added in order as pre-up, up, down or post-down options, respectively. High care must be taken while using these attributes, since the module does not do any kind of checks.
debnet::iface::dhcp { 'eth0':
ups => ['echo "eth0 is up"'],
downs => ['echo "eth0 is going down"']
}
##Feature helpers The module provides feature helpers to enable sofisticated configuration features to be added easily.
###Queue length
If the setting of the txqueuelen feature of ethernet interfaces needs to done,
the attribute tx_queue
can be added to any resource type other than
loopback. The helper adds an up command to set the transmit queue of the
interface. In case of types bond and bridge, the up command is applied to the
corresponding slave interfaces.
debnet::iface::dhcp { 'eth0':
tx_queue => 50,
}
Available attributes:
tx_queue
- (int) length of the transmit queue (optional)
###Static routes
Static routes can be added to any resource type which is configuring layer-3 of
an interface. Declaring the routes
attribute as a hash which is mapping
gateway addresses (values) to specific destinations (keys). Destinations are
declared by a dotted-quad and prefix length, the gateway addresses must be
dotted-quads. Multiple routes may be declared. Many routes will be added as
up and down commands to the containing interface.
debnet::iface::static { 'eth0':
address => '192.168.0.10',
netmask => 24,
gateway => '192.168.0.1',
routes => {
'172.16.0.0/12' => '192.168.0.2',
'10.0.0.0/8' => '192.168.0.3',
},
}
Available attributes:
routes
- (hash) maps routes to their gateways (optional)
###DNS resolver settings
Many Debian installations make use of the resolvconf tools to setup the local
DNS resolver dynamically. Feature helpers dns_nameservers
and
dns_search
enables to add presets to be passed to resolvconf scripts when
an interface is brought up.
debnet::iface::static { 'eth0':
address => '192.168.0.10',
netmask => 24,
gateway => '192.168.0.1',
dns_search => ['example.org', 'example.com'],
dns_nameservers => ['192.168.0.2', '192.168.0.3'],
}
Available attributes:
dns_search
- (array) DNS search list (optional)dns_nameservers
- (array) DNS nameserver list (optional)
##Auxiliary support
###WVDial
Have a look to examples/support/wvdial.pp
for an example.
2016-01-07 - Release 1.5.2
##Summary Added some tests and bugfixes.
##Fixes
- debnet::iface::dhcp: bug with hostname feature fixed
- issue#7: validation of metadata.json fixed
##Features
- syntax validation and lint checks added
- added some spec tests
2015-12-21 - Release 1.5.1
##Summary Fixed dependency clash.
##Fixes
- dependecy to a deleted version of concat
- inconsistent dependencies to stdlib version
2015-12-20 - Release 1.5.0 [Deleted]
##Summary
##Fixes
- PR/4: Support for bootup configuration on interfaces enabled. (Thanks for the contribution to lbayerlein)
- PR/7: Support for wvdial. (Thanks to tentwentyfour)
- argument validation improved for Puppet 4 complience
##2015-04-04 - Release 1.4.3
##Summary CI build testing added.
##2015-03-31 - Release 1.4.2
###Fixes
- Typo in dns-nameservers fixed
##2015-03-30 - Release 1.4.1
##Summary New feature helper for configuring DNS nameservers and search via resolvconf.
##2015-03-16 - Release 1.3.1
###Summary Fixed issue #2
###Fixes
- bridge and bond resources were not able to access package names declared in params.pp
##2015-03-15 - Release 1.3.0
###Summary New feature helper allows declaring static routes on interfaces.
###Features
- feature helper of static routes added
##2015-03-12 - Release 1.2.1
###Summary
- Bugfix, to resolve dependency problems to newer versions of concat and stdlib modules.
###Features
- feature helper for static routes added
###Fixes
- Minor improvements in documentation
- Metadata fixed.
##2015-02-26 - Release 1.2.0
###Summary Introduction of feature helpers. Configurable bridge parameters extended.
###Features
- feature helper tx_queue added for setting tx queue length of an interface
- added attributes maxage and maxwait to bridge
##2015-02-05 - Release 1.1.1
###Summary Documentation bugfixes.
###Features
###Bugfixes
- requirements corrected
- README links fixed
##2015-02-04 - Release 1.1.0
###Summary Operating system support tested. Up and down hooks now available for many resources.
###Features
- support for Debian 6 and Ubuntu 12.04 added to metadata.json
- added support for up/down hooks to resources bond, bridge, dhcp, loopback and static
##2015-01-20 - Release 1.0.1
###Summary Bugfix.
###Changes
- Validation of bonding attributes fixed.
##2015-01-20 - Release 1.0.0
###Summary Added support for bonding and removed the need of including the module.
###Changes
- including the module is not necessary anymore
###Features
- support for bonding devices
##2014-12-27 - Release 0.3.1
###Summary Minor refactoring, documentation and metadata improvements.
####Fixes
- Metadata fixes to improve quality measures.
- Some lint warnings with bridge.pp fixed.
- Documentation fixed.
##2014-12-27 - Release 0.3.0
###Summary
New feature for configuring bridge interfaces.
Dependencies
- puppetlabs/concat (>= 1.2.0 < 3.0.0)
- puppetlabs/stdlib (>= 4.6.0 < 5.0.0)
Copyright 2016 T Repasi Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.