Passa al contenuto principale

4. Gateway Algorithms

Network Working Group                                          R. Braden
Request for Comments: 1009 J. Postel
Obsoletes: 985 ISI
June 1987
Requirements for Internet Gateways

4. Gateway Algorithms​

Gateways are general packet-switches that forward packets according to the IP address, i.e., they are IP routers. While it is beyond the scope of this document to specify the details of the mechanisms used in any particular, perhaps proprietary, gateway architecture, there are a number of basic algorithms which must be provided by any acceptable design.

4.1. Routing Algorithm​

The routing mechanism is fundamental to Internet operation. In all but trivial network topologies, robust Internet service requires some degree of routing dynamics, whether it be effected by manual or automatic means or by some combination of both. In particular, if routing changes are made manually, it must be possible to make these routing changes from a remote Network Operation Center (NOC) without taking down the gateway for reconfiguration. If static routes are used, there must be automatic fallback or rerouting features.

Handling unpredictable changes in Internet connectivity must be considered the normal case, so that systems of gateways will normally be expected to have a routing algorithm with the capability of reacting to link and other gateway failures and changing the routing automatically.

This document places no restriction on the type of routing algorithm, e.g., node-based, link-based or any other algorithm, or on the routing distance metric, e.g., delay or hop-count. However, the following features are considered necessary for a successful gateway routing algorithm:

  1.  The algorithm must sense the failure or restoration of a
      link or other gateway and switch to appropriate paths.  A
      design objective is to switch paths within an interval less
      than the typical TCP user time-out (one minute is a safe
      assumption).

  2.  The algorithm must suppress routing loops between neighbor
      gateways and must contain provisions to avoid or suppress
      routing loops that may form between non-neighbor gateways.
      A design objective is for no loop to persist for longer
      than an interval greater than the typical TCP user
      time-out.

  3.  The control traffic necessary to operate the routing
      algorithm must not significantly degrade or disrupt normal
      network operation.  Changes in state which might
      momentarily disrupt normal operation in a local-area must
      not cause disruption in remote areas of the network.

  4.  As the size of the network increases, the demand on
      resources must be controlled in an efficient way.  Table
      lookups should be hashed, for example, and data-base
      updates handled piecemeal, with only incremental changes
      broadcast over a wide-area.

  5.  The size of the routing data-base must not be allowed to
      exceed a constant, independent of network topology, times
      the number of nodes times the mean connectivity (average
      number of incident links).  An advanced design might not
      require that the entire routing data-base be kept in any
      particular gateway, so that discovery and caching
      techniques would be necessary.

  6.  Reachability and delay metrics, if used, must not depend on
      direct connectivity to all other gateways or on the use of
      network-specific broadcast mechanisms.  Polling procedures
      (e.g., for consistency checking) must be used only
      sparingly and in no case introduce an overhead exceeding a
      constant, independent of network topology, times the
      longest non-looping path.

  7.  Default routes (generally intended as a means to reduce the
      size of the routing data-base) must be used with care,
      because of the many problems with multiple paths, loops,
      and mis-configurations which routing defaults have caused.

      The most common application of defaults is for routing
      within an Internet region which is connected in a strictly
      hierarchical fashion and is a stub from the rest of the
      Internet system.  In this case, the default is used for
      routing "up" the tree.  Unfortunately, such restricted
      topology seldom lasts very long, and defaults cease to
      work.

      More generally, defaults could be used for initial routing
      guesses, with final routes to be discovered and cached from
      external or internal data-bases via the routing algorithm
      or EGP.

4.2. Subnets and Routing​

We will call a gateway "subnetted" if at least one of its interfaces is connected to a subnet; the set of gateways directly connected to subnets of the same network will be referred to as a "subnet cluster". For example, in the following diagram, network 2 is subnetted, with subnets 2.1 and 2.2, but network 1 is not; gateways 1, 2, and 3 are subnetted and are members of the same subnet cluster.

      (Net 1) === [Gwy 1] === (Net 2.1) === [Gwy 2] === (Net 2.2)
| |
| |
=================== [Gwy 3] =======================

Subnets have the following effects on gateway routing:

  A.  Non-subnetted gateways are not affected at all.

B. The routing data-base in a subnetted gateway must consider
the address mask for subnet entries.

C. Routing updates among the gateways in the same subnet
cluster must include entries for the various subnets. The
corresponding address mask(s) may be implicit, but for full
generality the mask needs to be given explicitly for each
entry. Note that if the routing data-base included a full
32-bit mask for every IP network, the gateway could deal
with networks and subnets in a natural way. This would
also handle the case of multiple subnet masks for the same
subnetted network.

D. Routing updates from a subnetted gateway to a gateway
outside the cluster can contain nets, never subnets.

E. If a subnetted gateway (e.g., gateway 2 above) is unable to
forward a datagram from one subnet to another subnet of the
same network, then it must return a Host Unreachable, not a
Net Unreachable, as discussed in Section 2.2.1.

When considering the choice of routing protocol, a gateway builder must consider how that protocol generalizes for subnets. For some routing protocols it will be possible to use the same procedures in a regular gateway and a subnetted gateway, with only a change of parameters (e.g., address masks).

A different subnet address mask must be configurable for each interface of a given gateway. This will allow a subnetted gateway to connect to two different subnetted networks, or to connect two subnets of the same network with different masks.

4.3 Resource Allocation​

In order to perform its basic datagram-forwarding functions, a gateway must allocate resources; its packet buffers and CPU time must be allocated to packets it receives from connected networks, while the bandwidth to each of the networks must also be allocated for sending packets. The choice of allocation strategies will be critical when a particular resource is scarce. The most obvious allocation strategy, first-come-first-served (FCFS), may not be appropriate under overload conditions, for reasons which we will now explore.

A first example is buffer allocation. It is important for a gateway to allocate buffers fairly among all of its connected networks, even if these networks have widely varying bandwidths. A high-speed interface must not be allowed to starve slower interfaces of buffers. For example, consider a gateway with a 10 Mbps Ethernet connection and two 56 Kbps serial lines. A buggy host on the Ethernet may spray that gateway interface with packets at high speed. Without careful algorithm design in the gateway, this could tie up all the gateway buffers in such a way that transit traffic between the serial lines would be completely stopped.

Allocation of output bandwidth may also require non-FCFS strategies. In an advanced gateway design, allocation of output bandwidth may depend upon Type-of-Service bits in the IP headers. A gateway may also want to give priority to datagrams for its own up/down and routing protocols.

Finally, Nagle [24] has suggested that gateways implement "fair queueing", i.e., sharing output bandwidth equitably among the current traffic sources. In his scheme, for each network interface there would be a dynamically-built set of output queues, one per IP source address; these queues would be serviced in a round-robin fashion to share the bandwidth. If subsequent research shows fair queueing to be desirable, it will be added to a future version of this document as a universal requirement.

4.4. Special Addresses and Filters​

Section 2.1 contained a list of the 32-bit IP addresses which have special meanings. They do not in general represent unique IP addresses of Internet hosts, and there are restrictions on their use in IP headers.

We can distinguish two classes of these special cases. The first class (specifically, cases (a), (b), (c), (g), (h), and (i) in section 2.1) contains addresses which should never appear in the destination address field of any IP datagram, so a gateway should never be asked to route to one of these addresses. However, in the real world of imperfect implementations and configuration errors, such bad destination addresses do occur. It is the responsibility of a gateway to avoid propagating such erroneous addresses; this is especially important for gateways included in the global interconnect system. In particular, a gateway which receives a datagram with one of these forbidden addresses should:

  1.  Avoid inserting that address into its routing database, and
avoid including it in routing updates to any other gateway.

2. Avoid forwarding a datagram containing that address as a
destination.

To enforce these restrictions, it is suggested that a gateway include a configurable filter for datagrams and routing updates. A typical filter entry might consist of a 32-bit mask and value pair. If the logical AND of the given address with the mask equals the value, a match has been found. Since filtering will consume gateway resources, it is vital that the gateway configuration be able to control the degree of filtering in use.

There is a second class of special case addresses (cases (d), (e), and (f) in section 2.1), the so-called "directed broadcasts". A directed broadcast is a datagram to be forwarded normally to the specified destination (sub-)net and then broadcast on the final hop. An Internet gateway is permitted, but not required, to filter out directed broadcasts destined for any of its locally-connected networks. Hence, it should be possible to configure the filter to block the delivery of directed broadcasts.

Finally, it will also be useful for Internet O&M to have a configurable filter on the IP source address. This will allow a network manager to temporarily block traffic from a particular misbehaving host, for example.

4.5. Redirects​

The ICMP Redirect message is specified only for use by a gateway to update the routing table of a host on the same connected net. However, the Redirect message is sometimes used between gateways, due to the following considerations:

  The routing function in a host is very much like that in a
"dumb gateway" (i.e., a gateway having only static routes). It
is desirable to allow the routing tables of a dumb gateway to
be changed under the control of a dynamic gateway (i.e., a
gateway with full dynamic routing) on the same network. By
analogy, it is natural to let the dynamic gateway send ICMP
Redirect messages to dumb gateway.

The use of ICMP Redirect between gateways in this fashion may be considered to be part of the IGP (in fact, the totality of the IGP, as far as the dumb gateway is concerned!) in the particular Autonomous System. Specification of an IGP is outside the scope of this document, so we only note the possibility of using Redirect in this fashion. Gateways are not required to receive and act upon redirects, and in fact dynamic gateways must ignore them. We also note that considerable experience shows that dumb gateways often create problems resulting in "black holes"; a full routing gateway is always preferable.

Routing table entries established by redirect messages must be removed automatically, either by a time-out or when a use count goes to zero.

4.6. Broadcast and Multicast​

A host which is connected to a network (generally a LAN) with an intrinsic broadcast capability may want to use this capability to effect multidestination delivery of IP datagrams. The basic Internet model assumes point-to-point messages, and we must take some care when we incorporate broadcasting. It is important to note that broadcast addresses may occur at two protocol levels: the local network header and the IP header.

Incorrect handling of broadcasting has often been the cause of packet avalanches (sometimes dubbed "meltdown") in LANs. These avalanches are generally caused by gratuitous datagram-forwarding by hosts, or by hosts sending ICMP error messages when they discard broadcast datagrams.

Gateways have a responsibility to prevent avalanches, or datagrams which can trigger avalanches, from escaping into another network.

In general, a gateway must not forward a datagram which arrives via local network broadcast, and must not send an ICMP error message when dropping the datagram. A discussion of the rules will be found in Appendix A; see also [50].

As noted in Section 4.4, a gateway is permitted to filter out directed broadcasts. Hence, directed broadcasts will only be useful in limited Internet regions (e.g., the within the subnets of a particular campus) in which delivery is supported by the gateway administrators. Host group multicasting (see Sections 2.8 and 4.6) will soon provide a much more efficient mechanism than directed broadcasting. Gateway algorithms for host group multicasting will be specified in future RFC's.

4.7. Reachability Procedures​

The architecture must provide a robust mechanism to establish the operational status of each link and node in the network, including the gateways, the links connecting them and, where appropriate, the hosts as well. Ordinarily, this requires at least a link-level reachability protocol involving a periodic exchange of messages across each link. This function might be intrinsic to the link-level protocols used (e.g., LAPB). However, it is in general ill-advised to assume a host or gateway is operating correctly even if its link-level reachability protocol is operating correctly. Additional confirmation is required in the form of an operating routing algorithm or peer-level reachability protocol (such as used in EGP).

Failure and restoration of a link and/or gateway are considered network events and must be reported to the control center. It is desirable, although not required, that reporting paths not require correct functioning of the routing algorithm itself.

4.8. Time-To-Live​

The Time-to-Live (TTL) field of the IP header is defined to be a timer limiting the lifetime of a datagram in the Internet. It is an 8-bit field and the units are seconds. This would imply that for a maximum TTL of 255 a datagram would time-out after about 4 and a quarter minutes. Another aspect of the definition requires each gateway (or other module) that handles a datagram to decrement the TTL by at least one, even if the elapsed time was much less than a second. Since this is very often the case, the TTL effectively becomes a hop count limit on how far a datagram can propagate through the Internet.

As the Internet grows, the number of hops needed to get from one edge to the opposite edge increases, i.e., the Internet diameter grows.

If a gateway holds a datagram for more than one second, it must decrement the TTL by one for each second.

If the TTL is reduced to zero, the datagram must be discarded, and the gateway may send an ICMP Time Exceeded message to the source. A datagram should never be received with a TTL of zero.

When it originates a datagram, a gateway is acting in the role of a host and must supply a realistic initial value for the TTL.