243 lines
5.0 KiB
HTML
243 lines
5.0 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Resolving Host Names</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="The Internet Control Message Protocol"
|
|
HREF="x-087-2-issues.icmp.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Configuringthe NetworkingHardware"
|
|
HREF="x-087-2-hardware.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.icmp.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-hardware.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="X-087-2-ISSUES.RESOLVING"
|
|
>2.6. Resolving Host Names</A
|
|
></H1
|
|
><P
|
|
>As described previously, addressing in TCP/IP networking, at least for
|
|
IP Version 4, revolves around 32-bit numbers. However, you will have a
|
|
hard time remembering more than a few of these numbers. Therefore,
|
|
hosts are generally known by “ordinary” names such as
|
|
<SPAN
|
|
CLASS="SYSTEMITEM"
|
|
>gauss</SPAN
|
|
> or <SPAN
|
|
CLASS="SYSTEMITEM"
|
|
>strange</SPAN
|
|
>. It becomes the application's
|
|
duty to find the IP address corresponding to this name. This process
|
|
is called <I
|
|
CLASS="EMPHASIS"
|
|
>hostname resolution</I
|
|
>.</P
|
|
><P
|
|
>When an application needs to find the IP address of a given host, it
|
|
relies on the library functions <TT
|
|
CLASS="FUNCTION"
|
|
>gethostbyname(3)</TT
|
|
>
|
|
and <TT
|
|
CLASS="FUNCTION"
|
|
>gethostbyaddr(3)</TT
|
|
>. Traditionally, these and a
|
|
number of related procedures were grouped in a separate library called
|
|
the <I
|
|
CLASS="EMPHASIS"
|
|
>resolverlibrary</I
|
|
> ; on Linux, these functions
|
|
are part of the standard <TT
|
|
CLASS="FILENAME"
|
|
>libc</TT
|
|
>. Colloquially, this
|
|
collection of functions is therefore referred to as “the
|
|
resolver.” Resolver name configuration is detailed in <A
|
|
HREF="x-087-2-resolv.html"
|
|
>Chapter 6</A
|
|
>.</P
|
|
><P
|
|
>On a small network like an Ethernet or even a cluster of Ethernets, it
|
|
is not very difficult to maintain tables mapping hostnames to
|
|
addresses. This information is usually kept in a file named
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/etc/hosts</TT
|
|
>. When adding or removing hosts, or
|
|
reassigning addresses, all you have to do is update the
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>hosts</TT
|
|
> file on all hosts. Obviously, this will
|
|
become burdensome with networks that comprise more than a handful of
|
|
machines.</P
|
|
><P
|
|
>One solution to this problem is the <I
|
|
CLASS="EMPHASIS"
|
|
>Network Information
|
|
System</I
|
|
> (NIS), developed by Sun Microsystems, colloquially
|
|
called YP or Yellow Pages. NIS stores the <TT
|
|
CLASS="FILENAME"
|
|
>hosts</TT
|
|
>
|
|
file (and other information) in a database on a master host from which clients
|
|
may retrieve it as needed. Still, this approach is suitable only for
|
|
medium-sized networks such as LANs, because it involves maintaining
|
|
the entire <TT
|
|
CLASS="FILENAME"
|
|
>hosts</TT
|
|
> database centrally and distributing
|
|
it to all servers. NIS installation and configuration is discussed in
|
|
detail in <A
|
|
HREF="x-087-2-nis.html"
|
|
>Chapter 13</A
|
|
>.</P
|
|
><P
|
|
>On the Internet, address information was initially stored in a single
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>HOSTS.TXT</TT
|
|
> database, too. This file was maintained at
|
|
the <I
|
|
CLASS="EMPHASIS"
|
|
>Network Information Center</I
|
|
> (NIC), and had to
|
|
be downloaded and installed by all participating sites. When the network
|
|
grew, several problems with this scheme arose. Besides the administrative
|
|
overhead involved in installing <TT
|
|
CLASS="FILENAME"
|
|
>HOSTS.TXT</TT
|
|
> regularly,
|
|
the load on the servers that distributed it became too high. Even more
|
|
severe, all names had to be registered with the NIC, which made sure that
|
|
no name was issued twice.</P
|
|
><P
|
|
>This is why a new name resolution scheme was adopted in 1994: the
|
|
<I
|
|
CLASS="EMPHASIS"
|
|
>Domain Name System</I
|
|
>. DNS was designed by Paul
|
|
Mockapetris and addresses both problems simultaneously. We discuss the
|
|
Domain Name System in detail in <A
|
|
HREF="x-087-2-resolv.html"
|
|
>Chapter 6</A
|
|
>.</P
|
|
></DIV
|
|
><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.icmp.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-hardware.html"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>The Internet Control Message Protocol</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"
|
|
>Configuringthe NetworkingHardware</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |