Tải bản đầy đủ
4 Routing table format ¡ª static and dynamic routing

4 Routing table format ¡ª static and dynamic routing

Tải bản đầy đủ

174

WANs, routers and the Internet protocol (IP)
Table 5.1

Table Ref.
i
ii

Detailed routing table for router C in figure 5.4
Address or
group of addresses

iii

0.0.0.0 (default route)
173.0.0.0 (except subnetworks 173.65.0.0 &
173.66.0.)
173.65.0.0 (except 173.65.8.0 & 173.65.9.0)

iv
v
vi
vii

173.65.8.0
173.65.9.0
173.66
195.52

Figure 5.4

Next hop of path to
destination
To Router B
To Router B
Destination within LAN
connected to C
To Router D
To Router F
To Router D
To Router B

Distribution of subnetworks within the Imaginary class A Internet address range 173.x.x.x.

numerical order. In the second column is listed the appropriate next hop of the path to the
corresponding address.
Figure 5.4 is a more detailed illustration of the network of Figure 5.2, showing how the
LANs and MANs connected to the routers B, C, D and F together provide the network for the
Internet class A address space corresponding to 173.x.x.x. The figure shows how the various
sub-ranges of addresses (i.e., the subnetworks of 173.x.x.x) are distributed across the individual
routers. Table 5.1 is the detailed routing table for router C.
Each of the routers in Figure 5.4 has been configured (probably manually) to recognise
the range of directly-connected IP-addresses (i.e., the ‘addresses in the LAN connected to’ as
it appears in Figure 5.4). All the addresses in each configured address range are considered

Routing table format — static and dynamic routing

175

to be reachable addresses 10 and will thus appear in the routing table of all the routers in
the network.
Critical for the proper operation of router networks is that the routing tables are kept up-todate. Any incorrect or out-of-date entries lead to mis-routing of packets, with the consequence
of delivery to the wrong destination, or to the inability of the network to deliver the packets
at all.
The maintenance of the routing table in a router (or in the embedded router of a host
device) may be conducted either manually by a human, or automatically by the router itself.
In the case of manual updating, the router and the routing table are said to undertake static
routing. In other words, the routes remain static (unchanged) except for human intervention.
In the case of automatic updating of the routing table (in response to network configuration
and routing information received from other routers by means of routing protocols), the router
is said to undertake dynamic routing.

Methodology and advantages of dynamic routing
The advantage of dynamic routing (automatic updating of routing tables) is that the network
adjusts its routing to all reachable destination addresses on an up-to-the-minute basis. Dynamic
routing automatically accommodates for:
• addition of new devices or addresses to the network;
• removal of devices or addresses from the network;
• moving of devices or address from one location in the network to another; and even for
• re-adjustment of routes when links between routers fail.
In a complex network using dynamic routing, the network can be subjected to continuous
re-configuration, even by many different un-coordinated parties, and yet the routing tables
always remain up-to-date, thus minimising the problems of mis-routing. This is perhaps the
greatest quality of the Internet — the ability to allow many different uncoordinated networks to
be internetworked with one another, while always maintaining an up-to-date routing scheme.
Understandably, dynamic routing is highly complex.
Routers undertake dynamic routing by sifting through lots of routing information received
from other routers by means of routing protocols. The analysis of the routing information is
carried out according to a routing policy (programmed into the router by a human) and using a
routing algorithm (pre-defined calculation method). The development of such routing policies
and routing algorithms is a highly complex mathematical challenge which we shall discuss in
Chapter 6.
For our current discussion on the Internet protocol (IP) and how routers forward packets,
it is sufficient for us to know that a routing table exists in each router. The routing table
provides an important resource for the Internet protocol in determining the next hop which
packets should be forwarded, but is not always 100% reliable. For this reason, the design
of the Internet protocol (IP) and associated routing protocols includes a number of measures
intended to:
• minimise misrouting arising from out-of-date information held in routing tables;
• discard packets which get lost or turn out to be undeliverable;
10
As far as routing protocol s are concerned, an address is considered to be reachable if a router recognises it
as belonging to one of its directly connected IP address-ranges. But this does not means that the address has
actually been configured for use by an end-user device, and does not exclude the possibility that a destination
device is unavailable, for example: switched off!

176

WANs, routers and the Internet protocol (IP)

• optimise routes to the shortest possible path, but adjust these routes (and the handling of
packets as necessary) to take account of prevailing network traffic demand; and
• cater for the different urgency of packet delivery required by different types of traffic.
To prevent against misrouting arising from out-of-date routing information, the routing table
is aged — routing table entries are simply deleted if they are not used within a given period of
time. On deletion of the ‘special route’ to a particular destination, routing to that destination
reverts to the default route valid for all destinations. Effectively, this turns the network into
a hierarchical network — concentrating routes via a few centralised and very powerful core
routers. But just in case any packets do get misrouted and get lost on an endless trek through
the network, or take too long trying the reach their destination, the Internet protocol uses a
simple mechanism to eradicate them. Packets which exceed their allowed time-to-live (TTL — a
field in the IP version 4 header) or exceed their maximum permitted hop count (a field in the
IP version 6 header: a hop is a link between two routers) are simply discarded. This simple
mechanism prevents the possibility of a gradual accumulation of undeliverable packets causing
network congestion.
Optimisation of routes to the shortest possible paths and adjusting routes according to prevailing network traffic demand are highly complex challenges. Delay sensitive communications
must be given priority. The IP-header packet fields type of service (TOS), IP precedence and
DiffServ (differential services) are used for this purpose.
For real-time communications flows (e.g., live video), it is important that all the packets
making up the communication stream take nearly the same time to propagate across the
network. A variation in the delay incurred by different packets would otherwise lead to jitter
of the signal. In this case, the connection as a whole is usually subjected to path-oriented
routing, and the individual packets are given a flow label (in IP version 6) which ensures that
all take the same route through the network.

