TCP/IP Configuration  «Prev   Next»

Lesson 2The TCP/IP configuration process
ObjectiveThree steps for putting a machine on a TCP/IP network

Three Steps for the TCP/IP configuration Process

What are the three steps for putting a machine on a TCP/IP network?
Putting a machine on a TCP/IP[1] network has three parts:
  1. Configuring the network interface(s): This part of TCP/IP configuration joins the link-layer portion of the protocol stack (corresponding to the network hardware, whether phone line, fiber optics line, or ethernet[2]) to the network, or IP, layer. The most important part of this configuration step is assigning IP addresses.
  2. Setting up routing: In this part of the configuration process, the system must be taught where to send information destined for machines not on the local network. If the machine lives on several networks, then it must be taught how to direct information among them. In the simplest situation, this portion of TCP/IP configuration involves setting a default gateway.
  3. Setting up name service: Although the TCP/IP software works with numerical addresses, people find it more convenient to work with host names (such as Name service provides a facility for converting between numeric addresses and human-readable names. The last phase of TCP/IP configuration makes name service available.
We will now look at each of these stages in more detail. We will begin with the third stage (name service), then return to the first two stages.

Configuring TCP/IP on your Linux System

Before configuring TCP/IP on your Linux system, you need to perform a few small steps to ensure that your filesystem is ready. The first step is to make sure the networking software has been installed. You can install the network package through the setup program, as shown in the figure below. Selecting the networking option installs the applications you need to use TCP/IP under Linux.
Linux Setup
Linux Setup

After the network software has been installed, you might have to reboot your system. Some versions of Linux (notably those that use the 2.0 kernel and many of the latest releases) require a /proc filesystem for networking to function properly. Most Linux kernels that inherently support networking automatically create the /proc filesystem when the operating system is installed, so you should not have to do anything more than make sure it is properly mounted by the kernel. (The /proc filesystem is a quick interface point for the kernel to obtain network information, as well as to help the kernel maintain tables usually kept in the subdirectory /proc/net.) You can verify that your Linux version uses the /proc filesystem by trying to do a "cd /proc" command to change to the /proc directoryt, as shown in the following figure.
Figure 2
Figure 2

If you can change into the /proc filesystem and obtain a directory listing, the filesystem exists and TCP/IP can be configured properly. If you cannot change into /proc, it probably doesn't exist (assuming you have access permissions, of course). If the /proc filesystem was not created for you by the Linux installation routine, you have to rebuild the kernel and select the /proc option. Change to the Linux source directory (such as /usr/src/Linux) and run the kernel configuration routine with this command:
make config

If you have X-Windows running and properly configured, you can run the following GUI-based configuration process:
make xconfig

When you are asked whether you want procfs support (or a similarly worded question), answer yes. If you do not get asked about the /proc filesystem support, and the /proc directory is not created on your filesystem, you need to upgrade your kernel to support networking.
The /proc filesystem should be mounted automatically when your Linux system boots. To force the /proc filesystem to be mounted automatically, edit the /etc/fstab file and add a line similar to this (if it isn't already there):
none     /proc     proc     defaults

Another step you should take before configuring TCP/IP is to set the system's hostname. To set the hostname, use this command:
hostname name

name is the system name you want for your local machine. If you have a full domain name assigned to your network and your machine, you can use that name for your system. For example, if your Linux machine is attached to the domain and your machine's name is hal, you can set the full domain name using this command:

If you do not have a fully qualified domain name, you can make up your own domain name as long as you are not connected to the Internet. (A made-up domain name does not have any meaning outside your local area network.) Alternatively, you do not have to assign a domain at all for your machine, but can simply enter this short name:
hostname hal

An entry is made in the /etc/hosts file to reflect your machine's name. You should verify that your machine's name appears in that file. You also need to know the IP address assigned to your machine. You should have a unique IP address ready for your Linux machine for use in the configuration process.
One file that you might need to work with if you plan to direct information across many networks is /etc/networks. The /etc/networks file contains a list of all the network names your machine should know about, along with their IP addresses. Applications use this file to determine target networks based on the network name. The /etc/networks file consists of two columns for the symbolic name of the remote network and its IP address. Most /etc/networks files have at least one entry for the loopback driver that should be on every Linux system (the loopback driver is used as a default IP address by some Linux applications and is discussed in more detail later in this chapter). A sample /etc/networks file looks like this:

This sample file has two networks entered in it with their network IP addresses. Only the network portion of the IP address is specified, leaving the host component of the IP addresses set to zeros

[1]TCP/IP: TCP/IP is the network protocol suite used by the Internet and most local area networks.
[2]Ethernet: A LAN developed by Xerox in 1976. Ethernet became a widely implemented network from which the IEEE 802.3 standard for contention networks was developed. It uses a bus topology and the original Ethernet relies on CSMA/CD to regulate traffic on the main communication line.

SEMrush Software2