13 KiB
Network configuration reference
This section describes the supported
/etc/os-net-config/config.yaml
YAML format and how they map
to networking backend providers. The root element is a
network_config
attribute, and the value is an array of
dicts entries describing the physical and virtual interfaces to
configure. Each interface entry has a mandatory type
attribute, and the value determines what other attributes are supported
for that type.
Common attributes
The following attributes are used in many types. See multiple-nics
for
examples.
addresses
A list of ip_netmask
entries to specify the network
addresses for this interface. For example:
addresses: - ip_netmask: 192.0.2.2/24 - ip_netmask: 192.0.3.2/32
ifcfg implementation
Sets BOOTPROTO=static
and populates IPADDR
and
NETMASK, followed by
IPADDR<i>,
NETMASK<i>for subsequent addresses with
<i>incrementing from
1. defroute ======== A boolean which defaults to
true. When
falsethe default route given by an IPV4 DHCP server will be ignored. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
DEFROUTE=nowhen set to
false. dhclient_args ============= Arguments to append to the call to the dhclient command, as a single string. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
DHCLIENTARGSto the supplied value dns_servers =========== A list of DNS servers (maximum of 2) to use for name resolution. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
DNS1,
DNS2to support up to 2 DNS resolvers. domain ====== A string or a list of strings containing DNS search domains ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
DOMAINcontaining all values as a space-separated list. mtu === Maximum transmission unit for this interface. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
MTUto the specified value. If unspecified the default is
1500. name ==== This is the name for the interface which is one of: - the name of existing physical interface (NIC) - the identifier from the mapping file which maps to a NIC - the desired name of a bridge or bond - a numbered identifier
nic<i>starting with
1for each active NIC:
nic1,
nic2etc ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ When the name is an identifier in the mapping file or a
nic<i>identifier, the actual name used will be the mapping value, not the identifier. The name format of a physical interfaces depends on
biosdevnameor
net.ifnamessysctl settings or udev rules for persistent names. Names will begin with
ethif both sysctl settings are disabled and there are no udev rules. The sort order used to allocate
nic<i>identifiers are: - Embedded interfaces first (
em<j>,
eth<j>,
eno<j>) ordered alphanumerically - Then, other active NICs ordered alphanumerically Each interface definition is written to
/etc/sysconfig/network-scripts/ifcfg-<name>and the first value in the file is
DEVICE=<name>. nm_controlled ============= Boolean whether this interface is managed by `NetworkManager`_, defaults to
false. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
NM_CONTROLLED=yesor
NM_CONTROLLED=noonboot ====== Boolean which determines whether to enable the interface on machine boot, defaults to
true. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
ONBOOT=yesor
ONBOOT=no. primary ======= In the
membersentries for a bond or bridge this may be set to
truefor the primary interface. This results in the bond or bridge inheriting the MAC address of the primary interface. routes ====== A list of route entries for this interface containing attributes: -
defaultBoolean whether this is the default route for this interface -
ip_netmaskor
destinationDestination network address when
defaultis
false-
next_hopor
nexthopGateway address for route destination Other supported attributes include: -
route_tableThe table ID or name to add this route to -
route_optionsString of extra options to append to the end of the route For example: .. code-block:: yaml routes: - default: true next_hop: 198.51.100.1 - ip_netmask: 192.0.2.2/24 next_hop: 203.0.113.254 route_table: 2 route_options: metric 100 ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ A routes file for each interface definition is written to
/etc/sysconfig/network-scripts/route-<name>. rules ===== A list of commented route rules, for example: .. code-block:: yaml rules: - rule: "iif em1 table 200" comment: "Route incoming traffic to em1 with table 200" - rule: "from 192.0.2.0/24 table 200" comment: "Route all traffic from 192.0.2.0/24 with table 200" - rule: "add blackhole from 172.19.40.0/24 table 200" - rule: "add unreachable iif em1 from 192.168.1.0/24" ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Each interface is iterated in order and its rules are compared to existing rules then converged by running
ip
rule del <rule>and
ip rule add
<rule>. use_dhcp ======== Boolean for whether to use DHCP for the IPv4 boot protocol. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
PEERDNS=nowhen
false. use_dhcpv6 ========== Boolean for whether to use DHCP for the IPv6 boot protocol. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
DHCPV6C=yeswhen
true. .. Undocumented: rules nic_mapping persist_mapping .. _ovs-attributes: Open vSwitch attributes ----------------------- The `Open vSwitch`_ types support some or all of these attributes: .. _ovs-options: ovs_options =========== String of other options to pass to Open vSwitch for this bond or bridge. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets the
OVS_OPTIONSvalue. .. _ovs-extra: ovs_extra ========= A list of extra options to pass to Open vSwitch. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Will set the
OVS_EXTRAvalue with all the provided values. ovs_fail_mode ============= Failure mode for a bridge, defaults to
standard, can also be set to
secureifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Will be appended to the
OVS_OPTIONSvalue and the concatenated list of
OVS_EXTRAvalues. type: interface --------------- Configures a physical NIC. See :ref:`multiple-nics` for examples. All of the :ref:`common-attributes` can be used with this type along with the following attributes: ethtool_opts ============ Device-specific options supported by `ethtool`_. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
ETHTOOL_OPTSto the value. hotplug ======= A boolean for whether to activate the device when it is plugged in. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
HOTPLUG=yesor
HOTPLUG=nolinkdelay ========= Integer number of seconds to wait for link negotiation before configuring the device. ifcfg implementation ^^^^^^^^^^^^^^^^^^^^ Sets
LINKDELAYto the delay value. type: ovs_bridge ---------------- Configures an `Open vSwitch`_ bridge. See :ref:`control-plane-bridge` for an example. All of the :ref:`common-attributes` and :ref:`ovs-attributes` can be used with this type. The
membersattribute contains a list of entries for interfaces to bridge typically of
type: -
interface-
linux_bond-
ovs_bond-
vlan- other Open vSwitch internal interfaces ifcfg implementation ==================== Values
DEVICETYPE=ovsand
TYPE=OVSBridgeare set. When
use_dhcpor
use_dhcpv6is
true,
OVSBOOTPROTO=dhcpis set and
OVSDHCPINTERFACESis populated. type: ovs_bond -------------- Configures an `Open vSwitch`_ bond. See :ref:`ovs-bond` for an example. All of the :ref:`common-attributes` and :ref:`ovs-attributes` can be used with this type. The
membersattribute contains a list of entries for interfaces to be bonded. ifcfg implementation ==================== Values
DEVICETYPE=ovsand
TYPE=OVSBridgeare set. When
use_dhcpor
use_dhcpv6is
true,
OVSBOOTPROTO=dhcpis set and
OVSDHCPINTERFACESis populated. type: vlan ---------- Configures VLAN tagging for one VLAN. See :ref:`bonds-with-vlans` for an example. :ref:`common-attributes` are supported but generally only
mtu,
addressesor
routesare used. Other attributes for
vlanare: device ====== The
nameof an existing interface entry, which will typically be of
type:
interface,
type: ovs_bond, or
type:
linux_bond. Usually
deviceis only used when the VLAN is not part of an
ovs_bridge. A VLAN on an
ovs_bridgeis part of the
memberslist for the bridge, where a Linux VLAN is associated with an
interfaceor
linux_bondusing the
deviceparameter. vlan_id ======= The VLAN ID to tag when passing through the
deviceinterface. ifcfg implementation ==================== Sets
VLAN=yesand
PHYSDEVto the
devicevalue. type: linux_bridge ------------------ Configures a `Linux bridge`_. See :ref:`linux-bridge` for an example. All of the :ref:`common-attributes` can be used with this type. The
membersattribute contains a list of entries for interfaces to bridge. ifcfg implementation ==================== Sets
TYPE=Bridgeand
DELAY=0. The MAC address of the
membersinterface which has
primary:
truewill be used for the
MACADDRvalue. type: linux_bond ---------------- Configures a `Linux bond`_. See :ref:`bonds-vlans-dpdk` for an example. All of the :ref:`common-attributes` can be used with this type. The
membersattribute contains a list of entries for interfaces to be bonded. Extra bonding options are specified in the
bonding_optionsstring. ifcfg implementation ==================== The MAC address of the
membersinterface which has
primary:
truewill be used for the
MACADDRvalue.
BONDING_OPTSwill contain the value of the
bonding_optionsattribute. type: ovs_user_bridge --------------------- Configures an `Open vSwitch`_ bridge where the members are user ports. This is generally used to set up `DPDK vHost User Ports`_. See :ref:`bonds-vlans-dpdk` for an example. All of the :ref:`common-attributes` and :ref:`ovs-attributes` can be used with this type. The
membersattribute usually contains a single
type:
ovs_dpdk_bondentry. ifcfg implementation ==================== Values
DEVICETYPE=ovsand
TYPE=OVSUserBridgeare set. When
use_dhcpor
use_dhcpv6is
true,
OVSBOOTPROTO=dhcpis set and
OVSDHCPINTERFACESis populated. Each
membersinterface also has
OVS_BRIDGEset, as well as other values depending on the type of the member. type: ovs_dpdk_bond ------------------- Configures an `Open vSwitch`_ bond for binding DPDK ports. See :ref:`bonds-vlans-dpdk` for an example. All of the :ref:`common-attributes` and :ref:`ovs-attributes` can be used with this type. The
membersattribute contains a list of
type:
ovs_dpdk_portports to be bonded. The value for attribute
rx_queuewill determine the RX queue length. ifcfg implementation ==================== Values
DEVICETYPE=ovs,
TYPE=OVSDPDKBond, and
RX_QUEUEare set.
BOND_IFACESis populated with the
nameof all members.
OVS_EXTRAis extended with a
set
Interface...directive for each member. type: ovs_dpdk_port ------------------- Creates an Open vSwitch DPDK port, usually in the
membersof a
type:
ovs_dpdk_bondbond interface. See :ref:`bonds-vlans-dpdk` for an example. All of the :ref:`common-attributes` and :ref:`ovs-attributes` can be used with this type. Each port must have a
memberslist with a single interface entry. A port can have its own
rx_queuespecifed. The
driverattribute can override the default kernel driver module of
vfio-pci. ifcfg implementation ==================== Values
DEVICETYPE=ovsand
TYPE=OVSDPDKPort, and
RX_QUEUEare set.
OVS_EXTRAis extended with a
set
Interface...directive for the one
members`` interface.