2.3.1. Configuring a Network Interface Using ifcfg 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 the suffix name refers to the name of the device that the configuration file controls. By convention, the ifcfg
file's suffix, ethX, is the same as the string given by the DEVICE
directive in the configuration file itself.
Static Network Settings
To configure an interface with static network settings using
ifcfg
files, for an interface with name
eth0, create a file with name
ifcfg-eth0
in the
/etc/sysconfig/network-scripts/
directory as follows:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.1.27
NM_CONTROLLED=no
Optionally specify the hardware or MAC address using the
HWADDR
directive. Note that this will influence the device naming procedure as explained in
Chapter 8, Consistent Network Device Naming. You do not need to specify the broadcast address as this is calculated automatically by
ipcalc.
Dynamic Network Settings
To configure an interface with dynamic network settings using
ifcfg
files, for an interface with name
em1, create a file with name
ifcfg-em1
in the
/etc/sysconfig/network-scripts/
directory as follows:
DEVICE=em1
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no
Optionally specify the hardware or MAC address using the
HWADDR
directive. Note that this will influence the device naming procedure as explained in
Chapter 8, Consistent Network Device Naming. You do not need to specify the broadcast address as this is calculated automatically by
ipcalc.
For a listing of the configurable parameters in an Ethernet interface configuration file see the Fedora 20 System Administrator's Reference Guide.