old-www/LDP/nag2/x-087-2-issues.ip-addresses...

491 lines
9.7 KiB
HTML

<HTML
><HEAD
><TITLE
>IP Addresses</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.57"><LINK
REL="HOME"
TITLE="Linux Network Administrators Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Issues of TCP/IP Networking"
HREF="x-087-2-issues.html"><LINK
REL="PREVIOUS"
TITLE="Networking Interfaces"
HREF="x-087-2-issues.interfaces.html"><LINK
REL="NEXT"
TITLE="Address Resolution"
HREF="x-087-2-issues.arp.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux Network Administrators Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x-087-2-issues.interfaces.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Issues of TCP/IP Networking</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x-087-2-issues.arp.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="X-087-2-ISSUES.IP-ADDRESSES"
>2.2. IP Addresses</A
></H1
><P
>As mentioned in <A
HREF="x-087-2-intro.html"
>Chapter 1</A
>, the IP networking protocol
understands addresses as 32-bit numbers. Each machine must be assigned a
number unique to the networking environment.<A
NAME="X-087-2-FNIS01"
HREF="#FTN.X-087-2-FNIS01"
>[1]</A
>
If you are running a local network that does not have TCP/IP traffic
with other networks, you may assign these numbers according to your
personal preferences. There are some IP address ranges that have been
reserved for such private networks. These ranges are listed in <A
HREF="x-087-2-issues.ip-addresses.html#X-087-2-ISSUES.RESERVED.ADDRESSES"
>Table 2-1</A
>. However, for sites on
the Internet, numbers are assigned by a central authority, the
<I
CLASS="EMPHASIS"
>Network Information Center</I
> (NIC).<A
NAME="X-087-2-FNIS02"
HREF="#FTN.X-087-2-FNIS02"
>[2]</A
>&#13;</P
><P
>&#13;
IP addresses are split up into four eight-bit numbers called
<I
CLASS="EMPHASIS"
>octets</I
> for readability. For example,
<SPAN
CLASS="SYSTEMITEM"
>quark.physics.groucho.edu</SPAN
> has an
IP address of <SPAN
CLASS="SYSTEMITEM"
>0x954C0C04</SPAN
>, which is
written as <SPAN
CLASS="SYSTEMITEM"
>149.76.12.4</SPAN
>. This format
is often referred to as <I
CLASS="EMPHASIS"
>dotted quad notation</I
>.</P
><P
>Another reason for this notation is that IP addresses are split into a
<I
CLASS="EMPHASIS"
>network</I
> number, which is contained in the leading
octets, and a <I
CLASS="EMPHASIS"
>host</I
> number, which is the remainder.
When applying to the NIC for IP addresses, you are not assigned an address
for each single host you plan to use. Instead, you are given a network
number and allowed to assign all valid IP addresses within this range to
hosts on your network according to your preferences.</P
><P
>The size of the host part depends on the size of the network. To accommodate
different needs, several classes of networks, defining different places to
split IP addresses, have been defined. The class networks are described here:</P
><P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>Class A</DT
><DD
><P
>Class A comprises networks <SPAN
CLASS="SYSTEMITEM"
>1.0.0.0</SPAN
>
through <SPAN
CLASS="SYSTEMITEM"
>127.0.0.0</SPAN
>. The network number
is contained in the first octet. This class provides for a 24-bit host part,
allowing roughly 1.6 million hosts per network.</P
></DD
><DT
>Class B</DT
><DD
><P
>Class B contains networks <SPAN
CLASS="SYSTEMITEM"
>128.0.0.0</SPAN
>
through <SPAN
CLASS="SYSTEMITEM"
>191.255.0.0</SPAN
>; the network
number is in the first two octets. This class allows for 16,320 nets with 65,024
hosts each.</P
></DD
><DT
>Class C</DT
><DD
><P
> Class C networks
range from <SPAN
CLASS="SYSTEMITEM"
>192.0.0.0</SPAN
> through
<SPAN
CLASS="SYSTEMITEM"
>223.255.255.0</SPAN
>, with the
network number contained in the first three octets. This class allows
for nearly 2 million networks with up to 254 hosts.</P
></DD
><DT
>Classes D, E, and F</DT
><DD
><P
>Addresses falling into the range of
<SPAN
CLASS="SYSTEMITEM"
>224.0.0.0</SPAN
> through
<SPAN
CLASS="SYSTEMITEM"
>254.0.0.0</SPAN
> are either experimental or
are reserved for special purpose use and don't specify any network. IP
Multicast, which is a service that allows material to be transmitted to many
points on an internet at one time, has been assigned addresses from within
this range.</P
></DD
></DL
></DIV
></P
><P
>If we go back to the example in Chapter 1, we find that
<SPAN
CLASS="SYSTEMITEM"
>149.76.12.4</SPAN
>, the address of
<SPAN
CLASS="SYSTEMITEM"
>quark</SPAN
>, refers to host
<SPAN
CLASS="SYSTEMITEM"
>12.4</SPAN
> on the class B network
<SPAN
CLASS="SYSTEMITEM"
>149.76.0.0</SPAN
>.</P
><P
>&#13;You may have noticed that not all possible values in the previous list
were allowed for each octet in the host part. This is because octets
<SPAN
CLASS="SYSTEMITEM"
>0</SPAN
> and <SPAN
CLASS="SYSTEMITEM"
>255</SPAN
> are reserved for special purposes.
An address where all host part bits are 0 refers to the network, and
an address where all bits of the host part are 1 is called a
<I
CLASS="EMPHASIS"
>broadcast address</I
>. This refers to all hosts on
the specified network simultaneously. Thus, <SPAN
CLASS="SYSTEMITEM"
>149.76.255.255</SPAN
> is not a valid host
address, but refers to all hosts on network <SPAN
CLASS="SYSTEMITEM"
>149.76.0.0</SPAN
>.</P
><P
>&#13;
A number of network addresses are reserved for special purposes.
<SPAN
CLASS="SYSTEMITEM"
>0.0.0.0</SPAN
> and <SPAN
CLASS="SYSTEMITEM"
>127.0.0.0</SPAN
> are two such addresses. The
first is called the <I
CLASS="EMPHASIS"
>default route</I
>, and the latter
is the <I
CLASS="EMPHASIS"
>loopback address</I
>. The default route has to
do with the way the IP routes datagrams.</P
><P
>Network <SPAN
CLASS="SYSTEMITEM"
>127.0.0.0</SPAN
> is reserved for
IP traffic local to your host. Usually, address
<SPAN
CLASS="SYSTEMITEM"
>127.0.0.1</SPAN
> will be assigned to a special
interface on your host, the <I
CLASS="EMPHASIS"
>loopback interface</I
>, which
acts like a closed circuit. Any IP packet handed to this interface from
TCP or UDP will be returned to them as if it had just arrived from some
network. This allows you to develop and test networking software without
ever using a &#8220;real&#8221; network. The loopback network also allows
you to use networking software on a standalone host. This may not be as
uncommon as it sounds; for instance, many UUCP sites don't have IP
connectivity at all, but still want to run the INN news system. For
proper operation on Linux, INN requires the loopback interface.</P
><P
>&#13;Some address ranges from each of the network classes have been set
aside and designated &#8220;reserved&#8221; or &#8220;private&#8221;
address ranges. These addresses are reserved for use by private
networks and are not routed on the Internet. They are commonly used by
organizations building their own intranet, but even small networks
often find them useful. The reserved network addresses appear in <A
HREF="x-087-2-issues.ip-addresses.html#X-087-2-ISSUES.RESERVED.ADDRESSES"
>Table 2-1</A
>.</P
><DIV
CLASS="TABLE"
><A
NAME="X-087-2-ISSUES.RESERVED.ADDRESSES"
></A
><P
><B
>Table 2-1. IP Address Ranges Reserved for Private Use</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Class</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Networks</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>A</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>10.0.0.0 through 10.255.255.255</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>B</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>172.16.0.0 through 172.31.0.0</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>C</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>192.168.0.0 through 192.168.255.0</TD
></TR
></TBODY
></TABLE
></DIV
><P
></P
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.X-087-2-FNIS01"
HREF="x-087-2-issues.ip-addresses.html#X-087-2-FNIS01"
>[1]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>The version of the Internet Protocol most frequently used on the
Internet is Version 4. A lot of effort has been expended in designing
a replacement called IP Version 6. IPv6 uses a different addressing
scheme and larger addresses. Linux has an implementation of IPv6, but
it isn't ready to document it in this book yet. The Linux kernel
support for IPv6 is good, but a large number of network applications
need to be modified to support it as well. Stay tuned.</P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.X-087-2-FNIS02"
HREF="x-087-2-issues.ip-addresses.html#X-087-2-FNIS02"
>[2]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>Frequently, IP addresses will be assigned to you by the provider from
whom you buy your IP connectivity. However, you may also apply to the
NIC directly for an IP address for your network by sending email to
<SPAN
CLASS="SYSTEMITEM"
>hostmaster@internic.net</SPAN
>, or
by using the form at <SPAN
CLASS="SYSTEMITEM"
>http://www.internic.net/</SPAN
>.</P
></TD
></TR
></TABLE
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x-087-2-issues.interfaces.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x-087-2-issues.arp.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Networking Interfaces</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="x-087-2-issues.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Address Resolution</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>