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 FilesFile | Location | Description |
---|---|---|
network | /etc/sysconfig | Basic network configuration. |
hostname | /etc | Specifies 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 | /etc | Lists host address mappings. |
resolv.conf | /etc | Lists DNS nameservers.nsswitch.conf |
nsswitch.conf | /etc | Specifies the name search order. |
xinetd.conf | /etc | Specifies 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.
In this tutorial:
- Managing Linux Systems
- Planning a Linux Server Installation
- Partitions
- Installing Fedora 7
- Getting Used to Linux
- Understanding the file system
- On Again, Off Again
- Using GNOME
- Managing User Accounts
- Linux Network Configuration
- Restarting Your Network
- Working with Network Configuration Files
- The ifcfg files
- The resolv.conf file
- DHCP and DNS
- Configuring DHCP
- Running a DNS Server
- Running Apache
- Starting and Stopping Apache
- Confirming that Apache Is Running
- Using the HTTP Configuration Tool
- Restricting Access to an Apache Server
- Configuring Virtual Hosts
- Setting the Apache User Account
- Running Sendmail
- Installing Sendmail
- Modifying sendmail.mc
- Using SpamAssassin
- Using the Mail Console Client
- Running FTP
- Starting the vsftpd Service
- Configuring FTP