6.2. Interface Configuration Files
Interface configuration files control the software interfaces for individual network devices. As the system boots, it uses these files to determine what interfaces to bring up and how to configure them. These files are usually named
ifcfg-name
, where
name
refers to the name of the device that the configuration file controls.
6.2.1. Ethernet Interfaces
One of the most common interface files is
ifcfg-eth0
, which controls the first Ethernet
network interface card or
NIC in the system. In a system with multiple NICs, there are multiple
ifcfg-ethX
files (where
X
is a unique number corresponding to a specific interface). Because each device has its own configuration file, an administrator can control how each interface functions individually.
The following is a sample
ifcfg-eth0
file for a system using a fixed IP address:
DEVICE=eth0 BOOTPROTO=none ONBOOT=yes NETMASK=255.255.255.0 IPADDR=10.0.1.27 USERCTL=no
The values required in an interface configuration file can change based on other values. For example, the
ifcfg-eth0
file for an interface using DHCP looks different because IP information is provided by the DHCP server:
DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes
The
Network Administration Tool (
system-config-network
) is an easy way to make changes to the various network interface configuration files.
However, it is also possible to manually edit the configuration files for a given network interface.
Below is a listing of the configurable parameters in an Ethernet interface configuration file:
-
sets the configuration parameters for the bonding device, and is used in
/etc/sysconfig/network-scripts/ifcfg-bond
(see Section 6.2.2, “Channel Bonding Interfaces”). These parameters are identical to those used for bonding devices inN
/sys/class/net/
, and the module parameters for the bonding driver as described inbonding device
/bondingbonding
Module Directives.This configuration method is used so that multiple bonding devices can have different configurations. It is highly recommended to place all of your bonding options after theBONDING_OPTS
directive inifcfg-
. Do not specify options for the bonding device inname
/etc/modprobe.d/
, or in the deprecatedbonding
.conf/etc/modprobe.conf
file. -
where
is one of the following:protocol
-
none
— No boot-time protocol should be used. -
bootp
— The BOOTP protocol should be used. -
dhcp
— The DHCP protocol should be used.
-
-
where
is the broadcast address. This directive is deprecated, as the value is calculated automatically withaddress
ipcalc
. -
where
is the name of the physical device (except for dynamically-allocated PPP devices where it is the logical name).name
-
where
name
is a short hostname to be sent to the DHCP server. Use this option only if the DHCP server requires the client to specify a hostname before receiving an IP address. -
where
is a name server address to be placed inaddress
/etc/resolv.conf
if thePEERDNS
directive is set toyes
. -
where
are any device-specific options supported byoptions
ethtool
. For example, if you wanted to force 100Mb, full duplex:ETHTOOL_OPTS="autoneg off speed 100 duplex full"
Instead of a custom initscript, useETHTOOL_OPTS
to set the interface speed and duplex settings. Custom initscripts run outside of the network init script lead to unpredictable results during a post-boot network service restart.Set "autoneg off" before changing speed or duplex settings
Changing speed or duplex settings almost always requires disabling autonegotiation with theautoneg off
option. This needs to be stated first, as the option entries are order-dependent. -
where
address
is the IP address of the network router or gateway device (if any). -
where
answer
is one of the following:-
yes
— This device should be activated when it is hot-plugged (this is the default option). -
no
— This device should not be activated when it is hot-plugged.
TheHOTPLUG=no
option can be used to prevent a channel bonding interface from being activated when a bonding kernel module is loaded.Refer to Section 6.2.2, “Channel Bonding Interfaces” for more information about channel bonding interfaces. -
-
where
MAC-address
is the hardware address of the Ethernet device in the formAA:BB:CC:DD:EE:FF
. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction withMACADDR
. -
where
is the IP address.address
-
where
time
is the number of seconds to wait for link negotiation before configuring the device. -
where
MAC-address
is the hardware address of the Ethernet device in the formAA:BB:CC:DD:EE:FF
. This directive is used to assign a MAC address to an interface, overriding the one assigned to the physical NIC. This directive should not be used in conjunction withHWADDR
. -
where
is the channel bonding interface to which the Ethernet interface is linked.bond-interface
This directive is used in conjunction with theSLAVE
directive.Refer to Section 6.2.2, “Channel Bonding Interfaces” for more information about channel bonding interfaces. -
where
is the netmask value.mask
-
where
is the network address. This directive is deprecated, as the value is calculated automatically withaddress
ipcalc
. -
where
is one of the following:answer
-
yes
— This device should be activated at boot-time. -
no
— This device should not be activated at boot-time.
-
-
where
is one of the following:answer
-
yes
— Modify/etc/resolv.conf
if the DNS directive is set. If using DHCP, thenyes
is the default. -
no
— Do not modify/etc/resolv.conf
.
-
-
where
is one of the following:answer
-
yes
— This device is controlled by the channel bonding interface specified in theMASTER
directive. -
no
— This device is not controlled by the channel bonding interface specified in theMASTER
directive.
This directive is used in conjunction with theMASTER
directive.Refer to Section 6.2.2, “Channel Bonding Interfaces” for more about channel bonding interfaces. -
-
where
is the specified source IP address for outgoing packets.address
-
where
is one of the following:answer
-
yes
— Non-root
users are allowed to control this device. -
no
— Non-root
users are not allowed to control this device.
-
BONDING_OPTS=parameters
BOOTPROTO=protocol
BROADCAST=address
DEVICE=name
DHCP_HOSTNAME=name
DNS{1,2}
=address
ETHTOOL_OPTS=options
GATEWAY=address
HOTPLUG=answer
HWADDR=MAC-address
IPADDR=address
LINKDELAY=time
MACADDR=MAC-address
MASTER=bond-interface
NETMASK=mask
NETWORK=address
ONBOOT=answer
PEERDNS=answer
SLAVE=answer
SRCADDR=address
USERCTL=answer