<chapter id="ipref-8"><title>TCP/IP and IPv4 in Depth (Reference)</title><highlights><para>This chapter provides TCP/IP network reference information about network
configuration files, including the types, their purpose, and the format of
the file entries. The existing network databases are also described in detail.
The chapter also shows how the structure of IPv4 addresses are derived, based
on defined network classifications and subnet numbers.</para><para>This chapter contains the following information:</para><itemizedlist><listitem><para><olink targetptr="ipconfig-12" remap="internal">TCP/IP Configuration Files</olink></para>
</listitem><listitem><para><olink targetptr="ipconfig-42" remap="internal">Network Databases and the nsswitch.conf
File</olink></para>
</listitem><listitem><para><olink targetptr="ipref-13" remap="internal">Routing Protocols in the Solaris
OS</olink></para>
</listitem><listitem><para><olink targetptr="ipref-4" remap="internal">Network Classes</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="ipconfig-12"><title>TCP/IP Configuration Files</title><para>Each system on the network obtains its TCP/IP configuration information
from the following TCP/IP configuration files and network databases: </para><itemizedlist><listitem><para><filename>/etc/hostname.</filename><replaceable>interface</replaceable> file</para>
</listitem><listitem><para><filename>/etc/nodename</filename> file</para>
</listitem><listitem><para><filename>/etc/defaultdomain</filename> file</para>
</listitem><listitem><para><filename>/etc/defaultrouter</filename> file (optional)</para>
</listitem><listitem><para><filename>hosts</filename> database</para>
</listitem><listitem><para><filename>netmasks</filename> database (optional)</para>
</listitem>
</itemizedlist><para>The Solaris installation program creates these files as part of the
installation process. You can also edit the files manually, as explained in
this section. The <filename>hosts</filename> and <filename>netmasks</filename> databases
are two of the network databases read by the name services available on Solaris
networks. <olink targetptr="ipconfig-42" remap="internal">Network Databases and the nsswitch.conf
File</olink> describes in detail the concept of network databases. .</para><sect2 id="ipconfig-13"><title><filename>/etc/hostname.</filename><replaceable>interface</replaceable> File</title><para>This file defines the physical network interfaces on the local
host. At least one <filename>/etc/hostname.</filename><replaceable>interface</replaceable> file
should exist on the local system. The Solaris installation program creates
an <filename>/etc/hostname</filename><replaceable>.interface</replaceable> file
for the first interface that is found during the installation process. This
interface usually has the lowest device number, for example <literal>eri0</literal>,
and is referred to as the <emphasis>primary network interface</emphasis>.
If the installation programs finds additional interfaces, you optionally can
configure them, as well, as part of the installation process.</para><para>If you add a new network interface to your system after installation,
you must create an <filename>/etc/hostname.</filename><replaceable>interface</replaceable> file
for that interface, as explained in <olink targetptr="fpdcn" remap="internal">How to Configure
a Physical Interface After System Installation</olink>. Also, for the Solaris
software to recognize and use the new network interface, you need to load
the interface's device driver into the appropriate directory. Refer to the
documentation that comes with the new network interface for the appropriate <replaceable>interface</replaceable> name and device driver instructions.</para><para>The basic <filename>/etc/hostname.</filename><replaceable>interface</replaceable> file
contains one entry: the host name or IPv4 address that is associated with
the network interface. The IPv4 address can be expressed in traditional dotted
decimal format or in CIDR notation. If you use a host name as the entry for
the <filename>/etc/hostname.</filename><replaceable>interface</replaceable> file,
that host name must also exist in the <filename>/etc/inet/hosts</filename> file. </para><para>For example, suppose <literal>smc0</literal> is the primary network
interface for a system that is called <literal>tenere</literal>. The <filename>/etc/hostname.smc0</filename> file could have as its entry an IPv4 address in dotted decimal
notation or in CIDR notation, or the host name <literal>tenere</literal> .</para><note><para>IPv6 uses the <filename>/etc/hostname6.</filename><replaceable>interface</replaceable> file for defining network interfaces. For more information,
refer to <olink targetptr="ipv6-ref-73" remap="internal">IPv6 Interface Configuration File</olink>.</para>
</note>
</sect2><sect2 id="ipconfig-15a"><title><filename>/etc/nodename</filename> File</title><para>This file should contain one entry: the host name of the local
system. For example, on system <literal>timbuktu</literal>, the file <filename>/etc/nodename</filename> would contain the entry <literal>timbuktu</literal>. </para>
</sect2><sect2 id="ipconfig-16"><title><filename>/etc/defaultdomain</filename> File</title><para>This file should contain one entry: the fully qualified domain
name of the administrative domain to which the local host's network belongs.
You can supply this name to the Solaris installation program or edit the file
at a later date. For more information on network domains, refer to <olink targetdoc="sysadv5" remap="external"><citetitle remap="book">System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)</citetitle></olink>.</para>
</sect2><sect2 id="ipconfig-17"><title><filename>/etc/defaultrouter</filename> File</title><para>This file can contain an entry for each router that is directly
connected to the network. The entry should be the name for the network interface
that functions as a router between networks. The presence of the <filename>/etc/defaultrouter</filename> file indicates that the system is configured to support static
routing.</para>
</sect2><sect2 id="ipconfig-18"><title><filename>hosts</filename> Database</title><para>The <filename>hosts</filename> database contains the IPv4 addresses
and host names of systems on your network. If you use the NIS or DNS name
service, or the LDAP directory service, the <filename>hosts</filename> database
is maintained in a database that is designated for host information. For example,
on a network that runs NIS, the <filename>hosts</filename> database is maintained
in the <filename>hostsbyname</filename> file. </para><para>If you use local files for the name service, the <filename>hosts</filename> database
is maintained in the <filename>/etc/inet/hosts</filename> file. This file
contains the host names and IPv4 addresses of the primary network interface,
other network interfaces that are attached to the system, and any other network
addresses that the system must check for. </para><note><para>For compatibility
with BSD-based operating systems, the <filename>/etc/hosts</filename> file
is a symbolic link to <filename>/etc/inet/hosts</filename>. </para>
</note><sect3 id="ipconfig-19"><title><filename>/etc/inet/hosts</filename> File Format</title><para>The <filename>/etc/inet/hosts</filename> file uses the basic syntax
that follows. Refer to the <olink targetdoc="refman4" targetptr="hosts-4" remap="external"><citerefentry><refentrytitle>hosts</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page for complete syntax information. </para><para><replaceable>IPv4-address    hostname   [nicknames]   [#comment]</replaceable></para><variablelist><varlistentry><term><replaceable>IPv4-address</replaceable></term><listitem><para>Contains the IPv4 address for each interface that the local
host must recognize. </para>
</listitem>
</varlistentry><varlistentry><term><replaceable>hostname</replaceable></term><listitem><para>Contains the host name that is assigned to the system at setup,
plus the host names that are assigned to additional network interfaces that
the local host must recognize.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>[nickname]</replaceable></term><listitem><para>Is an optional field that contains a nickname for the host.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>[#comment]</replaceable></term><listitem><para>Is an optional field for a comment.</para>
</listitem>
</varlistentry>
</variablelist>
</sect3><sect3 id="ipconfig-20"><title>Initial <filename>/etc/inet/hosts</filename> File</title><para>When you run the Solaris installation program on a system, the
program configures the initial <filename>/etc/inet/hosts</filename> file.
This file contains the minimum entries that the local host requires. The entries
include the loopback address, the host IPv4 address, and the host name. </para><para>For example, the Solaris installation program might create the following <filename>/etc/inet/hosts</filename> file for system <literal>tenere</literal> shown
in <olink targetptr="ipconfig-fig-10" remap="internal">Figure 5&ndash;1</olink>:</para><example id="ipconfig-ex-21"><title><filename>/etc/inet/hosts</filename> File
for System <literal>tenere</literal></title><screen>127.0.0.1     localhost         loghost    #loopback address
192.168.200.3   tenere                      #host name</screen>
</example><sect4 id="ipconfig-22"><title>Loopback Address</title><para>In <olink targetptr="ipconfig-ex-21" remap="internal">Example 10&ndash;1</olink>,
the IPv4 address <literal>127.0.0.1</literal> is the <emphasis>loopback address</emphasis>.
The loopback address is the reserved network interface that is used by the
local system to allow interprocess communication. This address enables the
host to send packets to itself. The <command>ifconfig</command> command uses
the loopback address for configuration and testing, as explained in <olink targetptr="ipconfig-141" remap="internal">Monitoring the Interface Configuration With the ifconfig
Command</olink>. Every system on a TCP/IP network must use the IP address <literal>127.0.0.1</literal> for IPv4 loopback on the local host. </para>
</sect4><sect4 id="ipconfig-23"><title>Host Name</title><para>The IPv4 address <literal>192.168.200.1</literal> and the name <literal>tenere</literal> are the address and host name of the local system. They are
assigned to the system's primary network interface. </para>
</sect4><sect4 id="ipconfig-24a"><title>Multiple Network Interfaces</title><para>Some systems have more than one network interface, because they are
either routers or multihomed hosts. Each network interface that is attached
to the system requires its own IP address and associated name. During installation,
you must configure the primary network interface. If a particular system has
multiple interfaces at installation time, the Solaris installation program
also prompts you about these additional interfaces. You can optionally configure
one or more additional interfaces at this time, or manually, at a later date.</para><para>After Solaris installation, you can configure additional interfaces
for a router or multihomed host by adding interface information to the systems' <filename>/etc/inet/hosts</filename> file. For more information on configuring routers
and multihomed hosts refer to <olink targetptr="ipconfig-116" remap="internal">Configuring
an IPv4 Router</olink> and <olink targetptr="ipconfig-22a" remap="internal">Configuring Multihomed
Hosts</olink>.</para><para><olink targetptr="ipconfig-ex-25" remap="internal">Example 10&ndash;2</olink> shows the <filename>/etc/inet/hosts</filename> file for system <literal>timbuktu</literal> that
is shown in <olink targetptr="ipconfig-fig-10" remap="internal">Figure 5&ndash;1</olink>.</para><example id="ipconfig-ex-25"><title><filename>/etc/inet/hosts</filename> File
for System <literal>timbuktu</literal></title><screen>127.0.0.1        localhost     loghost
192.168.200.70   timbuktu      #This is the local host name
192.168.201.10   timbuktu-201  #Interface to network 192.9.201</screen>
</example><para>With these two interfaces, <literal>timbuktu</literal> connects
networks <literal>192.168.200</literal> and <literal>192.168.201</literal> as
a router. </para>
</sect4>
</sect3><sect3 id="ipconfig-26"><title>How Name Services Affect the <filename>hosts</filename> Database</title><para>The NIS and DNS name services, and LDAP directory service, maintain
host names and addresses on one or more servers. These servers maintain <filename>hosts</filename> databases that contain information for every host and router
(if applicable) on the servers' network. Refer to <olink targetdoc="sysadv5" remap="external"><citetitle remap="book">System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)</citetitle></olink> for more information about these services.</para><sect4 id="ipconfig-27"><title>When Local Files Provide the Name Service</title><para>On a network that uses local files for the name service, systems
that run in local files mode consult their individual <filename>/etc/inet/hosts</filename> files
for IPv4 addresses and host names of other systems on the network. Therefore,
these system's <filename>/etc/inet/hosts</filename> files must contain the
following: </para><itemizedlist><listitem><para>Loopback address</para>
</listitem><listitem><para>IPv4 address and host name of the local system (primary network
interface)</para>
</listitem><listitem><para>IPv4 address and host name of additional network interfaces
that are attached to this system, if applicable</para>
</listitem><listitem><para>IPv4 addresses and host names of all hosts on the local network</para>
</listitem><listitem><para>IPv4 addresses and host names of any routers that this system
must know about, if applicable</para>
</listitem><listitem><para>IPv4 address of any system your system wants to refer to by
its host name</para>
</listitem>
</itemizedlist><para><olink targetptr="ipref-fig-17" remap="internal">Figure 10&ndash;1</olink> shows
the <filename>/etc/inet/hosts</filename> file for system <literal>tenere</literal>.
This system runs in local files mode. Notice that the file contains the IPv4
addresses and host names for every system on the <literal>192.9.200</literal> network.
The file also contains the IPv4 address and interface name <literal>timbuktu-201</literal>.
This interface connects the <literal>192.9.200</literal> network to the <literal>192.9.201</literal> network. </para><para>A system that is configured as a network client uses the local <filename>/etc/inet/hosts</filename> file for its loopback address and IPv4 address.</para><figure id="ipref-fig-17"><title><filename>/etc/inet/hosts</filename> File
for a System Running in Local Files Mode</title><mediaobject><imageobject><imagedata entityref="fig196.epsi" width="100"/>
</imageobject><textobject><simpara>Shows what the hosts file might look like for a system
that is running in local files mode.</simpara>
</textobject>
</mediaobject>
</figure>
</sect4>
</sect3>
</sect2><sect2 id="ipconfig-30"><title><filename>netmasks</filename> Database</title><para>You need to edit the <filename>netmasks</filename> database as
part of network configuration <emphasis>only</emphasis> if you have set up
subnetting on your network. The <filename>netmasks</filename> database consists
of a list of networks and their associated subnet masks.</para><note><para>When you create subnets, each new network must be a separate physical
network. You cannot apply subnetting to a single physical network.</para>
</note><sect3 id="ipconfig-31"><title>What Is Subnetting?</title><para><emphasis>Subnetting</emphasis> is a method for maximizing the
limited 32-bit IPv4 addressing space and reducing the size of the routing
tables in a large internetwork. With any address class, subnetting provides
a means of allocating a part of the host address space to network addresses,
which lets you have more networks. The part of the host address space that
is allocated to new network addresses is known as the <emphasis>subnet number</emphasis>.</para><para>In addition to making more efficient use of the IPv4 address space,
subnetting has several administrative benefits. Routing can become very complicated
as the number of networks grows. A small organization, for example, might
give each local network a class C number. As the organization grows, the administration
of a number of different network numbers could become complicated. A better
idea is to allocate a few class B network numbers to each major division in
an organization. For example, you could allocate one Class B network to Engineering,
one Class B to Operations, and so on. Then, you could divide each class B
network into additional networks, using the additional network numbers gained
by subnetting. This division can also reduce the amount of routing information
that must be communicated among routers.</para>
</sect3><sect3 id="ipconfig-32"><title>Creating the Network Mask for IPv4 Addresses</title><para>As part of the subnetting process, you need to select a network-wide <emphasis>netmask</emphasis>. The netmask determines how many and which bits in the
host address space represent the subnet number and how many and which bits
represent the host number. Recall that the complete IPv4 address consists
of 32 bits. Depending on the address class, as many as 24 bits and as few
as 8 bits can be available for representing the host address space. The netmask
is specified in the <filename>netmasks</filename> database.</para><para>If you plan to use subnets, you must determine your netmask before you
configure TCP/IP. If you plan to install the operating system as part of network
configuration, the Solaris installation program requests the netmask for your
network.</para><para>As described in <olink targetptr="ipplan-5" remap="internal">Designing an IPv4 Addressing
Scheme</olink>, 32-bit IP addresses consist of a network part and a host part.
The 32 bits are divided into 4 bytes. Each byte is assigned to either the
network number or the host number, depending on the network class. </para><para>For example, in a class B IPv4 address, the 2 bytes on the left are
assigned to the network number, and the 2 bytes on the right are assigned
to the host number. In the class B IPv4 address <literal>172.16.10</literal>,
you can assign the 2 bytes on the right to hosts.</para><para>If you are to implement subnetting, you need to use some of the bits
in the bytes that are assigned to the host number to apply to subnet addresses.
For example, a 16-bit host address space provides addressing for 65,534 hosts.
If you apply the third byte to subnet addresses and the fourth byte to host
addresses, you can address up to 254 networks, with up to 254 hosts on each
network.</para><para>The bits in the host address bytes that are applied to subnet addresses
and those applied to host addresses are determined by a <emphasis>subnet mask</emphasis>.
Subnet masks are used to select bits from either byte for use as subnet addresses.
Although netmask bits must be contiguous, they need not align on byte boundaries.</para><para>The netmask can be applied to an IPv4 address by using the bitwise
logical AND operator. This operation selects out the network number and subnet
number positions of the address. </para><para>Netmasks can be explained in terms of their binary representation.
You can use a calculator for binary-to-decimal conversion. The following examples
show both the decimal and binary forms of the netmask. </para><para>If a netmask <literal>255.255.255.0</literal> is applied to the IPv4
address <literal>172.16.41.101</literal>, the result is the IPv4 address of <literal>172.16.41.0.</literal></para><para><literal>172.16.41.101</literal> &amp; <literal>255.255.255.0</literal> = <literal>172.16.41.0</literal></para><para>In binary form, the operation is as follows:</para><para>10000001.10010000.00101001.01100101 (IPv4 address)</para><para>ANDed with</para><para>11111111.11111111.11111111.00000000 (netmask)</para><para>Now the system looks for a network number of <literal>172.16.41</literal> instead
of a network number of <literal>172.16</literal>. If your network has the
number <literal>172.16.41</literal>, that number is what the system checks
for and finds. Because you can assign up to 254 values to the third byte of
the IPv4 address space, subnetting lets you create address space for 254 networks,
where previously space was available for only one.</para><para>If you are providing address space for only two additional networks,
you can use the following subnet mask:</para><para><literal>255.255.192.0</literal></para><para>This netmask provides the following result:</para><para>11111111.11111111.1100000.00000000</para><para>This result still leaves 14 bits available for host addresses.
Because all 0s and 1s are reserved, at least 2 bits must be reserved for the
host number. </para>
</sect3><sect3 id="ipconfig-33"><title><filename>/etc/inet/netmasks</filename> File</title><para>If your network runs NIS or LDAP, the servers for these name services
maintain <filename>netmasks</filename> databases. For networks that use local
files for the name service, this information is maintained in the <filename>/etc/inet/netmasks</filename> file. </para><note><para>For compatibility with BSD-based operating systems, the <filename>/etc/netmasks</filename> file is a symbolic link to <filename>/etc/inet/netmasks</filename>.</para>
</note><para>The following example shows the <filename>/etc/inet/netmasks</filename> file
for a class B network. </para><example id="ipconfig-ex-34"><title><filename>/etc/inet/netmasks</filename> File
for a Class B Network</title><screen> # The netmasks file associates Internet Protocol (IPv4) address
 # masks with IPv4 network numbers.
 #
 # 	network-number	netmask
 #
 # Both the network-number and the netmasks are specified in
 # &ldquo;decimal dot&rdquo; notation, e.g:
 #
 #        128.32.0.0   255.255.255.0
 192.168.0.0  255.255.255.0</screen>
</example><para>If the <filename>/etc/netmasks</filename> file does not exist, create
it with a text editor. Use the following syntax:</para><programlisting><replaceable>network-number	netmask-number</replaceable></programlisting><para>Refer to the <olink targetdoc="refman4" targetptr="netmasks-4" remap="external"><citerefentry><refentrytitle>netmasks</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page for complete details.</para><para>When creating netmask numbers, type the network number that is assigned
by the ISP or Internet Registry (not the subnet number) and the netmask number
in <filename>/etc/inet/netmasks</filename>. Each subnet mask should be on
a separate line.</para><para>For example: </para><screen>128.78.0.0	    255.255.248.0</screen><para>You can also type symbolic names for network numbers in the <filename>/etc/inet/hosts</filename> file. You can then use these network names instead
of the network numbers as parameters to commands. </para>
</sect3>
</sect2>
</sect1><sect1 id="ipv6-ref-32"><title><command>inetd</command> Internet Services
Daemon</title><para>The <command>inetd</command> daemon starts up Internet standard
services when a system boots, and can restart a service while a system is
running. Use the Service Management Facility (SMF) to modify the standard
Internet services or to have additional services started by the <command>inetd</command> daemon. </para><para>Use the following SMF commands to manage services started by <command>inetd</command>:</para><variablelist><varlistentry><term><command>svcadm</command></term><listitem><para>For administrative actions on a service, such as enabling,
disabling, or restarting. For details, refer to the <olink targetdoc="refman1m" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</varlistentry><varlistentry><term><command>svcs</command></term><listitem><para>For querying the status of a service. For details, refer to
the <olink targetdoc="refman1" targetptr="svcs-1" remap="external"><citerefentry><refentrytitle>svcs</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</varlistentry><varlistentry><term><command>inetadm</command></term><listitem><para>For displaying and modifying the properties of a service.
For details, refer to the <olink targetdoc="refman1m" targetptr="inetadm-1m" remap="external"><citerefentry><refentrytitle>inetadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</listitem>
</varlistentry>
</variablelist><para>The <literal>proto</literal> field value in the <command>inetadm</command> profile
for a particular service indicates the transport layer protocol on which the
service runs.  If the service is IPv4-only, the <literal>proto</literal> field
must be specified as <literal>tcp</literal>, <literal>udp</literal>, or <literal>sctp</literal>.</para><itemizedlist><listitem><para>For instructions on using the SMF commands, refer to <olink targetdoc="sysadv1" targetptr="dzhqq" remap="external"><citetitle remap="section">SMF Command-Line Administrative Utilities</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</listitem><listitem><para>For a task that uses the SMF commands to add a service that
runs over SCTP, refer to <olink targetptr="ermig" remap="internal">How to Add Services That
Use the SCTP Protocol</olink>.</para>
</listitem><listitem><para>For information on adding services that handle both IPv4 requests
and IPv6 requests, refer to <olink targetptr="ipv6-ref-32" remap="internal">inetd Internet
Services Daemon</olink></para>
</listitem>
</itemizedlist>
</sect1><sect1 id="ipconfig-42"><title>Network Databases and the <filename>nsswitch.conf</filename> File</title><para>The network databases are files that provide information that
is needed to configure the network. The network databases follow: </para><itemizedlist><listitem><para><filename>hosts</filename></para>
</listitem><listitem><para><filename>ipnodes</filename></para>
</listitem><listitem><para><filename>netmasks</filename></para>
</listitem><listitem><para><filename>ethers</filename> database</para>
</listitem><listitem><para><filename>bootparams</filename></para>
</listitem><listitem><para><filename>protocols</filename></para>
</listitem><listitem><para><filename>services</filename></para>
</listitem><listitem><para><filename>networks</filename></para>
</listitem>
</itemizedlist><para>As part of the configuration process, you edit the <filename>hosts</filename> database
and the <filename>netmasks</filename> database, if your network is subnetted.
Two network databases, <filename>bootparams</filename> and <filename>ethers</filename>,
are used to configure systems as network clients. The remaining databases
are used by the operating system and seldom require editing.</para><para>Although <filename>nsswitch.conf</filename> file is not a network
database, you need to configure this file along with the relevant network
databases. <filename>nsswitch.conf</filename> specifies which name service
to use for a particular system: local files, NIS, DNS, or LDAP. </para><sect2 id="ipconfig-43"><title>How Name Services Affect Network Databases</title><para>The format of your network database depends on the type of name
service you select for your network. For example, the <filename>hosts</filename> database
contains, at least the host name and IPv4 address of the local system and
any network interfaces that are directly connected to the local system. However,
the <filename>hosts</filename> database could contain other IPv4 addresses
and host names, depending on the type of name service on your network. </para><para>The network databases are used as follows: </para><itemizedlist><listitem><para>Networks that use local files for their name service rely on files
in the <filename>/etc/inet</filename> and <filename>/etc</filename> directories.</para>
</listitem><listitem><para>NIS uses databases that are called NIS maps.</para>
</listitem><listitem><para>DNS uses records with host information.</para>
</listitem>
</itemizedlist><note><para>DNS boot and data files do not correspond directly to the network
databases. </para>
</note><para>The following figure shows the forms of the <filename>hosts</filename> database
that are used by these name services.</para><figure id="ipconfig-fig-44"><title>Forms of the <filename>hosts</filename> Database
Used by Name Services</title><mediaobject><imageobject><imagedata entityref="fig197.eps"/>
</imageobject><textobject><simpara>This figure shows the various how the DNS, NIS, NIS+
name services and local files store the hosts database.</simpara>
</textobject>
</mediaobject>
</figure><para>The following table lists the network databases and their corresponding
local files and NIS maps.</para><note><para>The <filename>ipnodes</filename> database is removed from Solaris releases
after Solaris 10 11/06.</para>
</note><table frame="topbot" pgwide="1" id="ipconfig-tbl-46"><title>Network Databases
and Corresponding Name Service Files</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="column1" colwidth="72*"/><colspec colname="column2" colwidth="108*"/><colspec colname="column4" colwidth="108*"/><thead><row rowsep="1"><entry><para>Network  Database</para>
</entry><entry><para>Local Files</para>
</entry><entry><para>NIS Maps</para>
</entry>
</row>
</thead><tbody><row><entry><para><filename>hosts</filename> </para>
</entry><entry><para><filename>/etc/inet/hosts</filename></para>
</entry><entry><para><filename>hosts.byaddr  hosts.byname</filename></para>
</entry>
</row><row><entry><para><filename>ipnodes</filename></para>
</entry><entry><para><filename>/etc/inet/ipnodes</filename></para>
</entry><entry><para><filename>ipnodes.byaddr  ipnodes.byname</filename></para>
</entry>
</row><row><entry><para><filename>netmasks</filename> </para>
</entry><entry><para><filename>/etc/inet/netmasks</filename></para>
</entry><entry><para><filename>netmasks.byaddr</filename></para>
</entry>
</row><row><entry><para><filename>ethers</filename> </para>
</entry><entry><para><filename>/etc/ethers</filename></para>
</entry><entry><para><filename>ethers.byname  ethers.byaddr</filename></para>
</entry>
</row><row><entry><para><filename>bootparams</filename> </para>
</entry><entry><para><filename>/etc/bootparams</filename></para>
</entry><entry><para><filename>bootparams</filename></para>
</entry>
</row><row><entry><para><filename>protocols</filename> </para>
</entry><entry><para><filename>/etc/inet/protocols</filename></para>
</entry><entry><para><filename>protocols.byname  protocols.bynumber</filename></para>
</entry>
</row><row><entry><para><filename>services</filename> </para>
</entry><entry><para><filename>/etc/inet/services</filename></para>
</entry><entry><para><filename>services.byname</filename></para>
</entry>
</row><row><entry><para><filename>networks</filename> </para>
</entry><entry><para><filename>/etc/inet/networks</filename></para>
</entry><entry><para><filename>networks.byaddr  networks.byname</filename></para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>This book discusses network databases as they are viewed by networks
that use local files for name services.</para><itemizedlist><listitem><para>Information about the <filename>hosts</filename> database
is in <olink targetptr="ipconfig-18" remap="internal">hosts Database</olink>.</para>
</listitem><listitem><para>Information about the <filename>netmasks</filename> database
is in <olink targetptr="ipconfig-30" remap="internal">netmasks Database</olink>. </para>
</listitem>
</itemizedlist><para>Refer to <olink targetdoc="sysadv5" remap="external"><citetitle remap="book">System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)</citetitle></olink> for
information on network databases correspondences in NIS, DNS, and LDAP. </para>
</sect2><sect2 id="ipconfig-47"><title><filename>nsswitch.conf</filename> File</title><para>The <filename>/etc/nsswitch.conf</filename> file defines the search
order of the network databases. The Solaris installation program creates a
default <filename>/etc/nsswitch.conf</filename> file for the local system,
based on the name service you indicate during the installation process. If
you selected the &ldquo;None&rdquo; option, indicating local files for name
service, the resulting <filename>nsswitch.conf</filename> file resembles the
following example. </para><example id="ipconfig-ex-48"><title><filename>nsswitch.conf</filename> for
Networks Using Files for Name Service</title><screen># /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf;
# it does not use any naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file contains "switch.so" as a
# nametoaddr library for "inet" transports.

passwd:          files
group:           files
hosts:           files
networks:        files
protocols:       files
rpc:             files
ethers:          files
netmasks:        files
bootparams:      files
publickey:       files
# At present there isn't a 'files' backend for netgroup; the
# system will figure it out pretty quickly,
# and won't use netgroups at all.
netgroup:        files
automount:       files
aliases:         files
services:        files
sendmailvars:    files</screen>
</example><para>The <olink targetdoc="refman4" targetptr="nsswitch.conf-4" remap="external"><citerefentry><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page describes the file in detail. The basic syntax
is shown here: </para><para><replaceable>database   name-service-to-search</replaceable></para><para>The <replaceable>database</replaceable> field can list one of
many types of databases that are searched by the operating system. For example,
the field could indicate a database that affects users, such as <filename>passwd</filename> or <filename>aliases</filename>, or a network database. The parameter <replaceable>name-service-to-search</replaceable> can have the values <literal>files</literal>, <literal>nis</literal>,
or <literal>nis+</literal> for the network databases. The <filename>hosts</filename> database
can also have <literal>dns</literal> as a name service to search. You can
also list more than one name service, such as <literal>nis+</literal> and <literal>files</literal>. </para><para>In <olink targetptr="ipconfig-ex-48" remap="internal">Example 10&ndash;4</olink>, the
only search option that is indicated is <literal>files</literal>. Therefore,
the local system obtains security and automounting information, in addition
to network database information, from files that are located in its <filename>/etc</filename> and <filename>/etc/inet</filename> directories.</para><sect3 id="ipconfig-49"><title>Changing <filename>nsswitch.conf</filename></title><para>The <filename>/etc</filename> directory contains the <filename>nsswitch.conf</filename> file that is created by the Solaris installation program. This
directory also contains template files for the following name services: </para><itemizedlist><listitem><para><filename>nsswitch.files</filename></para>
</listitem><listitem><para><filename>nsswitch.nis</filename></para>
</listitem><listitem><para><filename>nsswitch.nis+</filename></para>
</listitem>
</itemizedlist><para>If you want to change from one name service to another name service,
you can copy the appropriate template to <filename>nsswitch.conf</filename>.
You can also selectively edit the <filename>nsswitch.conf</filename> file,
and change the default name service to search for individual databases.</para><para>For example, on a network that runs NIS, you might have to change the <filename>nsswitch.conf</filename> file on network clients. The search path for the <filename>bootparams</filename> and <filename>ethers</filename> databases must list <literal>files</literal> as the first option, and then <literal>nis</literal>. The
following example shows the correct search paths.</para><example id="ipconfig-ex-50"><title><filename>nsswitch.conf</filename> for
a Client on a Network Running NIS</title><screen># /etc/nsswitch.conf:#
.
.
passwd:        files nis
group:         file nis

# consult /etc "files" only if nis is down.
hosts:         nis    [NOTFOUND=return] files
networks:      nis    [NOTFOUND=return] files
protocols:     nis    [NOTFOUND=return] files
rpc:           nis    [NOTFOUND=return] files
ethers:        files  [NOTFOUND=return] nis
netmasks:      nis    [NOTFOUND=return] files	
bootparams:    files  [NOTFOUND=return] nis
publickey:     nis    
netgroup:      nis

automount:     files nis
aliases:       files nis

# for efficient getservbyname() avoid nis
services:      files nis
sendmailvars:  files</screen>
</example><para>For complete details on the name service switch, refer to <olink targetdoc="sysadv5" remap="external"><citetitle remap="book">System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)</citetitle></olink>.</para>
</sect3>
</sect2><sect2 id="ipconfig-51"><title><filename>bootparams</filename> Database</title><para>The <filename>bootparams</filename> database contains information
that is used by systems that are configured to boot in network client mode.
You need to edit this database if your network has network clients. See <olink targetptr="ipconfig-89" remap="internal">Configuring Network Clients</olink> for the procedures.
The database is built from information that is entered into the <filename>/etc/bootparams</filename> file. </para><para>The <olink targetdoc="refman4" targetptr="bootparams-4" remap="external"><citerefentry><refentrytitle>bootparams</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page contains the complete syntax for this database. Basic syntax is shown
here:</para><para><replaceable>system-name  file-key-server-name:pathname</replaceable></para><para>For each network client system, the entry might contain the following
information: the name of the client, a list of keys, the names of servers,
and path names. The first item of each entry is the name of the client system.
All items but the first item are optional. An example follows.</para><example id="ipconfig-ex-52"><title><filename>bootparams</filename> Database</title><screen>myclient   root=myserver : /nfsroot/myclient  \
swap=myserver : /nfsswap//myclient \
dump=myserver : /nfsdump/myclient</screen>
</example><para>In this example, the term <literal>dump=</literal> tells client hosts
not to look for a dump file.</para><sect3 id="ipconfig-53"><title>Wildcard Entry for <filename>bootparams</filename></title><para>In most instances, use the wildcard entry when editing the <filename>bootparams</filename> database to support clients. This entry follows: </para><programlisting>*  root=server:/path dump=:</programlisting><para>The asterisk (*) wildcard indicates that this entry applies to all clients
that are not specifically named within the <filename>bootparams</filename> database.</para>
</sect3>
</sect2><sect2 id="ipconfig-54"><title><filename>ethers</filename> Database</title><para>The <filename>ethers</filename> database is built from information
that is entered into the <filename>/etc/ethers</filename> file. This database
associates host names to their <emphasis>Media Access Control</emphasis> (MAC)
addresses. You need to create an <filename>ethers</filename> database only
if you are running the RARP daemon. That is, you need to create this database
if you are configuring network clients. </para><para>RARP uses the file to map MAC addresses to IP addresses. If you
are running the RARP daemon <command>in.rarpd</command>, you need to set up
the <filename>ethers</filename> file and maintain this file on all hosts that
are running the daemon to reflect changes to the network. </para><para>The <olink targetdoc="refman4" targetptr="ethers-4" remap="external"><citerefentry><refentrytitle>ethers</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page contains the complete syntax for this database. The basic syntax is shown
here:</para><screen><replaceable>MAC-address   hostname   #comment</replaceable></screen><variablelist><varlistentry><term><replaceable>MAC-address</replaceable></term><listitem><para>MAC address of the host</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>hostname</replaceable></term><listitem><para>Official name of the host</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>#comment</replaceable></term><listitem><para>Any note that you want to append to an entry in the file</para>
</listitem>
</varlistentry>
</variablelist><para>The equipment manufacturer provides the MAC address. If a system does
not display the MAC address during the system booting process, see your hardware
manuals for assistance. </para><para>When adding entries to the <filename>ethers</filename> database, ensure
that host names correspond to the primary names in the <filename>hosts</filename> , not to the nicknames, as follows.</para><example id="ipconfig-ex-55"><title>Entries in the <filename>ethers</filename> Database</title><screen>8:0:20:1:40:16  fayoum
8:0:20:1:40:15  nubian 
8:0:20:1:40:7   sahara    # This is a comment
8:0:20:1:40:14  tenere </screen>
</example>
</sect2><sect2 id="ipconfig-56"><title>Other Network Databases</title><para>The remaining network databases seldom need to be edited.</para><sect3 id="ipconfig-57"><title><filename>networks</filename> database</title><para>The <filename>networks</filename> database associates network
names with network numbers, enabling some applications to use and display
names rather than numbers. The <filename>networks</filename> database is based
on information in the <filename>/etc/inet/networks</filename> file. This file
contains the names of all networks to which your network connects through
routers. </para><para>The Solaris installation program configures the initial <filename>networks</filename> database.
However, if you add a new network to your existing network topology, you must
update this database.</para><para>The <olink targetdoc="refman4" targetptr="networks-4" remap="external"><citerefentry><refentrytitle>networks</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page contains the complete syntax for <filename>/etc/inet/networks</filename>.
The basic format is shown here:</para><screen><replaceable>network-name  network-number  nickname(s)  #comment</replaceable></screen><variablelist><varlistentry><term><replaceable>network-name</replaceable></term><listitem><para>Official name for the network</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>network-number</replaceable></term><listitem><para>Number assigned by the ISP or Internet Registry</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>nickname</replaceable></term><listitem><para>Any other name by which the network is known</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>#comment</replaceable></term><listitem><para>Any note that you want to append to an entry in the file</para>
</listitem>
</varlistentry>
</variablelist><para>You must maintain the <filename>networks</filename> file. The <command>netstat</command> program uses the information in this database to produce status
tables.</para><para>A sample <filename>/etc/networks</filename> file follows.</para><example id="ipconfig-ex-58"><title><filename>/etc/networks</filename> File</title><screen>#ident	"@(#)networks	1.4	92/07/14 SMI"	/* SVr4.0 1.1	*/
#
# The networks file associates Internet Protocol (IP) network
# numbers with network names. The format of this file is:
#
# 	network-name		 	 network-number		 	 nicnames . . .