Applications of static routing
While dynamic routing may be the only practicable means of keeping routing tables up-to-date
in fast-changing networks, the use of static routing may sometimes be more appropriate. The
main advantage of static routing is that network routes do not change quickly. This leads to
very predictable performance and easier troubleshooting of network performance problems.
Static routing is often employed by the embedded routers in end-systems (i.e., hosts) and
in access routers (e.g., a router connecting a single small LAN to the public Internet by means
of a single connection). The routing table of a static router may contain only two entries:
one entry accepts traffic from the Internet to the IP address range of the local network and
forwards it to the LAN. Meanwhile the default route simply forwards IP packets originated
by devices in the LAN to all other ‘unknown’ addresses via a standard default route — to the
public Internet.

5.5 Routing table conventions
It is usual to denote the default route entry in a routing table with the address entry 0.0.0.0.
The default route is the route which will be used for all IP-addresses which do not otherwise
specifically appear in the routing table. The ‘0’ values of the IP address ranges in the routing
table are used to denote ‘any valid numerical value’ (the valid values are 1–255 in the case of
IPv4 addresses). Thus the entry ‘173.65.8.0’ (Table 5.1) of router C of Figure 5.4 represents
all the addresses in the IP address range between values 173.65.8.1 and 173.65.8.255. All of
these addresses are reachable via router D.

Simple IP routing control mechanisms: time-to-live (ttl) and hop limit fields

177

When looking up a particular address in a routing table, the principle of finding the longest
match is applied. Let us ‘look up’ four addresses in Table 5.1: first, the address 173.65.8.2;
then, the address 195.52.3.5; third, the address 184.5.45.233; finally, the address 195.51.46.27.
The address 173.65.8.2 matches four of the entries in the routing table of Table 5.1 (entries
i, ii, iii and iv). The longest match is with entry iv, so the route chosen will be ‘next hop
via D’.
The address 195.52.3.5 matches two of the entries in Table 5.1 (entries i and vii). The
longest match is entry vii, so that the chosen route in this case will be ‘next hop via B’.
The address 184.5.45.233 does not appear in the routing table of Table 5.1 other than as
represented by the default address 0.0.0.0 (entry i), so in this case the default route to router
B will be selected. Similarly, the address 195.51.46.27 also only matches the default route
entry. (Note that entry vii of Table 5.1 only applies to the 195.52.x.x subnetwork portion of
the 195.x.x.x-address space.)

5.6 Simple IP routing control mechanisms: time-to-live (ttl) and hop limit
fields
Extreme care must be used when setting up routing tables (no matter whether they are set
up manually using static routing or automatically using dynamic routing). In particular it is
important to avoid the possibility of circular routing arising from routing loops. Figure 5.5
illustrates a simple example in which the default routes of routers E and F create an endless
loop. Imagine sending in a packet to router A of Figure 5.5 with the address 184.5.45.233. This
address is known to all the routers, but only by means of the default route address (0.0.0.0).
The packet is therefore forwarded from router A to router E to router F, and from then on, in
a continuous loop F-to-E-to-F-to-E-to-F . . . etc.
In the relatively straightforward example of Figure 5.5 it might be relatively easy to eliminate the routing loop, but more complex networks, especially those using dynamic routing are
much harder to check manually or administer with very carefully selected routing policies and

Figure 5.5

Circular routing arising from inappropriate default routing.

178

WANs, routers and the Internet protocol (IP)

routing algorithms. For this reason, the Internet protocol provides a field called time-to-live
(TTL) in IP version 4 and an equivalent field in IPv6 called hop limit. If the TTL or hop limit
is exceeded, then the packet should be discarded by any router which subsequently receives
it. This at least prevents the packet from trekking endlessly through the network.
Enough of the background! Let’s now get down to describing the Internet protocol (IP)
itself.

5.7 Internet protocol version 4 (IPv4)
Internet protocol version 4 (IPv4) is a network layer protocol for packet-switched datagram
communication. Figure 5.6 illustrates the standardised format of an Internet protocol datagram
(IP datagram or IP packet) conforming to IPv4, as defined in RFC 791.11
Internet protocol version 4 (IPv4) is quite a straightforward packet-switching protocol.
In some ways it is similar to the ITU-T packet-switching protocol, recommendation X.25,
which we met in Chapter 3. But the fact that it is a connectionless, protocol rather than a
connection-oriented protocol makes it different. We shall explain IP in detail by considering
the contents, meaning and use of the various IP-header fields (Figure 5.6). But if you need any
extra assistance on exact details of the protocol operation or precise field codings, RFCs 791
(Internet protocol version 4) and 1812 (Requirements for IPv4 routers) provide the definitive
documentation.

IP Version 4 (IPv4) header format
RFC 791, in line with most other IP-suite protocol documentation, specifies the protocol
headers and packet formats in terms of words of data rather than in terms of single octets 12 .

Figure 5.6
11

IP datagram structure showing IP-header fields and IP data.

Though IP does not correspond exactly to OSI layer 3, it nonetheless can be considered approximately
equivalent.
12
An octet is the same as a byte — i.e., 8 bits. The name octet rather than byte is commonly used in protocol
specifications.