Networking / Beginners

Working with Network Configuration Files

Like other operating system services, the Linux network is configured by settings that are specified in configuration files that you can find in the /etc directory or in one of its subdirectories. Graphical configuration programs such as Red Hat Network Configuration are actually little more than glorified text editors that enable you to select network configuration options from user-friendly screens and then save your configuration changes to the standard configuration files. If you prefer to do the grunt work yourself, you can open the configuration files in a text editor and make changes to them directly.

Any time you open a configuration file in a text editor, you run the risk of messing up your system's configuration. So be careful!

Table-1 lists the main Linux network configuration files and describes what each file does. The details of these files are described in the sections that follow.

Linux Network Configuration Files
FileLocationDescription
network/etc/sysconfigBasic network configuration.
hostname/etcSpecifies the host name (obsolete, but should still be present).
ifcfg-eth0-/etc/sysconfig/IP settings for the first Ethernet adapter networkscripts.
ifcfg-eth1-/etc/sysconfig/IP settings for the second Ethernet adapter network scripts.
hosts/etcLists host address mappings.
resolv.conf/etcLists DNS nameservers.nsswitch.conf
nsswitch.conf/etcSpecifies the name search order.
xinetd.conf/etcSpecifies which network services are started automatically.

The Network file

The Network file, which lives in /etc/sysconfig, specifies basic configuration settings for your network. Here's a typical Network file:

NETWORKING=yes
HOSTNAME=LSERVER
GATEWAY=192.168.1.1

This file specifies that networking is enabled, the computer's host name is LSERVER, and the default gateway address is 192.168.1.1.

The following paragraphs describe all the settings that are valid for this file:

  • NETWORKING: Specifies yes or no to enable or disable networking for the computer.
  • HOSTNAME: Specifies the host name for this computer. You should also specify this name in /etc/hostname, although that file is considered obsolete and is used only by some old programs. Note that this can be a simple host name (like LSERVER) or a fully qualified domain name (like Lserver.LoweWriter.com).
  • FORWARD_IPV4: Specifies YES or NO to enable or disable IP forwarding. Specify FORWARD_IPV4=YES to set up a router.
  • GATEWAY: Specifies the IP address of the computer's Default Gateway. If the network has a gateway router, specify its address here. If this computer is the network's gateway router, specify the gateway IP address provided by your ISP.
  • GATEWAYDEV: Specifies the interface (such as eth0) that should be used to reach the gateway.
[Previous] [Contents] [Next]