Configuring Network Interface Controllers (NIC)



Each network interface controller (NIC) on your computer provides a physical connection to your network. Most computers have only one NIC while others may have several. Laptops usually have a NIC for a wired connection and a NIC for a wireless connection. Some laptops may also have a NIC for a WiMax connection. Some Linux desktop or tower computers have multiple wired NIC cards and are used as inexpensive routers for internal networks; such is the case with a couple of my own systems.

Configuration of the NICs for each network connection is accomplished with files in the /etc/sysconfig/network-scripts directory. Each NIC has an interface configuration file named ifcfg-ethX, where X is the number of the NIC, starting with zero (0). All of the other files in this directory are scripts used to start, stop and perform various network configuration activities.

Each interface configuration file is bound to a specific physical NIC by the MAC address of the NIC.

Typical Interface Configuration File

A typical network interface configuration file is shown below. This file defines a static IP address of, with a broadcast address of, and a gateway of with a netmask of

# Intel Corporation 82566DC-2 Gigabit Network Connection

The HWADDR line specifies the MAC address of the physical NIC. You will need to change the MAC if you replace the NIC for some reason. This file specifies two DNS entries for this network.

The ONBOOT line specifies that the interface is to be activated at boot time. If this line were changed to “no” the interface would have to be activated manually as it would not be activated automatically at boot time.

The USERCTL line specifies that non-privileged users cannot manage the interface; that is they cannot turn it on and off. Setting this parameter to “yes” would allow regular users to activate and deactivate the interface.

Description of Configuration Options

There are many configuration options for the interface configuration files. The more common ones are described here.

  • DEVICE:  The logical name of the device, such as eth0.
  • HWADDR:  The MAC address of the NIC such as 00:16:76:02:BA:DB
  • ONBOOT:  Start the network on this device. Options are yes/no.
  • IPADDR:  The IP Address assigned to this NIC such as
  • BROADCAST: The broadcast address for this network such as
  • NETMASK: The netmask for this subnet such as the class C mask
  • NETWORK: The network ID for this subnet such as the class C ID
  • SEARCH: The DNS domain name to search when doing lookups on unqualified hostnames such as ””
  • BOOTPROTO: The boot protocol  for this interface. Options are static, DHCP, bootp, none.
  • GATEWAY: The network router or default gateway for this subnet, such as
  • DNS1: The primary DNS server, such as The DNS servers specified here are added to the /etc/resolv.conf file when using the Network Manager or if the peerdns directive is set to yes, otherwise the DNS servers must be added to that file manually and are ignored here.
  • DNS2: The secondary DNS server such as Note that a tertiary DNS server is not supported.
  • TYPE: Type of network such as Ethernet.
  • PEERDNS: The yes option indicates that /etc/resolv.conf is to be modified by inserting the DNS server entries specified by DNS1 and DNS2 options in this file. No means do not alter the resolv.conf file. Yes is the default when DHCP is specified in the BOOTPROTO line.
  • USERCTL: Specifies whether non-privileged users may start and stop this interface. Options are yes/no.
  • IPV6INIT: Specifies whether IPV6 protocols are applied to this interface. Options are yes/no.

If the DHCP option is specified, many of the other options are ignored. The only required options besides BOOTPROTO would be ONBOOT and HWADDR. Other options that you might find desirable are the DNS and PEERDNS options if you do not want the DNS entries supplied by the DHCP server.