<sect1 id="ipplan-37"><title>Planning for Routers
on Your Network</title><para>Recall that in TCP/IP, two types of entities exist on a network:
hosts and routers. All networks must have hosts, while not all networks require
routers. The physical topology of the network determines if you need routers.
This section introduces the concepts of network topology and routing. These
concepts are important when you decide to add another network to your existing
network environment. </para><sect2 id="ipplan-38"><title>Network Topology Overview</title><para>Network topology describes how networks fit together. Routers
are the entities that connect networks to each other. A router is any machine
that has two or more network interfaces and implements IP forwarding. However,
the system cannot function as a router until properly configured, as described
in <olink targetptr="ipconfig-116" remap="internal">Configuring an IPv4 Router</olink>. </para><para>Routers connect two or more networks to form larger internetworks.
The routers must be configured to pass packets between two adjacent networks.
The routers also should be able to pass packets to networks that lie beyond
the adjacent networks. </para><para>The following figure shows the basic parts of a network topology. The
first illustration shows a simple configuration of two networks that are connected
by a single router. The second illustration shows a configuration of three
networks, interconnected by two routers. In the first example, Router R joins
Network 1 and Network 2 into a larger internetwork. In the second example,
Router R1 connects Networks 1 and 2. Router R2 connects Networks 2 and 3.
The connections form a network that includes Networks 1, 2, and 3.</para><figure id="ipplan-fig-39"><title>Basic Network Topology</title><mediaobject><imageobject><imagedata entityref="fig133.epsi"/>
</imageobject><textobject><simpara>Diagram shows the topology of two networks that are connected
by a single router.</simpara>
</textobject>
</mediaobject>
</figure><para>In addition to joining networks into internetworks, routers route packets
between networks that are based on the addresses of the destination network.
As internetworks grow more complex, each router must make more and more decisions
about the packet destinations. </para><para>The following figure shows a more complex case. Router R3 directly
connects networks 1 and 3. The redundancy improves reliability. If network
2 goes down, router R3 still provides a route between networks 1 and 3. You
can interconnect many networks. However, the networks must use the same network
protocols. </para><figure id="ipplan-fig-41"><title>A Network Topology That Provides an Additional
Path Between Networks</title><mediaobject><imageobject><imagedata entityref="fig144.epsi"/>
</imageobject><textobject><simpara>Diagram shows the topology of three networks that are
connected by two routers.</simpara>
</textobject>
</mediaobject>
</figure>
</sect2><sect2 id="ipplan-43"><title>How Routers Transfer Packets</title><para>The IP address of the recipient, which is a part of the packet
header, determines how the packet is routed. If this address includes the
network number of the local network, the packet goes directly to the host
with that IP address. If the network number is not the local network, the
packet goes to the router on the local network.</para><para>Routers maintain routing information in <emphasis>routing tables</emphasis>.
These tables contain the IP address of the hosts and routers on the networks
to which the router is connected. The tables also contain pointers to these
networks. When a router receives a packet, the router checks its routing table
to determine if the table lists the destination address in the header. If
the table does not contain the destination address, the router forwards the
packet to another router that is listed in its routing table. Refer to <olink targetptr="ipconfig-116" remap="internal">Configuring an IPv4 Router</olink> for detailed information
on routers. </para><para>The following figure shows a network topology with three networks that
are connected by two routers. </para><figure id="ipplan-fig-44"><title>A Network Topology With Three Interconnected
Networks</title><mediaobject><imageobject><imagedata entityref="fig146.epsi"/>
</imageobject><textobject><simpara>Diagram shows a sample of three networks that are connected
by two routers.</simpara>
</textobject>
</mediaobject>
</figure><para>Router R1 connects networks <literal>192.9.200</literal> and <literal>192.9.201</literal>. Router R2 connects networks <literal>192.9.201</literal> and <literal>192.9.202</literal>. If Host A on network <literal>192.9.200</literal>  sends
a message to Host B on network <literal>192.9.202</literal>, the following
events occur:</para><orderedlist><listitem><para>Host A sends a packet out over network <literal>192.9.200</literal>.
The packet header contains the IPv4 address of the recipient Host B, <literal>192.9.202.10</literal>.</para>
</listitem><listitem><para>None of the machines on network <literal>192.9.200</literal> has
the IPv4 address <literal>192.9.202.10</literal>. Therefore, Router R1 accepts
the packet.</para>
</listitem><listitem><para>Router R1 examines its routing tables. No machine on network <literal>192.9.201</literal> has the address <literal>192.9.202.10</literal>. However,
the routing tables do list Router R2.</para>
</listitem><listitem><para>R1 then selects R2 as the &ldquo;next hop&rdquo; Router. R1
sends the packet to R2. </para>
</listitem><listitem><para>Because R2 connects network <literal>192.9.201</literal> to <literal>192.9.202</literal>, R2 has routing information for Host B. Router R2 then
forwards the packet to network <literal>192.9.202</literal>, where Host B
accepts the packet. </para>
</listitem>
</orderedlist>
</sect2>
</sect1>