# The loopback network is used only for intra-machine communication
loopback		 	 127

#
# Internet networks
#
arpanet     10	   arpa  # Historical
#
# local networks

eng   192.168.9 #engineering
acc   192.168.5 #accounting
prog  192.168.2 #programming</screen>
</example>
</sect3>
</sect2><sect2 id="ipconfig-59"><title><filename>protocols</filename> Database</title><para>The <filename>protocols</filename> database lists the TCP/IP protocols
that are installed on your system and their protocol numbers. The Solaris
installation program automatically creates the database. This file seldom
requires any administration. </para><para>The <olink targetdoc="refman4" targetptr="protocols-4" remap="external"><citerefentry><refentrytitle>protocols</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page describes the syntax of this database. An example of the <filename>/etc/inet/protocols</filename> file follows.</para><example id="ipconfig-ex-60"><title><filename>/etc/inet/protocols</filename> File</title><screen>#
# Internet (IP) protocols
#
ip    0   IP    # internet protocol, pseudo protocol number
icmp  1   ICMP  # internet control message protocol
tcp   6   TCP   # transmission control protocol
udp  17   UDP   # user datagram protocol</screen>
</example>
</sect2><sect2 id="ipconfig-61"><title><filename>services</filename> Database</title><para>The <filename>services</filename> database lists the names of
TCP and UDP services and their well-known port numbers. This database is used
by programs that call network services. The Solaris installation automatically
creates the <filename>services</filename> database. Generally, this database
does not require any administration. </para><para>The <olink targetdoc="refman4" targetptr="services-4" remap="external"><citerefentry><refentrytitle>services</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page contains complete syntax information. An excerpt from a typical <filename>/etc/inet/services</filename> file follows.</para><example id="ipconfig-ex-62"><title><filename>/etc/inet/services</filename> File</title><screen>#
# Network services
#
echo      7/udp
echo      7/tcp
echo      7/sctp6
discard   9/udp     sink null
discard   11/tcp
daytime   13/udp
daytime   13/tcp
netstat   15/tcp
ftp-data  20/tcp
ftp       21/tcp
telnet    23/tcp
time      37/tcp    timeserver
time      37/udp    timeserver
name      42/udp    nameserver
whois     43/tcp    nickname</screen>
</example>
</sect2>
</sect1><sect1 id="ipref-13"><title>Routing Protocols in the Solaris OS</title><para>Solaris system software supports two routing protocols: Routing
Information Protocol (RIP) and ICMP Router Discovery (RDISC). RIP and RDISC
are both standard TCP/IP protocols. </para><sect2 id="ipref-14"><title>Routing Information Protocol (RIP)</title><para>RIP is implemented by <command>in.routed</command>, the routing
daemon, which automatically starts when the system boots. When run on a router
with the <option role="nodash">s</option> option specified, <command>in.routed</command> fills
the kernel routing table with a route to every reachable network and advertises &ldquo;reachability&rdquo;
through all network interfaces. </para><para>When run on a host with the <option role="nodash">q</option> option
specified, <command>in.routed</command> extracts routing information but does
not advertise reachability. On hosts, routing information can be extracted
in two ways: </para><itemizedlist><listitem><para>Do <emphasis>not</emphasis> specify the <option role="nodash">S</option> flag
(capital &ldquo;S&rdquo;: &ldquo;Space-saving mode&rdquo;). <command>in.routed</command> builds
a full routing table exactly as it does on a router. </para>
</listitem><listitem><para>Specify the <option role="nodash">S</option> flag. <command>in.routed</command> creates a minimal kernel table, containing a single default route
for each available router.</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="ipref-15"><title>ICMP Router Discovery (RDISC) Protocol</title><para>Hosts use RDISC to obtain routing information from routers. Thus,
when hosts are running RDISC, routers must also run another protocol, such
as RIP, in order to exchange router information. </para><para>RDISC is implemented by <command>in.routed</command>, which should
run on both routers and hosts. On hosts, <command>in.routed</command> uses
RDISC to  discover default routes from routers that advertise themselves through
RDISC.  On routers, <command>in.routed</command> uses RDISC to advertise default
routes to  hosts on directly-connected networks.  See the <olink targetdoc="refman1m" targetptr="in.routed-1m" remap="external"><citerefentry><refentrytitle>in.routed</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page
and the <olink targetdoc="refman4" targetptr="gateways-4" remap="external"><citerefentry><refentrytitle>gateways</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man
page.</para>
</sect2>
</sect1><sect1 id="ipref-4"><title>Network Classes</title><note><para>Class-based network numbers are no longer available from the IANA,
though many older networks are still class-based.</para>
</note><para>This section provides details about IPv4 network classes. Each class
uses the 32-bit IPv4 address space differently, providing more or fewer bits
for the network part of the address. These classes are class A, class B, and
class C.</para><sect2 id="ipref-5"><title>Class A Network Numbers</title><para>A class A network number uses the first 8 bits of the IPv4 address
as its &ldquo;network part.&rdquo; The remaining 24 bits contain the host
part of the IPv4 address, as the following figure illustrates. </para><figure id="ipplan-fig-13"><title>Byte Assignment in a Class A Address</title><mediaobject><imageobject><imagedata entityref="fig140.epsi"/>
</imageobject><textobject><simpara>Diagram shows bits 0-7 is network part and remaining
24 bits are host part of a 32 bit IPv4 Class A address.</simpara>
</textobject>
</mediaobject>
</figure><para>The values that are assigned to the first byte of class A network numbers
fall within the range 0&ndash;127. Consider the IPv4 address <literal>75.4.10.4</literal>.
The value 75 in the first byte indicates that the host is on a class A network.
The remaining bytes, <literal>4.10.4</literal>, establish the host address.
Only the first byte of a class A number is registered with the IANA. Use of
the remaining three bytes is left to the discretion of the owner of the network
number. Only 127 class A networks exist. Each one of these numbers can accommodate
a maximum of 16,777,214 hosts.</para>
</sect2><sect2 id="ipref-6"><title>Class B Network Numbers</title><para>A class B network number uses 16 bits for the network number and
16 bits for host numbers. The first byte of a class B network number is in
the range 128&ndash;191. In the number <literal>172.16.50.56</literal>, the
first two bytes, <literal>172.16</literal>, are registered with the IANA,
and compose the network address. The last two bytes, <literal>50.56</literal>,
contain the host address, and are assigned at the discretion of the owner
of the network number. The following figure graphically illustrates a class
B address. </para><figure id="ipplan-fig-16"><title>Byte Assignment in a Class B Address</title><mediaobject><imageobject><imagedata entityref="fig139.epsi"/>
</imageobject><textobject><simpara>Diagram shows bits 0-15 is network part and remaining
16 bits are host part of a 32 bit IPv4 Class B address.</simpara>
</textobject>
</mediaobject>
</figure><para>Class B is typically assigned to organizations with many hosts
on their networks. </para>
</sect2><sect2 id="ipref-7"><title>Class C Network Numbers</title><para>Class C network numbers use 24 bits for the network number and
8 bits for host numbers. Class C network numbers are appropriate for networks
with few hosts&mdash;the maximum being 254. A class C network number occupies
the first three bytes of an IPv4 address. Only the fourth byte is assigned
at the discretion of the network owners. The following figure graphically
represents the bytes in a class C address. </para><figure id="ipplan-fig-19"><title>Byte Assignment in a Class C Address</title><mediaobject><imageobject><imagedata entityref="fig145.epsi"/>
</imageobject><textobject><simpara>Diagram shows bits 0-23 is network part and remaining
8 bits are host part of a 32 bit IPv4 Class C address.</simpara>
</textobject>
</mediaobject>
</figure><para>The first byte of a class C network number covers the range 192&ndash;223.
The second and third bytes each cover the range 1&ndash; 255. A typical class
C address might be <literal>192.168.2.5</literal>. The first three bytes, <literal>192.168.2</literal>, form the network number. The final byte in this example, <literal>5</literal>, is the host number.</para>
</sect2>
</sect1>
</chapter>