{"id":15051173,"url":"https://github.com/example42/puppet-network","last_synced_at":"2025-10-04T14:32:05.092Z","repository":{"id":11932804,"uuid":"14501799","full_name":"example42/puppet-network","owner":"example42","description":"Puppet module to manage networking on Suse, Debian and RedHat. ","archived":true,"fork":false,"pushed_at":"2021-11-11T14:53:59.000Z","size":598,"stargazers_count":31,"open_issues_count":18,"forks_count":165,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-05-18T18:45:58.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Puppet","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/example42.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-18T18:55:14.000Z","updated_at":"2023-08-25T19:39:35.000Z","dependencies_parsed_at":"2022-09-02T14:10:45.296Z","dependency_job_id":null,"html_url":"https://github.com/example42/puppet-network","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/example42%2Fpuppet-network","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/example42%2Fpuppet-network/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/example42%2Fpuppet-network/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/example42%2Fpuppet-network/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/example42","download_url":"https://codeload.github.com/example42/puppet-network/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235264955,"owners_count":18962455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T21:31:27.079Z","updated_at":"2025-10-04T14:31:59.813Z","avatar_url":"https://github.com/example42.png","language":"Puppet","funding_links":[],"categories":[],"sub_categories":[],"readme":"# network\n\nThis module has been deprecated. You can use https://github.com/voxpupuli/puppet-network as alternative.\n\n[![Build Status](https://travis-ci.org/example42/puppet-network.png?branch=master)](https://travis-ci.org/example42/puppet-network)\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Module Description](#module-description)\n3. [Setup](#setup)\n    * [Resources managed by network module](#resources-managed-by-network-module)\n    * [Setup requirements](#setup-requirements)\n    * [Beginning with module network](#beginning-with-module-network)\n4. [Usage](#usage)\n5. [Hiera examples](#hiera-examples)\n6. [Operating Systems Support](#operating-systems-support)\n7. [Development](#development)\n\n## Overview\n\nThis module configures networking on Linux and Solaris. It manages network parameters, interfaces, routes,\nrules and routing tables.\n\n## Module Description\n\nMain class is used as entrypoint for general variables.\n \nIt manages hostname configuration and has hiera hash lookups to generate the following, provided, resources:\n\n- network::interface - Define to manage network interfaces\n- network::route - Define to manage network routes\n- network::mroute - Define to manage network routes - Alternative with easier management of multiple routes per interface\n- network::routing_table - Define to manage iproute2 routing tables\n- network::rule - Define to manage network rules\n\n## Setup\n\n### Setup Requirements\n* PuppetLabs [stdlib module](https://github.com/puppetlabs/puppetlabs-stdlib)\n* PuppetLabs [concat module](https://github.com/puppetlabs/puppetlabs-concat)\n* Puppet version \u003e= 3.0.0 \u003c 7.0.0\n* Facter version \u003e= 1.6.2\n\n### Beginning with module network\n\nThe main class arguments can be provided either via Hiera (from Puppet 3.x) or direct parameters:\n\n        class { 'network':\n          parameter =\u003e value,\n        }\n\n\nThe module provides a generic network::conf define to manage any file in the config_dir_path which is:\n\n  On 'Debian' osfamily: '/etc/network',\n\n  On 'Redhat' osfamily: '/etc/sysconfig/network-scripts',\n\n  On 'Suse' osfamily: '/etc/sysconfig/network',\n\n        network::conf { 'if-up.d/my_script':\n          template =\u003e 'site/network/my_script',\n        }\n\nThe module provides a cross OS compliant define to manage single interfaces: network::interface\n\nIMPORTANT NOTICE: On Debian if you use network::interface once you must provide ALL the network::interface defines for all your interfaces. It requires separate declarations for each IP stack on each interface.\nPlease keep in mind Debian and RedHat do not share the same approach in IPv4 / IPv6 management and thus require different hash structures.\n\nTo configure a dhcp interface\n\n        network::interface { 'eth0':\n          enable_dhcp =\u003e true,\n        }\n\nTo configure a static interface with basic parameters\n\n        network::interface { 'eth1':\n          ipaddress =\u003e '10.42.42.50',\n          netmask   =\u003e '255.255.255.0',\n        }\n\n\n## Generic interface parameters configation examples\n\nYou have different possible approaches in the usage of this module. Use the one you prefer.\n\n* Just use the network::interface defines:\n\n        network::interface { 'eth0':\n          enable_dhcp =\u003e true,\n        }\n\n        network::interface { 'eth1':\n          ipaddress =\u003e '10.42.42.50',\n          netmask   =\u003e '255.255.255.0',\n        }\n\n* Use the main network class and the interfaces_hash to configure all the interfaces \n\n        class { 'network':\n          interfaces_hash =\u003e {\n            'eth0' =\u003e {\n              enable_dhcp =\u003e true,\n            },\n            'eth1' =\u003e {\n              ipaddress =\u003e '10.42.42.50',\n              netmask   =\u003e '255.255.255.0',\n            },\n          },\n        }\n\nSame information as Hiera data in yaml format:\n\n        network::interfaces_hash:\n          eth0:\n            enable_dhcp: true\n          eth1:\n            ipaddress: '10.42.42.50'\n            netmask: '255.255.255.0'\n\n* Use the main network class and the usual stdmod parameters to manage the (main) network configuration file\n\n  On 'Debian' osfamily: '/etc/network/interfaces',\n\n  On 'Redhat' osfamily: '/etc/sysconfig/network-scripts/ifcfg-eth0' # Yes, quite opinionated, you can change it with config_file_path.\n\n  On 'Suse' osfamily: '/etc/sysconfig/network/ifcfg-eth0'\n\n        class { 'network':\n          config_file_template =\u003e 'site/network/network.conf.erb',\n        }\n\n* Manage the whole configuration directory\n\n        class { 'network':\n          config_dir_source  =\u003e 'puppet:///modules/site/network/conf/',\n        }\n\n* DO NOT automatically restart the network service after configuration changes (either via the main network class or via network::interfaces)\n\n        class { 'network':\n          config_file_notify =\u003e '',\n        }\n\n\n* The network::interface exposes, and uses in the default templates, network configuration parameters available on Debian (most), RedHat (some), Suse (most) so it's flexible, easily expandable and should adapt to any need, but you may still want to provide a custom template with:\n\n        network::interface { 'eth0':\n          enable_dhcp =\u003e true,\n          template    =\u003e \"site/network/interface/${::osfamily}.erb\",\n        }\n\n## Network routes management examples\n\n* The network::route can be used to define static routes on Debian and RedHat systems. The following example manages a static route on eth0\n\n        network::route { 'eth0':\n          ipaddress =\u003e [ '192.168.17.0', ],\n          netmask   =\u003e [ '255.255.255.0', ],\n          gateway   =\u003e [ '192.168.17.250', ],\n        }\n\n  On 'Debian' osfamily: it will create 2 files: '/etc/network/if-up.d/z90-route-eth0' and '/etc/network/if-down.d/z90-route-eth0',\n\n  On 'RedHat' osfamily: it will create the file '/etc/sysconfig/network-scripts/route-eth0'\n\n  You can provide to the main network class the routes_hash parameter to manage all your routes via a hash.\n\n* This example add 2 static routes on the interface bond2\n\n        network::route { 'bond2':\n          ipaddress =\u003e [ '192.168.2.0', '10.0.0.0', ],\n          netmask   =\u003e [ '255.255.255.0', '255.0.0.0', ],\n          gateway   =\u003e [ '192.168.1.1', '10.0.0.1', ],\n        }\n\n* To configure the default route on Suse, use the routes_hash parameter, like in the following example:\n\n        class { 'network':\n          routes_hash =\u003e {\n            'eth0' =\u003e {\n              ipaddress   =\u003e [ 'default', ],\n              gateway     =\u003e [ '192.168.0.1', ],\n              netmask     =\u003e [ '-', ],\n              interface   =\u003e 'eth0',\n            }\n          }\n        }\n\n* An alternative way to manage routes is using the network::mroute define, which expects a hash of one or more routes where you specify the network and the gateway (either as ip or device name):\n\n        network::mroute { 'bond2':\n          routes =\u003e {\n            '192.168.2.0/24' =\u003e '192.168.1.1',\n            '10.0.0.0/8'     =\u003e '10.0.0.1',\n            '80.81.82.0/16'  =\u003e 'bond0',\n          }\n        }\n\n* The network::routing_table and network::rule classes can be used to configure ip rules and routing tables. Make sure to define a routing table before using it, like in this example:\n\n        network::routing_table { 'vlan22':\n          table_id =\u003e '200',\n        }\n\n        network::rule { 'eth0':\n          iprule =\u003e ['from 192.168.22.0/24 lookup vlan22', ],\n        }\n\nWhen using RHEL or similiar with NetworkManager the resource isn't supported as NetworkManager won't respect those files. Instead you can add the iprule to the interface resource. Also NetworkManager won't recognize name schemes for routing tables. Use the numeric value instead:\n\n        network::interface { 'eth0':\n          ipaddress =\u003e '10.42.42.50',\n          netmask   =\u003e '255.255.255.0',\n          iprule    =\u003e ['from 192.168.22.0/24 lookup 22', ],\n        }\n\nYou can then add routes to this routing table:\n\n       network::route { 'eth1':\n         ipaddress =\u003e [ '192.168.22.0', ],\n         netmask   =\u003e [ '255.255.255.0', ],\n         gateway   =\u003e [ '192.168.22.1', ],\n         table     =\u003e [ 'vlan22' ],\n       }\n\nIf adding routes to a routing table on an interface with multiple routes, it\nis necessary to specify false or 'main' for the table on the other routes.\nThe 'main' routing table is where routes are added by default. E.g. this:\n\n       network::route { 'bond0':\n         ipaddress =\u003e [ '192.168.2.0', '10.0.0.0', ]\n         netmask   =\u003e [ '255.255.255.0', '255.0.0.0', ],\n         gateway   =\u003e [ '192.168.1.1', '10.0.0.1', ],\n       }\n\n       network::route { 'bond0':\n         ipaddress =\u003e [ '192.168.3.0', ],\n         netmask   =\u003e [ '255.255.255.0', ],\n         gateway   =\u003e [ '192.168.3.1', ],\n         table     =\u003e [ 'vlan22' ],\n       }\n\nwould need to become:\n\n       network::route { 'bond0':\n         ipaddress =\u003e [ '192.168.2.0', '10.0.0.0', '192.168.3.0', ]\n         netmask   =\u003e [ '255.255.255.0', '255.0.0.0', '255.255.255.0', ],\n         gateway   =\u003e [ '192.168.1.1', '10.0.0.1', '192.168.3.1', ],\n         table     =\u003e [ false, false, 'vlan22' ],\n       }\n\nThe same applies if adding scope, source or gateway, i.e. false needs to be\nspecified for those routes without values for those parameters, if defining\nmultiple routes for the same interface.\n\nThe following definition:\n\n       network::route { 'bond2':\n         ipaddress =\u003e [ '0.0.0.0', '192.168.3.0' ]\n         netmask   =\u003e [ '0.0.0.0', '255.255.255.0' ],\n         gateway   =\u003e [ '192.168.3.1', false ],\n         scope     =\u003e [ false, 'link', ],\n         source    =\u003e [ false, '192.168.3.10', ],\n         table     =\u003e [ 'vlan22' 'vlan22', ],\n       }\n\nyields the following routes in table vlan22:\n\n       # ip route show table vlan22\n       default via 192.168.3.1 dev bond2\n       192.168.3.0/255.255.255.0 dev bond2 scope link src 192.168.3.10\n\nNormally the link level routing (192.168.3.0/255.255.255.0) is added\nautomatically by the kernel when an interface is brought up. When using routing\nrules and routing tables, this does not happen, so this route must be added\nmanually.\n\n\n## Hiera examples\n\nHere are some examples of usage via Hiera (with yaml backend).\n\nMain class settings:\n\n    network::hostname: 'web01'\n    network::gateway: 192.168.0.1 # Default gateway (on RHEL systems)\n    network::hiera_merge: true # Use hiera_hash() instead of hiera() to resolve the values for the following hashes\n\nConfiguration of interfaces (check ```network::interface``` for all the available params.\n\nSingle interface via dhcp:\n\n    network::interfaces_hash:\n      eth0:\n        enable_dhcp: true\n\nBond interface:\n\n    eth0:\n      method: manual\n      bond_master: 'bond3'\n      allow_hotplug: 'eth0'\n      manage_order: '08'\n    eth1:\n      method: manual\n      bond_master: 'bond3'\n      allow_hotplug: 'eth1'\n      manage_order: '08'\n    bond3:\n      ipaddress: \"10.0.28.10\"\n      netmask: '255.255.248.0'\n      gateway: \"10.0.24.1\"\n      dns_nameservers: \"8.8.8.8 8.8.4.4\"\n      dns_search: 'my.domain'\n      bond_mode: 'balance-alb'\n      bond_miimon: '100'\n      bond_slaves: []\n\nDebian/Ubuntu IPv4/IPv6 management example for basic IP config, IP aliaseconfig and VLAN config :\n\n    'eth0:0v4':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '1'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'interface':       'eth0:0'\n       'ipaddress':       'X.X.X.X/22'\n       'family':          'inet'\n\n    'eth0:0v6':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '1'\n       'autoconf':        '0'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'interface':       'eth0:0'\n       'ipaddress':       'X.X.X.1::85/64'\n       'family':          'inet6'\n    \n    'eth1v4':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '0'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'interface':       'eth1'\n       'ipaddress':       'X.X.X.1/29'\n       'family':          'inet'\n    \n    'eth1v6':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '0'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'interface':       'eth1'\n       'ipaddress':       'X.X.X.1:bb:43::2/64'\n       'family':          'inet6'\n    \n    'eth1.12v4':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '1'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'vlan':            'yes'\n       'interface':       'eth1.12'\n       'ipaddress':       'X.X.X.1/29'\n       'family':          'inet'\n    \n    'eth1.12v6':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '1'\n       'autoconf':        '0'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'vlan':            'yes'\n       'interface':       'eth1.12'\n       'ipaddress':       'X.X.X.1:dd:3::2/64'\n       'family':          'inet6'\n    \n    'eth0v4':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '1'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'dns_nameservers': 'X.X.X.1 X.X.X.1 X.X.X.1'\n       'interface':       'eth0'\n       'ipaddress':       'X.X.X.X/22'\n       'gateway':         'X.X.X.1'\n       'family':          'inet'\n    \n    'eth0v6':\n       'enable':          'true'\n       'bootproto':       'none'\n       'peerdns':         'no'\n       'userctl':         'no'\n       'restart_all_nic': 'false'\n       'accept_ra':       '1'\n       'autoconf':        '0'\n       'type':            'Ethernet'\n       'mtu':             '1500'\n       'interface':       'eth0'\n       'ipaddress':       'X.X.X.1::85/64'\n       'gateway':         'X.X.X.1::1'\n       'family':          'inet6'\n\nConfiguration of multiple static routes (using the ```network::route``` define, when more than one route is added the elements of the arrays have to be ordered coherently):\n\n    network::routes_hash:\n      eth0:\n        ipaddress:\n          - 99.99.228.0\n          - 100.100.244.0\n        netmask:\n          - 255.255.255.0\n          - 255.255.252.0\n        gateway:\n          - 192.168.0.1\n          - 174.136.107.1\n\n\nConfiguration of multiple static routes (using the newer ```network::mroute``` define) you can specify as gateway either a device or an IP or also add a table reference:\n\n    network::mroutes_hash:\n      eth0:\n        routes:\n          99.99.228.0/24: eth0\n          100.100.244.0/22: 174.136.107.1\n          101.99.228.0/24: 'eth0 table 1'\n\n\n## Operating Systems Support\n\nThis is tested on these OS:\n\n- RedHat / CentOS / OracleLinux\n  - 5\n  - 6\n  - 7\n  - 8\n- Debian\n  - 6\n  - 7\n  - 8\n- Ubuntu\n  - 10.04\n  - 12.04\n  - 14.04\n  - partly verified on Ubuntu 16.04\n- Suse (ifrule files are only supported on Suse with wicked \u003e= 0.6.33)\n  - OpenSuse 12\n  - SLES 11SP3\n  - SLES 12SP1\n  - SLES 15\n\n\n## Development\n\nPull requests (PR) and bug reports via GitHub are welcomed.\n\nWhen submitting PR please follow these quidelines:\n- Provide puppet-lint compliant code\n- If possible provide rspec tests\n- Follow the module style and stdmod naming standards\n\nWhen submitting bug report please include or link:\n- The Puppet code that triggers the error\n- The output of facter on the system where you try it\n- All the relevant error logs\n- Any other information useful to understand the context\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexample42%2Fpuppet-network","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexample42%2Fpuppet-network","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexample42%2Fpuppet-network/lists"}