Tải bản đầy đủ
1 Routing tables: static and dynamic routing ¡ª a recap

1 Routing tables: static and dynamic routing ¡ª a recap

Tải bản đầy đủ

216

Routing tables and protocols

Figure 6.1 Next hop determination by routers using their routing table.

The creation and maintenance of the routing table are critical to the operation of a router.
The creation and updating of the routing table may be undertaken manually (by human network administrators — in which case the router is said to perform static routing), but this is
impractical in most networks. Alternatively, routing table creation and maintenance may be
undertaken automatically by the routers (in which case the routers perform dynamic routing).
Most routers even allow for a mix of the two methods — allowing some routing table entries
to be maintained statically (e.g. the default route and local route preferences) while leaving
the rest to be dynamically maintained. In this chapter we are concerned nearly exclusively
with dynamic routing.

6.2 Choosing the best route by comparing the routing distance
or cost of the alternatives
In order to perform dynamic updating of its routing table, a router has to gather routing
information about the ever-changing topology of the network. It then calculates the shortest routing distance (or route cost) to each reachable destination. Routing information is
exchanged between the routers in a network by means of a routing protocol.
Which information is used for the routing table calculation, how it is ‘weighted’, and the
calculation method used are determined by a set of rules (laid out in the routing policy and/or
routing protocol). Which policies and protocols are to be used are decided by the human
network administrator during configuration of each router.
The policy might include particular preferences when choosing between alternative routes
to a given destination (e.g. ‘use the cheapest route rather than the one with the least hops’,
‘use the route with the most bandwidth’, ‘ignore routing information received from party X’).
The determination of the best route to a particular destination is normally based upon the
shortest routing distance (or path cost) from the router in question. First, the individual link

Choosing the best route by comparing the routing distance or cost of the alternatives

217

distances (link costs) for all possible paths to the destination are added together. These are
the alternative path distances (or path costs). The path with the lowest overall path distance
(or path cost) is chosen to be the shortest path. The first hop of this path is inserted into the
router’s routing table as the next hop for purpose of forwarding packets.
Distances and costs are usually integer values. Paths with the lowest distance or cost are
most preferable. The distance or cost associated with each link in the network (i.e. between
each pair of routers) must be either assigned manually or calculated automatically by the
router. When assigned manually by the human router during the configuration of the router,
the value is known as the administrative distance or administrative cost. When calculated
automatically by the router, the distance or cost value can be changed over time to reflect
the link bit rate, current transmission delay, link loading, link reliability or some other metric.
Typical default costs are either the value ‘1’ for each link or a value equal to 1000 million
divided by the link bit rate. A standard link cost of ‘1’ will result in selection of the path with
the least number of hops. A link cost inversely proportional to the link bit rate will instead
tend to favour higher bit rate paths over lower bit rate paths.
Each router will either be configured to ‘know’, or will calculate, the distances or costs
of the links to which it is directly connected. Thus taken together, the routers have enough
information to calculate the shortest paths to all destinations. But before any single router
can determine its routing table, the routers must ‘pool’ their information — sharing what they
know with all the other routers in order that they can all create a ‘map’ of the network.
The communication of routing information from one router to another is the task of the
routing protocol. It allows information about link distances and the network topology to be
collated and used to create a routing table. Figure 6.2 illustrates a network ‘map’ in which
the entire routing information has been collated. Table 6.1 shows the associated shortest path
calculations and next hop determination as they will appear in the routing table.
You may be surprised to discover in the example of Figure 6.2 that not all the links have
the same distance associated with them. Some of the links shown also have a different distance
associated with them, dependent upon the direction in which they are traversed (e.g- routes
A-B; B-C and D-F). Such differences may also occur in practice (dependent upon the manner
in which the link distance or cost is calculated). But you may be most surprised to discover
which routes have been selected as having the shortest distance. The chosen routes for C-to-B
and C-to-A transit the routers D and F rather than taking what might seem to be the more

Figure 6.2 Example of network topology and link routing distances (integer values).

218

Routing tables and protocols
Table 6.1

Example routing table calculated from distances and topology of figure 6.2

Source router

Destination router

Shortest distance

