CLASS="CHAPTER" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

Chapter 5. Configuring TCP/IP Networking

Table of Contents
5.1. Mounting the /proc Filesystem
5.2. Installing the Binaries
5.3. Setting the Hostname
5.4. Assigning IP Addresses
5.5. Creating Subnets
5.6. Writing hosts and networks Files
5.7. Interface Configuration for IP
5.7.1. The Loopback Interface
5.7.2. Ethernet Interfaces
5.7.3. Routing Through a Gateway
5.7.4. Configuring a Gateway
5.7.5. The PLIP Interface
5.7.6. The SLIP and PPP Interfaces
5.7.7. The Dummy Interface
5.7.8. IP Alias
5.8. All About ifconfig
5.9. The netstat Command
5.9.1. Displaying the Routing Table
5.9.2. Displaying Interface Statistics
5.9.3. Displaying Connections
5.10. Checking the ARP Tables

In this chapter, we walk you through all the necessary steps to set up TCP/IP networking on your machine. Starting with the assignment of IP addresses, we slowly work our way through the configuration of TCP/IP network interfaces and introduce a few tools that come in handy when hunting down network installation problems.

Most of the tasks covered in this chapter will generally have to be done only once. Afterward, you have to touch most configuration files only when adding a new system to your network or when you reconfigure your system entirely. Some of the commands used to configure TCP/IP, however, have to be executed each time the system is booted. This is usually done by invoking them from the system /etc/rc* scripts.

Commonly, the network-specific part of this procedure is contained in a script. The name of this script varies in different Linux distributions. In many older Linux distributions, it is known as rc.net or rc.inet. Sometimes you will also see two scripts named rc.inet1 and rc.inet2 ; the former initializes the kernel part of networking and the latter starts basic networking services and applications. In modern distributions, the rc files are structured in a more sophisticated arrangement; here you may find scripts in the /etc/init.d/ (or /etc/rc.d/init.d/ ) directory that create the network devices and other rc files that run the network application programs. This book's examples are based on the latter arrangement.

This chapter discusses parts of the script that configure your network interfaces, while applications will be covered in later chapters. After finishing this chapter, you should have established a sequence of commands that properly configure TCP/IP networking on your computer. You should then replace any sample commands in your configuration scripts with your commands, make sure the script is executed from the basic rc script at startup time, and reboot your machine. The networking rc scripts that come along with your favorite Linux distribution should provide a solid example from which to work.