Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


network_interfaces_v2 (13) Versions 2.8.0

Providers for configuring network on Ubuntu, RHEL, and Windows

cookbook 'network_interfaces_v2', '= 2.8.0'
cookbook 'network_interfaces_v2', '= 2.8.0', :supermarket
knife supermarket install network_interfaces_v2
knife supermarket download network_interfaces_v2
Quality -%

Cookbook network_interfaces_v2

Build Status

A cookbook containing providers for defining network interfaces.

Supported Platforms

  • RHEL 6.x
  • RHEL 7.x
  • Ubuntu >= 12.x
  • Windows 2012R2


These operating systems are not currently being tested on but have been confirmed by other users to be working.

  • RHEL 7.x
  • Windows 2008R2
    • Works if PowerShell/WMF 4.0 is present, which can be installed via network_interfaces_v2::powershell_installer recipe


Add depends 'network_interfaces_v2' to your cookbook metadata.rb file. This will give you access to the providers documented below.



Does nothing and does not need to be included.


Installs WMF 4.0 for Windows 2008 R2 which is a prereq for this cookbook's providers to work on Windows 2008 R2.


Provider for managing network interfaces.


  • device (REQUIRED) - Device name
  • onboot (default: true) - Wether or not to online device on boot
  • bootproto (default: 'dhcp') - Device protocol
  • bond_mode - Bonding mode
  • address - IP address
  • netmask - Netmask
  • gateway - Gateway IP address
  • broadcast - Broadcast address
  • mtu - MTU
  • hw_address - For linux it sets MAC address of device, for windows it selects device matching MAC to configure
  • vlan
    • debian - VLAN device interface
    • RHEL - true/false if device defined is a VLAN interface
    • Win - Integer VlanID to tag to defined device
  • post_up - Post up command to run after modifying the interface
  • reload (default: true) - Wether or not to reload the device on config changes
  • reload_type (default: :immediately) - When to reload device on config changes
  • cookbook (default: 'network_interfaces_v2') - Cookbook to look for template files in
  • source (default: 'ifcfg.erb') - Template file to use for interface config

Debian Only Attributes

  • ipv6 (true/false) - Wether this is an inet or inet6 network interface.
  • bridge_stp (true/false) - Wether to enable/disable bridge STP. Applies to debian only.
  • bridge_ports - Array of interfaces to add to defined bridge
  • metric -
  • bond_slaves - Array of interfaces to add to defined bond
  • pre_up (default: 'sleep 2')- Pre up command
  • up - Up command
  • post_up - Post up command
  • pre_down - Pre down command
  • down - Down command
  • post_down - Post down command
  • custom - Hash of extra attributes to put in device config

RHEL Only Attributes

  • prefix - Netmask length (e.g. 24 for
  • dns - Array of DNS servers
  • type - Protocol Type. Applies to RHEL only.
  • bond_master - Device that is the bond master for defined device. Applies to RHEL only.
  • nm_controlled (default: false)- If device should be controlled by network manager.
  • type (default: 'Ethernet') -
  • ipv6init - true/false
  • nozeroconf - true/false
  • userctl - true/false
  • peerdns - true/false
  • bridge_device - Bridge to add defined interface to
  • devicetype - Set the type of device (e.g. 'ovs')
  • ovs_bridge - OVS Bridge to bind ovs port to (primarily used when type is set as 'OVSPort')
  • dns_domain - DNS domain
  • zone - FirewallD zone
  • arpcheck - Whether to arping before bringing up an ethernet device to check for an IP conflict (default: true)
  • hotplug - Activate devices on hotplug (default: true)

Windows Only Attributes

  • hw_address - Can be used to define what device to manage
  • index - Can be used to define what device to manage
  • dns - Array of DNS servers
  • dns_domain - DNS domain
  • ddns - true/false dynamic dns registration
  • netbios - Enable/Disable netbios on the interface. Valid values: true, false, 'dhcp'


Long name Short name
Chef::Provider::NetworkInterface::Rhel rhel_network_interface
Chef::Provider::NetworkInterface::Debian debian_network_interface
Chef::Provider::NetworkInterface::Win win_network_interface


Basic example: ruby network_interface 'eth1' do bootproto 'static' address '' netmask '' gateway '' end

Two interface DHCP bond0 on rhel family ```ruby network_interface 'eth1' do bootproto 'none' bond_master 'bond0' end

network_interface 'eth2' do bootproto 'none' bond_master 'bond0' end

network_interface 'bond0' do bond_mode 'mode=1 miimon=100' end ```

Two interface DHCP bond0 on debian family ```ruby network_interface 'bond0' do bond_slaves ['eth1', 'eth2'] bond_mode '0' end

network_interface 'eth1' do bootproto 'manual' bond_master 'bond0' end

network_interface 'eth2' do bootproto 'manual' bond_master 'bond0' end ```

On windows manage device with MAC '00-25-B5-5B-00-25', name it 'eth2', make it DHCP (default bootproto) and VLAN tagged to VLAN 12 ruby network_interface 'eth2' do hw_address '00-25-B5-5B-00-25' vlan 12 end


Requires ChefDK 0.12.0.

foodcritic -f any -X spec .
rspec --color --format progress
kitchen test

License and Authors

Author:: Jacob McCann (

Based on work from

Copyright:: 2015, Target Corporation

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

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.


  • Add hw_address support for debian


  • Add ipv6 support for debian


  • Add management of debian DNS
  • Add management of RHEL firewalld zones


  • Fix RHEL configs from on/off to yes/no


  • Add powershell installer for Windows 2008 R2 to allow cookbook to work


  • bug: Fix win_interface to be able to manage interfae via index
  • bug: Enable static on win_interface when DHCP with matching ip/subnet (#13)


  • Add dns_domain attribute to network_interface for RHEL


  • Add ovs_bridge attribtue to network_interface for RHEL


  • Add dns attribute to network_interface for RHEL
  • Add devicetype attribute to network_interface for RHEL
  • Add prefix attribute to network_interface for RHEL


  • Add supported platforms to metadata.rb
  • Update gem source for integration testing to https from http


  • Update how to determine when to specify provides in providers


  • Remove dependency on ruby-wmi gem


  • Fix handling DNS for windows VLAN devices


  • Fix providers not triggering notifications
  • No longer manage removal of 'extra' network config files in debian
  • Add ability to enable/disable NetBIOS on windows interfaces


  • Add running post scripts on interface config to all platforms
  • On windows release DHCP address when configuring static from DHCP
  • Update logic for configuring static address
    • Update if address or netmask are missing or incorrect
    • Add IP to 'front' of array of addresses ... keep any extra addresses that may have been configured outside of Chef
    • I've heard this can happen from things like MSFT products/services being added to a system ... like clustering


Initial release of network_interfaces_v2

No quality metric results found