-->

Previous | Table of Contents | Next

Page 243

CHAPTER 13

TCP/IP Network
Management

by Steve Shah

IN THIS CHAPTER

Page 244

Although a standalone system can be quite interesting and very useful, you cannot harness the true power of a UNIX system until you attach it to a network. This chapter covers the various means and tools you will need to do so.

An Introduction to Networking

TCP/IP (Transmission Control Protocol/Internet Protocol) was the first widely used networking protocol under UNIX and has been an integral part of Linux since its creation. The success of TCP/IP was the result of a combination of many things. The three that had the most to do with this success were the United States Department of Defense's involvement in creating the protocol and establishing a wide area network with it (the predecessor to what has become the Internet), the fact that the protocol specifications are freely available to anyone in the world, and finally, the nature of TCP/IP itself: robust and untied to any particular physical medium.

What Is an IP Number?

An IP number is what uniquely identifies a network interface. If your network is private, you only need to worry about address uniqueness within your own network. If, however, your network is attached to the Internet, you do need to worry about having a unique address across the entire Internet.

An IP address consists of four numbers, ranging from 0 to 255, separated by dots. A valid address looks something like 192.168.3.12. This is sometimes called the dotted address; however, it is most frequently referred to as the IP address. Although coming up with an address might appear simple, you need to be aware of some restrictions.

TIP
You might have noticed that I've specified that IP addresses need to be unique to a network interface, not a host. This is because it is possible for a single host to have multiple network interfaces. You should keep this distinction in mind. In most cases, the two terms mean the same thing and therefore are used interchangeably. In all the examples in this chapter, each host has only one network interface; hence, I use the term host more often.

A TCP/IP Primer

The range of addresses available has been broken up into three segments: class A, B, and C. Each class is determined by the first number in the IP address. (More accurately, it is determined by the first few bits of the address, but as you can imagine, picking out the ranges in decimal is much easier for us humans.) The classes are shown in Table 13.1.

Page 245

Table 13.1. IP ranges.

A B C Reserved
Class Range Comment
1 to 126 Each class A network is capable of holding 16 million addresses.
128 to 191 Each class B network is capable of holding 65 thousand addresses.
192 to 223 Each class C network is capable of holding 254 addresses.
224 to 255

Within these class ranges there are several special addresses. The one you will see most frequently is 127.0.0.1, the loopback address. The loopback address, also known as localhost, is a network address that points back to the machine it originated from. This is useful for establishing and testing network services on a machine without having to really connect to a network.

Depending on the class, a network can hold a varying number of hosts within it. For class A networks, the first number in dotted notation shows which network. The subsequent three numbers identify the hosts. In class B networks, the first two dotted numbers identify the network, leaving the last two dotted numbers to identify the hosts. Finally, class C networks use the first three numbers to identify the network and the last number to identify the hosts.

If the host part of the network address is all zeros, that address refers to the entire network, not just one host. Hence, a host's IP address should not have a zero in it.

Within each address class, special addresses are designated for internal networks, networks which are not directly connected to the Internet. Machines that are behind firewalls, for example, can use these addresses for communicating with one another. The ranges for these addresses are

Class A: 10.0.0.0
Class B: 172.16.0.0 to 172.31.0.0
Class C: 192.168.0.0 to 192.168.255.0

For all the examples in this chapter, I use the class C network 192.168.42.0.

Determining which IP address to use is highly site-dependent. If you are attaching your machine to an established network, you will need to contact your network administrator to establish which IP address you should use. This includes connecting to an Internet Service Provider (ISP) that will be assigning you an address.

If, on the other hand, you are establishing a local area network at home or behind a firewall, you should use one of the established private ranges. These are chunks of IP addresses that have been put aside by the InterNIC so that no publicly accessible network can use them.

Page 246

NOTE
So far, I've used only IP addresses to identify machines on a network. How is it, then, that you can use names to find machines across the Internet? Simple. Most sites set up a special mapping between hostnames and their IP numbers. Many programs are designed to automatically use names instead of IP addresses because they are much easier for humans to digest. Imagine trying to remember 192.168.42.7 instead of www.domain.com!

The Domain Name Service (DNS), which makes this possible, is covered later in this chapter in the section "The Domain Name Service."

TIP
Details into the theory of TCP/IP are beyond the scope of this chapter. For additional information regarding TCP/IP theory, check out the Sams book TCP/IP Blueprints (ISBN: 0-672-31055-4) by Robin Burk, Martin Bligh, Thomas Lee, et al.

Subnetworking

Imagine trying to network a site with hundreds, if not thousands, of machines. Now try to imagine the resulting mess of network addresses, cables, and traffic. Attempting to manage such a beast will only leave you with a migraine and a fist full of hair.

Realizing this would eventually happen, the creators of TCP/IP designed in the ability to break a network down into subnetworks for easier management. Each subnetwork, or subnet for short, has its own broadcast address and network mask. The broadcast address is used to send messages to all of the machines within a particular subnet. The network mask, or netmask for short, tells you how many machines are in a subnet and their corresponding network addresses.

If you are joining an existing network, you should be given this information. If, on the other hand, you are setting up your own network, you will need to determine these numbers on your own.

Computing Netmasks

An IP address is composed of a total of 32 bits. Every 8 bits makes up one number in the dotted address. While many sites set up their netmasks across an 8-bit boundary, smaller sites are finding it necessary to allocate fewer than 254 addresses to a site. This means less intuitive netmasks.

As I mentioned earlier, IP addresses are broken up into two parts, the network address and the host address. Depending on the class of the address, there can be anywhere from 254 to 16 million addresses in a particular network. In order to subnet these address ranges, a certain part of the host address must be allocated to the subnetwork address. By counting the number of

Previous | Table of Contents | Next