A
A
A
A
A
B
B
B
B
B
C
C
Etc.

B
C
D
E
F
A
C
D
E
F
A
B
Etc.

2
5
6
4
3
3
3
4
5
1
7
4
Etc.

(Best path)
A−B
A−B−C
A−B−C−D
A−E
A−B−F
B−A
B−C
B−C−D
B−F−E
B−F
C−D−F−B−A
C−D−F−B
Etc.

Next hop
B
B
B
E
B
A
C
C
F
F
D
D
Etc.

obvious direct route C-to-B!! You may think this is a dumb decision! But consider a road
analogy, in which the route C-D-F-B is a motorway on which you can travel at high speed
while the ‘direct road’ C-B is a winding back lane with hold-ups. Which route would you
rather take then?

6.3 Storage, updating and recalculation of the routing table
and routing database
In order that the routing table of a router remains current, it must be continuously re-calculated,
using up-to-date routing information. This is an onerous task, requiring continuous routing
protocol exchange with other routers in the network and repeated re-calculation of routes.
Because of the heavy demands upon router processing and storage power for routing table
maintenance, it is usual for routers to be sub-divided functionally into two separate parts: a
forwarding engine and a routing engine — with dedicated hardware, processors and software
for each (Figure 6.3).
The forwarding engine is designed to be optimised for the processing and forwarding
of IP (Internet protocol) packets in the manner we discussed in Chapter 5. At all points in
time (after its initial calculation), the ‘current version’ of the routing table is stored in the
forwarding engine and is in permanent use. The routing engine, meanwhile, is fully occupied
with preparing an updated version of the routing table — as soon as it becomes necessary.
The routing engine stores the network topology database (or its otherwise-named equivalent). This is a collection of information about the locations of destinations, the available links
and the routing distances in the network. The database may take a form similar to Table 6.1
or may include additional fields, but at all times will keep an ‘image’ of the network topology
data on which the current routing table is based. The routing table itself is usually an extract
of this database. (The columns of most importance for the forwarding engine’s routing table
are those which are not shaded grey in Table 6.1. These columns link the destination with the
appropriate next hop.)
The routing engine keeps track of network topology changes by means of routing information updates received from other routers in the network by means of a routing protocol. The
routing protocol is used as the communication directly between routing engines. In effect, it
provides for an internal ‘network control channel’.
The routing protocol conveys the routing updates from one router’s routing engine to
another by copying either the entirety, or extracts, of the network topology database. Thus

The accuracy and stability of routing tables

219

Note: The communication ‘channel’ for the routing protocol is actually an IP
‘connection’ between the routers passing via the normal forwarding engine
part of the router (Figure 6.3). You may like to compare it with ITU-T’s c-plane
and m-plane communications model—Figure 3.31.
Figure 6.3

Typical router architecture — subdivided into forwarding and routing engines.

the routing engine of router A in Figure 6.2 would advertise the first five rows of Table 6.1
(these are the rows relevant to router A). The other routers would meanwhile independently
advertise the other rows. This enables each routing engine to maintain a complete and up-todate topology database (by listening to all relevant advertisements). As each update is received,
the router compares the new information with its existing database to determine whether any
topology changes have taken place. If so, a new routing table will be calculated, loaded into
the forwarding engine part of the router and activated.
By storing a complete image of the data used for the previous routing table calculation,
the re-calculation process can be simplified, and so speeded up. Furthermore, by storing all
the previously known data, the routing protocol usually needs only to send information about
real ‘changes’. This reduces the workload of the routing protocol and offloads traffic from the
IP forwarding network (with obvious cost and performance benefits).
There have been a number of different routing protocols developed over the years, and
each has its advantages and disadvantages. Each protocol is optimised for the particular mathematical method by which the shortest distance routes will be calculated. The format of the
protocols, as we shall see later in the chapter, usually directly reflect the data records which
are held in the related network topology or routing database.

6.4 The accuracy and stability of routing tables
Router networks work most efficiently when their routing tables are both accurate and stable.
Inaccurate routing tables lead to misrouting of packets — delivering them to the wrong address,
losing them or sending them in endless circular routes around the network.