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 systemis 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.netor rc.inet. Sometimes you will also see two scripts named rc.inet1and rc.inet2; the former initializes the kernel part of networking and the latter starts basic networking services and applications. In modern distributions, the rcfiles 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 rcfiles 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 rcscript at startup time, and reboot your machine. The networking rcscripts that come along with your favorite Linuxdistribution should provide a solid example from which to work.
Mounting the /proc Filesystem
Some of the configuration tools of the Linux NET-2 and NET-3 release rely on the /procfilesystem for
communicating with the kernel. This interface permits access to kernel runtime information through a
filesystem-like mechanism. When mounted, you can list its files like any other filesystem, or display their
contents. Typical items include the loadavgfile, which contains the system load average, and meminfo, which
shows current core memory and swap usage.
To this, the networking code adds the netdirectory. It contains a number of files that show things like the kernel ARP tables, the state of TCP connections, and the routing tables. Most network administration tools get their information from these files.
The procfilesystem (or procfs, as it is also known) is usually mounted on /procat system boot time. The best
method is to add the following line to /etc/fstab:
# procfs mount point:
none /proc proc defaults
Then execute mount /proc from your /etc/rcscript.
The procfsis now configured into most kernels by default. If the procfsis not in your kernel, you will get a
message such as: mount: fs type procfs not supported by kernel. You will then have to
recompile the kernel and answer "yes" when asked for procfssupport.
Installing the Binaries
If you are using one of the prepackaged Linux distributions, it will contain the major networking applications
and utilities along with a coherent set of sample files. The only case in which you might have to obtain and
install new utilities is when you install a new kernel release. As they occasionally involve changes in the kernel
networking layer, you will need to update the basic configuration tools. This update at least involves
recompiling, but sometimes you may also be required to obtain the latest set of binaries. These binaries are
available at their official home site at ftp.inka.de/pub/comp/Linux/networking/NetTools/, packaged in an
archive called net-tools-XXX.tar.gz, where XXXis the version number. The release matching Linux 2.0 is
net-tools-1.45.
If you want to compile and install the standard TCP/IP network applications yourself, you can obtain the
sources from most Linux FTP servers. All modern Linux distributions include a fairly comprehensive range of
TCP/IP network applications, such as World Wide Web browsers, telnet and ftp programs, and other network applications, such as talk. If you do find something that you do need to compile yourself, the chances are good that it will compile under Linux from source quite simply if you follow the instructions included in the source package.
Setting the Hostname Most, if not all, network applications rely on you to set the local host's name to some reasonable value. Thissetting is usually made during the boot procedure by executing the hostname command. To set the hostname toname, enter:
# hostname name
It is common practice to use the unqualified hostname without specifying the domain name. For instance, hosts
at the Virtual Brewery (described in Appendix A, Example Network: The Virtual Brewery) might be called
vale.vbrew.comor vlager.vbrew.com. These are their official fully qualified domain names(FQDNs). Their
local hostnames would be the first component of the name, such as vale. However, as the local hostname is
frequently used to look up the host's IP address, you have to make sure that the resolver library is able to look up the host's IP address. This usually means that you have to enter the name in /etc/hosts
No comments:
Post a Comment