This module manages network interfaces without restarting the network
subsystem. It contains of two parts. One uses iproute2 tools and system files
placed in /sys/class/net
. The other manages files needed to restore the state
after OS boots.
- Ethernet:
/\A([[:alpha:]]*([[:alpha:]]\d+)+)\Z/
. Examples:enp0s1
,ens0f1
. - Bonding:
/\Abond\d+\Z/
. Examples:bond0
,bond1
. - Vlan:
/\Avlan(\d+)\Z/
,$1
- vlanid. Examples:vlan10
,vlan100
. - Loopback:
/\Alo\Z/
. Examples:lo
.
- Manages alias files only for ten ip addresses.
- Removes unspecified IP addresses of the network interface.
- Overwrites configuration files of the network interface.
- Can make your server unreachable.
Include this module and write hiera.
include ::network
---
network::network_manager::enable: false
network::network_manager::ensure: stopped
---
network::interfaces:
eth0:
mtu: 9000
eth1:
mtu: 9000
bond0:
bond_slaves:
- eth0
- eth1
mtu: 9000
valn100:
ipaddress:
- 10.0.0.1/24
- 172.16.0.1/24
mtu: 1500
parent: bond0
vlan110:
ipaddress:
- 192.168.255.1/24
mtu: 9000
parent: bond0
---
network::routes:
192.168.0.0/24:
device: vlan100
nexthop: 172.16.0.100
192.168.0.0/24 100:
device: vlan110
nexthop: 192.168.255.100
network_interface { ['eth0', 'eth1']:
mtu => 9000,
}
---
network::interfaces:
eth0:
mtu: 9000
eth1:
mtu: 9000
network_interface { 'bond0':
ensure => present,
bond_lacp_rate => 'fast',
bond_slaves => [
'eth0',
'eth1',
],
mtu => 9000,
}
---
network::interfaces:
bond0:
ensure: present
bond_lacp_rate: fast
bond_slaves:
- eth0
- eth1
mtu: 9000
network_interface { 'bond0.100':
ensure => present,
ipaddress => [
'10.0.0.1/24',
'172.16.0.1/24',
],
}
---
network::interfaces:
bond0.100:
ipaddress:
- 10.0.0.1/24
- 172.16.0.1/24
network_interface { 'vlan100':
ensure => present,
ipaddress => [
'10.0.0.1/24',
'172.16.0.1/24',
],
parent => 'bond0',
}
---
network::interfaces:
vlan100:
ipaddress:
- 10.0.0.1/24
- 172.16.0.1/24
parent: bond0
network_route { '192.168.0.0/24':
ensure => present,
device => 'vlan100',
nexthop => '10.0.0.100',
}
network::routes:
192.168.0.0/24:
ensure: present
device: vlan100
nexthop: 10.0.0.100
network_route { '10.0.0.0/24 250':
ensure => present,
device => 'vlan200',
}
network::route:
10.0.0.0/24 250:
ensure: present
device: vlan200
name
. Interface name.type
. Interface type. Can behw
,bond
andvlan
.bond_lacp_rate
. Option specifying the rate in which we'll ask our link partner to transmit LACPDU packets in 802.3ad mode. Defaults toslow
.bond_miimon
. Specifies the MII link monitoring frequency in milliseconds. Defaults to100
.bond_mode
. Specifies one of the bonding policies. Defaults to802.3ad
.bond_slaves
. Specifies a list of the bonding slaves. Defaults to[]
.bond_xmit_hash_policy
. This policy uses upper layer protocol information, when available, to generate the hash. Defaults tolayer3+4
.ipaddress
. Specifies a list of IP addresses. Defaults to[]
.mac
. Specifies a MAC address.mtu
. Specifies the maximum transmission unit.parent
. Specifies a parent interface.state
. State of this interface. Can beup
anddown
. Defaults toup
.vlanid
. Vlan ID.
name
. Contains the IP prefix and the metric (optional).prefix
. Specifies the IP prefix. The default value obtains from the name.metric
. Specifies the metric. The default value obtains rom the name.device
. Specifies the device.nexthop
. Specifies the next hop.