📄 0243-0246.html
字号:
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:TCP/IP Network Management</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=13 //-->
<!-- PAGES=0243-0298 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch12/0240-0242.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0247-0249.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-243"><P>Page 243</P></A>
<H3><A NAME="ch13_ 1">
CHAPTER 13
</A></H3>
<H2>
TCP/IP Network<BR>
Management
</H2>
<B>by Steve Shah</B>
<H3><A NAME="ch13_ 2">
IN THIS CHAPTER
</A></H3>
<UL>
<LI> An Introduction to Networking
<LI> The Network Card Solution
<LI> The Domain Name Service
<LI> The Network Information Service
<LI> The Network File System
<LI> Connecting to the Net with PPP
</UL>
<A NAME="PAGENUM-244"><P>Page 244</P></A>
<P>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.
</P>
<H3><A NAME="ch13_ 3">
An Introduction to Networking
</A></H3>
<P>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.
</P>
<H4><A NAME="ch13_ 4">
What Is an IP Number?
</A></H4>
<P>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.
</P>
<P>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.
</P>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
TIP
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
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.
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
<BR>
<H4>
A TCP/IP Primer
</H4>
<P>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.
</P>
<A NAME="PAGENUM-245"><P>Page 245</P></A>
<P>Table 13.1. IP ranges.</P>
<TABLE WIDTH="360">
<TR><TD>
<B>Class</B>
</TD><TD>
<B>Range</B>
</TD><TD>
<B>Comment</B>
</TD></TR>
<TR><TR>
A
</TD><TD>
1 to 126
</TD><TD>
Each class A network is capable of holding 16
million addresses.
</TD></TR>
<TR><TR>
B
</TD><TD>
128 to 191
</TD><TD>
Each class B network is capable of holding 65
thousand addresses.
</TD></TR>
<TR><TR>
C
</TD><TD>
192 to 223
</TD><TD>
Each class C network is capable of holding 254
addresses.
</TD></TR>
<TR><TR>
Reserved
</TD><TD>
224 to 255
</TD></TR>
</TABLE>
<P>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.
</P>
<P>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.
</P>
<P>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.
</P>
<P>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
</P>
<TABLE WIDTH="360">
<TR><TD>
Class A:
</TD><TD>
10.0.0.0
</TD></TR>
<TR><TD>
Class B:
</TD><TD>
172.16.0.0 to 172.31.0.0
</TD></TR>
<TR><TD>
Class C:
</TD><TD>
192.168.0.0 to 192.168.255.0
</TD></TR>
</TABLE>
<P>For all the examples in this chapter, I use the class C network
192.168.42.0.
</P>
<P>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.
</P>
<P>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.
</P>
<A NAME="PAGENUM-246"><P>Page 246</P></A>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
NOTE
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
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!<BR>
<BR>The Domain Name Service (DNS), which makes this possible, is covered later in
this chapter in the section "The Domain Name Service."
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
<BR>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
TIP
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
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.
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
<BR>
<H4>
Subnetworking
</H4>
<P>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.
</P>
<P>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.
</P>
<P>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.
</P>
<H5><A NAME="ch13_ 5">
Computing Netmasks
</A></H5>
<P>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.
</P>
<P>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
</P>
<P><CENTER>
<a href="../ch12/0240-0242.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0247-0249.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -