Network Reachability (NR) Message
Terminology: Let gateway G have an interface to network N. We say that G is AN APPROPRIATE FIRST HOP to network M relative to network N (where M and N are distinct networks) if and only if the following condition holds:
Traffic which is destined for network M, and which arrives at gateway G over its network N interface, will be forwarded to M by G over a path which does not include any other gateway with an interface to network N.
In short, G is an appropriate first hop for network M relative to network N just in case there is no better gateway on network N through which to route traffic which is destined for network M. For optimal routing, traffic in network N which is destined for network M ought always to be forwarded to a gateway which is an appropriate first hop.
In order for exterior neighbors G and G' (which are neighbors over network N) to be able to use each other as packet switches for forwarding traffic to remote networks, each needs to know the list of networks for which the other is an appropriate first hop. The Exterior Gateway Protocol defines a message, called the Network Reachability Message (or NR message), for transferring this information.
Let G be a gateway on network N. Then the NR message which G sends about network N must contain the following information:
A list of all the networks for which G is an appropriate first hop relative to network N.
If G' can obtain this information from exterior neighbor G, then it knows that no traffic destined for networks which are NOT in that list should be forwarded to G. (It cannot simply conclude, however, that all traffic for any networks in that list ought to be forwarded via G, since G' may also have other neighbors which are also appropriate first hops to network N. For example, G and G'' might each be neighbors of G', but might be "equidistant" from some network M. Then each could be an appropriate first hop.)
For each network in the list, the NR message also contains a byte which specifies the "distance" (according to some metric whose definition is left to the designers of the autonomous system of which gateway G is a member) from G to that network. This information might (or might not) be useful in the interior routing algorithm of gateway G', or for diagnostic purposes.
The maximum value of distance (255.) shall be taken to mean that the network is UNREACHABLE. ALL OTHER VALUES WILL BE TAKEN TO MEAN THAT THE NETWORK IS REACHABLE.
If an NR message from some gateway G fails to mention some network N which was mentioned in the previous NR message from G, it shall be assumed that N is still reachable from G. HOWEVER, IF N IS NOT MENTIONED IN TWO SUCCESSIVE NR MESSAGES FROM G, THAT SHALL BE TAKEN TO MEAN THAT N IS NO LONGER REACHABLE FROM G. This procedure is necessary to ensure that networks which can no longer be reached, but which are never explicitly declared unreachable, are timed out and removed from the list of reachable networks.
It may often be the case that where G and G' are exterior neighbors on network N, G knows of many more gateway neighbors on network N, and knows for which networks those other neighbors are the appropriate first hop. Since G' may not know about all these other neighbors, it is convenient and often more efficient for it to be able to obtain this information from G. Therefore, the EGP NR message also contains fields which allow G to specify the following information:
a) A list of all neighbors (both interior and exterior) of G (on network N) which G has reliably determined to be reachable. Gateways should be included in this list only if G is actively running its neighbor reachability protocol with them.
b) For each of those neighbors, the list of networks for which that neighbor is an appropriate first hop (relative to network N).
c) For each such <neighbor, network> pair, the "distance" from that neighbor to that network.
Thus the NR message provides a means of allowing a gateway to "discover" new neighbors by seeing whether a neighbor that it already knows of has any additional neighbors on the same network. This information also makes possible the implementation of the INDIRECT NEIGHBOR strategy defined below.
A more precise description of the NR message is the following.
The data portion of the message will consist largely of blocks of data. Each block will be headed by a gateway address, which will be the address either of the gateway sending the message or of one of that gateway's neighbors. Each gateway address will be followed by a list of the networks for which that gateway is an appropriate first hop, and the distance from that gateway to each network.
Preceding the list of data blocks is:
a) The address of the network which this message is about. If G and G' are neighbors on network N, then in the NR message going from G to G', this is the address of network N. For convenience, four bytes have been allocated for this address -- the trailing one, two, or three bytes should be zero.
b) The count (one byte) of the number of interior neighbors of G for which this message contains data blocks. By convention, this count will include the data block for G itself, which should be the first one to appear.
c) The count (one byte) of the number of exterior neighbors of G for which this message contains data blocks.
Then follow the data blocks themselves, first the block for G itself, then the blocks for all the interior neighbors of G (if any), then the blocks for the exterior neighbors. Since all gateways mentioned are on the same network, whose address has already been given, the gateway addresses are given with the network address part (one, two, or three bytes) omitted, to save space.
Each block includes a one-byte count of the number of networks for which that gateway is the appropriate first hop. In the list of networks, each network address is either one, two, or three bytes, depending on whether it is a class A, class B, or class C network. No trailing bytes are used.
It may sometimes be necessary to fragment the NR message. The NR message contains a byte indicating the number of this fragment (fragments will be numbered from zero), and a byte containing the number of the last fragment (NOT the number of fragments). If fragmentation is not used, these bytes must both be zero. EACH FRAGMENT MUST BE A FULLY SELF-CONTAINED NR MESSAGE. That is, each fragment will begin with a count of interior and exterior neighbors, and will have some integral number of gateway data blocks. The number of data blocks in each fragment must correspond to the neighbor counts at the beginning of that fragment. However, only the first fragment should begin with a data block describing the sending gateway.
This scheme enables each fragment to be processed independently, and requires no complex reassembly mechanisms. It also enables processing of a message all of whose fragments have not been received. If, after some amount of time and some number of retransmissions of a poll, not all fragments have been received, the fragments which are present shall be processed as if they constituted the complete NR message. (This means that networks mentioned only in the missing fragment will retain the "distance" values they had in the previous NR message from that gateway. However, if no new value for a particular network is received in the next NR message from that gateway, the network will be declared unreachable.)