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.1.1

Providers for configuring network on Ubuntu, RHEL, and Windows

cookbook 'network_interfaces_v2', '= 2.1.1'
cookbook 'network_interfaces_v2', '= 2.1.1', :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
  • Ubuntu >= 12.x
  • Windows 2012R2


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.


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 - MAC address of device 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

  • 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

  • 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

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


bundle exec rubocop
bundle exec foodcritic -f any -X spec .
bundle exec rspec --color --format progress
bundle exec 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.


  • 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