Hosts and routers maintain a routing table which
is consulted when a datagram cannot be locally delivered. The
routing table indicates which router, of those available, is the
best next hop for the destination network address
of this particular datagram. For hosts, this is commonly done by
configuring a default route, since only one router
is usually available.
Where the network is more complex (for example, a router can be
connected to several other routers) a routing
protocol is used to maintain the routing tables. Routing
protocols operate by sending routing updates to
each of their neighbour routers, informing them of routes which
this router "knows about", and with some indication of how "close"
it is to the other networks -- this is called a
metric. Route information which has been received
at a router will be propagated to the next router, and so on.
Routers make decisions as to which route is the one they will use,
based on the routing metric information.
Different routing protocols are used within Autonomous
Systems (AS) -- typically organisation-level networks --
and the various high-speed intercontinental and international
backbone networks which make up the "heavy
haulage" sections of the Internet. Within an AS, the original
routing protocol was RIP, nowadays largely
replaced by OSPF. On the backbones, the original
protocol was EGP, now replaced by
BGP (strictly speaking, BGP4).
Detailed analysis of routing protocol operation is outside the
scope of this subject.