OSPFv2 RFC2328文档翻译1

RFC定义了不同版本的OSPFv2协议,这里以RFC2328为基础进行了OSPFv2协议的介绍,并对RFC2328文档进行了分析。
关于OSPFv2的RFC历史版本介绍可见
链接: https://blog.csdn.net/fengxingzhe008/article/details/127236380
接下来对其进行介绍
由于篇幅问题,将本文档分为2部分,第2部分位于
链接: https://blog.csdn.net/fengxingzhe008/article/details/127681383
对OSPFv2相关介绍,可查看
链接: https://blog.csdn.net/fengxingzhe008/article/details/127686404


OSPF Version 2
RFC2328
1998

本文档声明
本文档为互联网社区指定了互联网标准跟踪协议,并要求进行讨论和提出改进建议。 有关该协议的标准化状态和状态,请参阅当前版本的“互联网官方协议标准”(STD 1)。 此备忘录的分发是无限的。

Status of this Memo

This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements.  Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol.  Distribution of this memo is
unlimited.

版权声明
网络协会(1998)版权所有。保留所有权利。

Copyright Notice

Copyright (C) The Internet Society (1998).  All Rights Reserved.

摘要
本文档描述OSPF协议version2版本。OSPF是一个链路状态协议。它被设计出来运行在单个自治系统中。每个OSPF路由器都存在一个描述了自治系统的身份状态数据库。从这个数据库中,通过最短生成树计算出一个路由表。
OSPF在面对拓扑变化时,利用最少的路由协议流量可以快速重新计算路由。OSPF提供对等价多路径的支持。提供区域路由功能,可实现更高级别的路由保护并减少路由协议流量。此外,所有 OSPF 路由协议交换都经过身份验证。
本文档和RFC2178的区别注释于附件G中。所有区别本质上都是向后兼容的。此备忘录和 RFC 2178、1583 和 1247 的实现将进行互操作。
建议请发送ospf@gated.cornell.edu

Abstract

This memo documents version 2 of the OSPF protocol.  OSPF is a
link-state routing protocol.  It is designed to be run internal to a
single Autonomous System.  Each OSPF router maintains an identical
database describing the Autonomous System's topology.  From this
database, a routing table is calculated by constructing a shortest-
path tree.

OSPF recalculates routes quickly in the face of topological changes,
utilizing a minimum of routing protocol traffic.  OSPF provides
support for equal-cost multipath.  An area routing capability is
provided, enabling an additional level of routing protection and a
reduction in routing protocol traffic.  In addition, all OSPF
routing protocol exchanges are authenticated.

The differences between this memo and RFC 2178 are explained in
Appendix G. All differences are backward-compatible in nature.
Implementations of this memo and of RFCs 2178, 1583, and 1247 will
interoperate.

Please send comments to ospf@gated.cornell.edu.

1.介绍

本文档定义了一个TCP/IP网络路由协议开放最短路径优先协议OSPF。OSPF被归为内部网关协议IGP。这意味着它在单个自治系统的路由器之间分发路由信息。OSPF 协议基于链路状态或最短路径优先技术。这与传统TCP / IP互联网路由协议使用的基于Bellman-Ford协议不同。
OSPF协议由OSPF网络工程任务组(IETF)完成。它是专门为 TCP/IP 互联网环境设计的,包括对 CIDR 的显式支持和对外部派生的路由信息的标记。OSPF还提供路由更新的身份验证,并在发送/接收更新时利用IP组播。此外,为了生成一种能够快速响应拓扑更改的协议,并且涉及少量的路由协议流量,已经做了大量工作。

This document is a specification of the Open Shortest Path First
(OSPF) TCP/IP internet routing protocol.  OSPF is classified as an
Interior Gateway Protocol (IGP).  This means that it distributes
routing information between routers belonging to a single Autonomous
System.  The OSPF protocol is based on link-state or SPF technology.
This is a departure from the Bellman-Ford base used by traditional
TCP/IP internet routing protocols.

The OSPF protocol was developed by the OSPF working group of the
Internet Engineering Task Force.  It has been designed expressly for
the TCP/IP internet environment, including explicit support for CIDR
and the tagging of externally-derived routing information.  OSPF
also provides for the authentication of routing updates, and
utilizes IP multicast when sending/receiving the updates.  In
addition, much work has been done to produce a protocol that
responds quickly to topology changes, yet involves small amounts of
routing protocol traffic.

1.1协议概述

OSPF路由IP包基于在IP数据包包头中找到的目标IP地址路由IP数据包。IP包在AS内传递路由时并不进一步封装协议。OSPF是一个动态路由协议。它可以快速探测到AS(例如,路由接口down)内的拓扑改变和重新经一个周期的泛洪后计算新的无环路路由。这一泛洪周期很短并使用最小的路由流量。
在一个链路状态路由协议中,每个路由器都维护一个描述自治系统拓扑的数据库。这一数据库于链路状态数据库息息相关。每个参与的路由器都有标识自身的数据库。每片这一数据库都设计了路由器的本地状态(例如,路由器的可用接口和可达邻居)。路由器通过泛洪方式在自治系统内进行本地状态的发布。

    OSPF routes IP packets based solely on the destination IP
    address found in the IP packet header.  IP packets are routed
    "as is" -- they are not encapsulated in any further protocol
    headers as they transit the Autonomous System.  OSPF is a
    dynamic routing protocol.  It quickly detects topological
    changes in the AS (such as router interface failures) and
    calculates new loop-free routes after a period of convergence.
    This period of convergence is short and involves a minimum of
    routing traffic.

    In a link-state routing protocol, each router maintains a
    database describing the Autonomous System's topology.  This
    database is referred to as the link-state database. Each
    participating router has an identical database.  Each individual
    piece of this database is a particular router's local state
    (e.g., the router's usable interfaces and reachable neighbors).
    The router distributes its local state throughout the Autonomous
    System by flooding.

--------------------------------------------------------------------[Page 6]

所有路由器都同时运行完全一致的算法。从链路状态数据库中,每个路由器都构建一个以自己为根的最短路由。这一最短路径为每个目的地址在自治系统内提供路由。
外部信息/路由作为树上的叶子节点。

    All routers run the exact same algorithm, in parallel.  From the
    link-state database, each router constructs a tree of shortest
    paths with itself as root.  This shortest-path tree gives the
    route to each destination in the Autonomous System.  Externally
    derived routing information appears on the tree as leaves.

当存在去往同一个目的地址的几条等价路由时,流量可进行分担。路由开销由无量纲的metric描述。

    When several equal-cost routes to a destination exist, traffic
    is distributed equally among them.  The cost of a route is
    described by a single dimensionless metric.

OSPF允许网络集合汇聚成组。这样一个组成为区域area。一个区域的拓扑对自治系统的其余部分是隐藏的。这一特点可以显著减少路由流量。并且,区域内的路由仅由区域自己的拓扑确定,从而防止不良路由数据为区域提供保护。一个区域是IP子网化网络的统称。

    OSPF allows sets of networks to be grouped together.  Such a
    grouping is called an area.  The topology of an area is hidden
    from the rest of the Autonomous System.  This information hiding
    enables a significant reduction in routing traffic.  Also,
    routing within the area is determined only by the area's own
    topology, lending the area protection from bad routing data.  An
    area is a generalization of an IP subnetted network.

OSPF可以灵活配置IP子网。OSPF分发的每一条路由都有一个目的地址和掩码。两个具有相同IP网络号的不同子网可能有不同的大小(例如,不同掩码)。这一行为称为可变长子网掩码。一个包只进行最优路由匹配。主机路由的子网掩码为“全1”(0xffffffff)。

    OSPF enables the flexible configuration of IP subnets.  Each
    route distributed by OSPF has a destination and mask.  Two
    different subnets of the same IP network number may have
    different sizes (i.e., different masks).  This is commonly
    referred to as variable length subnetting.  A packet is routed
    to the best (i.e., longest or most specific) match.  Host routes
    are considered to be subnets whose masks are "all ones"
    (0xffffffff).

所有的OSPF协议交换都可认证。这意味着只有被信任的路由才可参与自治系统的路由。认证功能是可选的,实际上可为每一个IP子网进行不同的认证。

    All OSPF protocol exchanges are authenticated.  This means that
    only trusted routers can participate in the Autonomous System's
    routing.  A variety of authentication schemes can be used; in
    fact, separate authentication schemes can be configured for each
    IP subnet.

外部路由信息(例如,从外部网关路由BGP学到的路由)可在自治系统内通告。这一外部数据于OSPF协议的链路状态数据时刻保持分离状态。每一个外部路由在通告时也可进行标记,可以通过在途径自治系统边界路由器上添加信息来实现

    Externally derived routing data (e.g., routes learned from an
    Exterior Gateway Protocol such as BGP; see [Ref23]) is
    advertised throughout the Autonomous System.  This externally
    derived data is kept separate from the OSPF protocol's link
    state data.  Each external route can also be tagged by the
    advertising router, enabling the passing of additional
    information between routers on the boundary of the Autonomous
    System.

1.2.通用数据定义

这一部分定义了对OSPF协议及本文档涉及内容术语的定义。不熟悉网络协议组的读者可以参考[Ref13]对IP的介绍。

路由器:
进行三层网络协议包交换。通常在IP术语里称为网关。
自治系统:
通过相同路由协议进行路由信息交换机的一组路由器。简称AS。
内部网关协议:
由路由器执行属于一个自治系统的路由协议。简称IGP。每个自治系统都有一个IGP。不同的自治系统可能运行不同IGPs。
路由器ID:
一个分配给运行OSPF协议的所有路由器的32-bit数字。这一数据用于在自治系统内唯一标识
网络:
在本文档中,指一个IP网络/子网/超网。可以为一个物理网络分配多个IP网络/子网。 我们认为这些是独立的网络。点对点物理网络是一个例外-无论分配给它们多少个(如果有的话)IP网络/子网编号,它们都被视为单个网络。
网络掩码:
一个标识IP网络/子网/超网上IP地址范围的32-bit数字。此规范将网络掩码显示为十六进制数。例如,一个C类IP网络掩码展示为0xffffff00。同时这一掩码可以标识为255.255.255.0
点到点网络:一个仅加入一堆路由器的网络。一个56kb串行链路就是点到点网络的一个例子。
广播网络:
支持超过两个路由器附着的网络,同时具有向所有附着该网络的路由器转发一个物理信息的能力。在这个网络上可以使用OSPF的Hello协议进行动态发现邻居路由。
非广播网络:
支持超过两个路由器附着的网络,但是不具有广播能力。在这个网络上也使用OSPF的Hello协议维持邻居。但是由于缺少广播能力可能需要一些配置信息来帮助发现邻居。在非广播网络上,通常需要将通常组播的OSPF协议数据包依次发送到每个相邻路由器。X.25 公共数据网络(PDN)是非广播网络的一个示例。
OSPF 在非广播网络上以两种模式之一运行。第一种模式称为非广播多路访问或NBMA,模拟OSPF 在广播网络上的操作。第二种模式称为点对多点,它将非广播网络视为点对点链路的集合。非广播网络称为NBMA网络或点对多点网络,具体取决于 OSPF 在网络上的操作模式。

This section provides definitions for terms that have a specific
meaning to the OSPF protocol and that are used throughout the
text. The reader unfamiliar with the Internet Protocol Suite is
referred to [Ref13] for an introduction to IP.

    Router
        A level three Internet Protocol packet switch.  Formerly
        called a gateway in much of the IP literature.

    Autonomous System
        A group of routers exchanging routing information via a
        common routing protocol.  Abbreviated as AS.

    Interior Gateway Protocol
        The routing protocol spoken by the routers belonging to an
        Autonomous system.  Abbreviated as IGP.  Each Autonomous
        System has a single IGP.  Separate Autonomous Systems may be
        running different IGPs.

    Router ID
        A 32-bit number assigned to each router running the OSPF
        protocol.  This number uniquely identifies the router within
        an Autonomous System.

    Network
        In this memo, an IP network/subnet/supernet.  It is possible
        for one physical network to be assigned multiple IP
        network/subnet numbers.  We consider these to be separate
        networks.  Point-to-point physical networks are an exception
        - they are considered a single network no matter how many
        (if any at all) IP network/subnet numbers are assigned to
        them.

    Network mask
        A 32-bit number indicating the range of IP addresses
        residing on a single IP network/subnet/supernet.  This
        specification displays network masks as hexadecimal numbers.
        For example, the network mask for a class C IP network is
        displayed as 0xffffff00.  Such a mask is often displayed
        elsewhere in the literature as 255.255.255.0.

    Point-to-point networks
        A network that joins a single pair of routers.  A 56Kb
        serial line is an example of a point-to-point network.

    Broadcast networks
        Networks supporting many (more than two) attached routers,
        together with the capability to address a single physical
        message to all of the attached routers (broadcast).
        Neighboring routers are discovered dynamically on these nets
        using OSPF's Hello Protocol.  The Hello Protocol itself
        takes advantage of the broadcast capability.  The OSPF
        protocol makes further use of multicast capabilities, if
        they exist.  Each pair of routers on a broadcast network is
        assumed to be able to communicate directly. An ethernet is
        an example of a broadcast network.

    Non-broadcast networks
        Networks supporting many (more than two) routers, but having
        no broadcast capability.  Neighboring routers are maintained
        on these nets using OSPF's Hello Protocol.  However, due to
        the lack of broadcast capability, some configuration
        information may be necessary to aid in the discovery of
        neighbors.  On non-broadcast networks, OSPF protocol packets
        that are normally multicast need to be sent to each
        neighboring router, in turn. An X.25 Public Data Network
        (PDN) is an example of a non-broadcast network.

        OSPF runs in one of two modes over non-broadcast networks.
        The first mode, called non-broadcast multi-access or NBMA,
        simulates the operation of OSPF on a broadcast network. The
        second mode, called Point-to-MultiPoint, treats the non-
        broadcast network as a collection of point-to-point links.
        Non-broadcast networks are referred to as NBMA networks or
        Point-to-MultiPoint networks, depending on OSPF's mode of
        operation over the network.

--------------------------------------------------------------------[Page 9]

接口:
路由器与其附着网络的连接。接口具有与其关联的状态信息,这些信息是从底层较低级别协议和路由协议本身获取的。一个网络的接口具有单个IP地址和掩码(除非网络是未编号的点对点网络)。接口有时也称为链路。
邻居路由器:
两台路由器都有连接到同一网络的接口。邻居关系通常由OSPF的Hello协议动态发现和维护。
邻接:
在选定的相邻路由器之间形成的用于交换路由信息的关系。并非每对相邻路由器都变为邻接路由器。
链路状态通告:
描述路由器或网络的本地状态的数据单位。对于路由器包括了路由器的接口和邻接的状态。每个链路状态通告在整个路由域中泛洪。收集的所有路由器和网络的链路状态通告构成了协议的链路状态数据库。在本备忘录中,链路状态通告缩写为LSA。
Hello协议:
OSPF 协议中用于建立和维护邻居关系的部分。 在广播网络上,Hello 协议还可以动态发现相邻路由器。
泛洪:
OSPF 协议中用于分发和同步OSPF路由器之间的链路状态数据库。
指定路由器DR:
每个至少连接了两个路由器的广播和NBMA网络都有一个指定路由器。指定路由器为网络生成 LSA,并在协议的运行中承担其他特殊职责。指定的路由器由Hello协议选择。
指定路由器概念可以减少广播或NBMA网络上所需的邻接数。这反过来又减少了路由协议流量和链路状态数据库的大小。
低级别协议:
为因特网协议提供服务的基础网络访问协议,进而为 OSPF 协议提供服务。 例如,X.25 PDN 的 X.25 数据包和帧级别,以及以太网的以太网数据链路层。

    Interface
        The connection between a router and one of its attached
        networks.  An interface has state information associated
        with it, which is obtained from the underlying lower level
        protocols and the routing protocol itself.  An interface to
        a network has associated with it a single IP address and
        mask (unless the network is an unnumbered point-to-point
        network).  An interface is sometimes also referred to as a
        link.

    Neighboring routers
        Two routers that have interfaces to a common network.
        Neighbor relationships are maintained by, and usually
        dynamically discovered by, OSPF's Hello Protocol.

    Adjacency
        A relationship formed between selected neighboring routers
        for the purpose of exchanging routing information.  Not
        every pair of neighboring routers become adjacent.

    Link state advertisement
        Unit of data describing the local state of a router or
        network. For a router, this includes the state of the
        router's interfaces and adjacencies.  Each link state
        advertisement is flooded throughout the routing domain. The
        collected link state advertisements of all routers and
        networks forms the protocol's link state database.
        Throughout this memo, link state advertisement is
        abbreviated as LSA.

    Hello Protocol
        The part of the OSPF protocol used to establish and maintain
        neighbor relationships.  On broadcast networks the Hello
        Protocol can also dynamically discover neighboring routers.

    Flooding
        The part of the OSPF protocol that distributes and
        synchronizes the link-state database between OSPF routers.

    Designated Router
        Each broadcast and NBMA network that has at least two
        attached routers has a Designated Router.  The Designated
        Router generates an LSA for the network and has other
        special responsibilities in the running of the protocol.
        The Designated Router is elected by the Hello Protocol.

        The Designated Router concept enables a reduction in the
        number of adjacencies required on a broadcast or NBMA
        network.  This in turn reduces the amount of routing
        protocol traffic and the size of the link-state database.

    Lower-level protocols
        The underlying network access protocols that provide
        services to the Internet Protocol and in turn the OSPF
        protocol.  Examples of these are the X.25 packet and frame
        levels for X.25 PDNs, and the ethernet data link layer for
        ethernets.

1.3.链路状态路由技术的历史简介

OSPF是一个链路状态路由协议。这样的协议或基于SPF或基于分发数据库协议。本节简要介绍了影响OSPF协议的链路状态技术的发展。
第一个链路状态路由协议是为在ARPANET分组交换网络中使用而开发的。该协议在[Ref3]中进行了描述。它已成为所有其他链路状态协议的起点。同构的ARPANET环境,即通过同步串行线路连接的单供应商分组交换机,简化了原始协议的设计和实现。
对该协议的修改可见于[Ref4]。这些修改涉及通过向LSA添加校验和(从而检测数据库损坏)等方式来提高路由协议的容错能力。该论文还包括减少链路状态协议中路由流量开销的方法。主要是通过引入一些机制来实现的,这些机制使LSA发起之间的间隔增加了一个数量级。

    OSPF is a link state routing protocol.  Such protocols are also
    referred to in the literature as SPF-based or distributed-
    database protocols.  This section gives a brief description of
    the developments in link-state technology that have influenced
    the OSPF protocol.

    The first link-state routing protocol was developed for use in
    the ARPANET packet switching network.  This protocol is
    described in [Ref3].  It has formed the starting point for all
    other link-state protocols.  The homogeneous ARPANET
    environment, i.e., single-vendor packet switches connected by
    synchronous serial lines, simplified the design and
    implementation of the original protocol.

    Modifications to this protocol were proposed in [Ref4].  These
    modifications dealt with increasing the fault tolerance of the
    routing protocol through, among other things, adding a checksum
    to the LSAs (thereby detecting database corruption).  The paper
    also included means for reducing the routing traffic overhead in
    a link-state protocol.  This was accomplished by introducing
    mechanisms which enabled the interval between LSA originations
    to be increased by an order of magnitude.

--------------------------------------------------------------------[Page 11]

还提出了一种链路状态算法,用作ISO IS-IS路由协议。此协议在[Ref2]中进行了描述。该协议包括在广播网络上运行时减少数据和路由流量的方法。这是通过为每个广播网络选择指定路由器来实现的,然后该路由器为网络创建一个LSA。
IETF的OSPF工作组在开发OSPF协议时扩展了这项工作。指定路由器概念已得到极大增强,以进一步减少所需的路由流量。组播功能用于进一步降低路由带宽。已经开发了一种区域路由方案,可以隐藏/保护/减少信息。最后,这些算法是为在TCP/IP互联网中的高效操作而量身定制的。

    A link-state algorithm has also been proposed for use as an ISO
    IS-IS routing protocol.  This protocol is described in [Ref2].
    The protocol includes methods for data and routing traffic
    reduction when operating over broadcast networks.  This is
    accomplished by election of a Designated Router for each
    broadcast network, which then originates an LSA for the network.

    The OSPF Working Group of the IETF has extended this work in
    developing the OSPF protocol.  The Designated Router concept has
    been greatly enhanced to further reduce the amount of routing
    traffic required.  Multicast capabilities are utilized for
    additional routing bandwidth reduction.  An area routing scheme
    has been developed enabling information
    hiding/protection/reduction.  Finally, the algorithms have been
    tailored for efficient operation in TCP/IP internets.

1.4.本文档的标准化

本规范的前3个部分概述了协议的功能和功能。第4-16节详细解释了协议的机制。数据包格式、协议常量和配置项在附录中指定。
文本中遇到的诸如Hello间隔之类的标签是指协议常量。它们可能是可配置的,也可能是不可配置的。附录 B 中总结了建筑结构常量,附录C中总结了可配置的常量。
该协议的详细规范以数据结构的形式呈现。这样做是为了使解释更精确。协议的实现需要支持所描述的功能,但不需要使用本备忘录中出现的精确数据结构。

    The first three sections of this specification give a general
    overview of the protocol's capabilities and functions.  Sections
    4-16 explain the protocol's mechanisms in detail.  Packet
    formats, protocol constants and configuration items are
    specified in the appendices.

    Labels such as HelloInterval encountered in the text refer to
    protocol constants.  They may or may not be configurable.
    Architectural constants are summarized in Appendix B.
    Configurable constants are summarized in Appendix C.

    The detailed specification of the protocol is presented in terms
    of data structures.  This is done in order to make the
    explanation more precise.  Implementations of the protocol are
    required to support the functionality described, but need not
    use the precise data structures that appear in this memo.

1.5.致谢

    The author would like to thank Ran Atkinson, Fred Baker, Jeffrey
    Burgan, Rob Coltun, Dino Farinacci, Vince Fuller, Phanindra
    Jujjavarapu, Milo Medin, Tom Pusateri, Kannan Varadhan, Zhaohui
    Zhang and the rest of the OSPF Working Group for the ideas and
    support they have given to this project.

    The OSPF Point-to-MultiPoint interface is based on work done by
    Fred Baker.

    The OSPF Cryptographic Authentication option was developed by
    Fred Baker and Ran Atkinson.

2.链路状态数据库:组织和计算

以下小节介绍 OSPF 链路状态数据库的组织,以及为了生成路由器的路由表而对数据库执行的路由计算。

The following subsections describe the organization of OSPF's link-
state database, and the routing calculations that are performed on
the database in order to produce a router's routing table.

2.1.链路状态路由技术的历史简介

自治系统的链路状态数据库描述了有向图。图的顶点由路由器和网络组成。当两个路由器通过物理点对点网络连接时,图形边缘连接它们。 将路由器连接到网络的边表示路由器在网络上具有接口。网络可以是transit网络,也可以是stub网络。transit网络是那些能够承载既不是本地来源也不是本地目的地的数据流量的网络。一个transit网络由同时具有传入和传出边的图形顶点表示。一个stub网络的顶点只有传入边。
图中每个网络节点的邻域取决于网络的类型(点对点、广播、NBMA 或点对多点)以及具有网络接口的路由器数量。图 1a 描述了三种情况:矩形表示路由器,圆圈和长方形表示网络。路由器名称以字母 RT 为前缀,网络名称以字母 N 为前缀。 路由器接口名称以字母 I 为前缀。 路由器之间的线表示点对点网络。 图的左侧显示了具有所连接路由器的网络,右侧显示了生成的图形。

    The Autonomous System's link-state database describes a directed
    graph.  The vertices of the graph consist of routers and
    networks.  A graph edge connects two routers when they are
    attached via a physical point-to-point network.  An edge
    connecting a router to a network indicates that the router has
    an interface on the network. Networks can be either transit or
    stub networks. Transit networks are those capable of carrying
    data traffic that is neither locally originated nor locally
    destined. A transit network is represented by a graph vertex
    having both incoming and outgoing edges. A stub network's vertex
    has only incoming edges.

    The neighborhood of each network node in the graph depends on
    the network's type (point-to-point, broadcast, NBMA or Point-
    to-MultiPoint) and the number of routers having an interface to
    the network.  Three cases are depicted in Figure 1a.  Rectangles
    indicate routers.  Circles and oblongs indicate networks.
    Router names are prefixed with the letters RT and network names
    with the letter N.  Router interface names are prefixed by the
    letter I.  Lines between routers indicate point-to-point
    networks.  The left side of the figure shows networks with their
    connected routers, with the resulting graphs shown on the right.

--------------------------------------------------------------------[Page 13]

在这里插入图片描述

网络和路由器由顶点表示。一条边将顶点 A 连接到顶点 B,因为列 A 和行 B 的交点用 X 标记。

--------------------------------------------------------------------[Page 13]

图 1a 的顶部显示了通过点对点链路连接的两个路由器。在生成的链路状态数据库图中,两个路由器顶点由一对边直接连接,每个边一个。点对点网络的接口不需要分配IP地址。分配接口地址时,它们被建模为stub链路,每个路由器通告到另一个路由器的接口地址的stub连接。可选的,可以将IP子网分配给点对点网络。在这种情况下,两个路由器都会通告到IP子网的stub链路,而不是通告彼此的 IP 接口地址。

    The top of Figure 1a shows two routers connected by a point-to-
    point link. In the resulting link-state database graph, the two
    router vertices are directly connected by a pair of edges, one
    in each direction. Interfaces to point-to-point networks need
    not be assigned IP addresses.  When interface addresses are
    assigned, they are modelled as stub links, with each router
    advertising a stub connection to the other router's interface
    address. Optionally, an IP subnet can be assigned to the point-
    to-point network. In this case, both routers advertise a stub
    link to the IP subnet, instead of advertising each others' IP
    interface addresses.

图1a的中间显示了一个只有一个连接的路由器的网络(即一个stub网络)。在这种情况下,网络显示在链路状态数据库图中的stub连接的末端。

    The middle of Figure 1a shows a network with only one attached
    router (i.e., a stub network). In this case, the network appears
    on the end of a stub connection in the link-state database's
    graph.

当多个路由器连接到广播网络时,链路状态数据库图显示双向连接到网络顶点的所有路由器。如图1a底部所示。

    When multiple routers are attached to a broadcast network, the
    link-state database graph shows all routers bidirectionally
    connected to the network vertex. This is pictured at the bottom
    of Figure 1a.

图中的每个网络(stub或transit)都有一个IP地址和关联的网络掩码。掩码表明网络上的节点数。 直接连接到路由器的主机(称为主机路由)在图形上显示为stub网络。主机路由的网络掩码始终0xffffffff,这表示存在单个节点。

    Each network (stub or transit) in the graph has an IP address
    and associated network mask.  The mask indicates the number of
    nodes on the network.  Hosts attached directly to routers
    (referred to as host routes) appear on the graph as stub
    networks.  The network mask for a host route is always
    0xffffffff, which indicates the presence of a single node.

2.1.1.非网络网络的表示

如之前所提及,OSPF可以以NBMA或者点到多点运行于非广播网络上。两种方式的选择决定了非广播网络上Hello协议和泛洪模式以及网络所代表的链路状态数据库。

        As mentioned previously, OSPF can run over non-broadcast
        networks in one of two modes: NBMA or Point-to-MultiPoint.
        The choice of mode determines the way that the Hello
        protocol and flooding work over the non-broadcast network,
        and the way that the network is represented in the link-
        state database.

在非广播多路访问模式下,OSPF模拟了一个广播网络:选举一个DR,并为网络产生相应的LSA。广播网和NBMA网络的图片非常具有代表性,并展示于Figure 1a中间。
无论从LSDB大小还是路由协议流量的角度考虑,NBMA都是在非广播网络中运行OSPF的最有效方式。然而这有一个十分严格的条件:它要求所有路由器都附着于NBMA网络上以便进行直接交流。在某些非广播网络(例如使用SVCs的ATM子网)上,可能会满足此限制。但它在其他非广播网络上通常不满足,例如PVC-only帧中继网络。在非广播网络上,并非所有路由器都可以直接通信,您可以将非广播网络分解为逻辑子网,每个子网上的路由器能够直接通信,然后将每个单独的子网作为NBMA网络运行(请参阅[Ref15])。但是,这需要相当多的管理开销,并且容易出现配置错误。在非广播网络下运行点对多点模式可能更好。

        In NBMA mode, OSPF emulates operation over a broadcast
        network: a Designated Router is elected for the NBMA
        network, and the Designated Router originates an LSA for the
        network. The graph representation for broadcast networks and
        NBMA networks is identical. This representation is pictured
        in the middle of Figure 1a.

        NBMA mode is the most efficient way to run OSPF over non-
        broadcast networks, both in terms of link-state database
        size and in terms of the amount of routing protocol traffic.
        However, it has one significant restriction: it requires all
        routers attached to the NBMA network to be able to
        communicate directly. This restriction may be met on some
        non-broadcast networks, such as an ATM subnet utilizing
        SVCs. But it is often not met on other non-broadcast
        networks, such as PVC-only Frame Relay networks. On non-
        broadcast networks where not all routers can communicate
        directly you can break the non-broadcast network into
        logical subnets, with the routers on each subnet being able
        to communicate directly, and then run each separate subnet
        as an NBMA network (see [Ref15]). This however requires
        quite a bit of administrative overhead, and is prone to
        misconfiguration. It is probably better to run such a non-
        broadcast network in Point-to-Multipoint mode.

在点到多点模式下,OSPF将所有路由器以点到点网络对待。既不为网络选举DR,也不统一汇聚LSA。实际上,点对多点网络的顶点不会出现在链路状态数据库的图形中。

        In Point-to-MultiPoint mode, OSPF treats all router-to-
        router connections over the non-broadcast network as if they
        were point-to-point links. No Designated Router is elected
        for the network, nor is there an LSA generated for the
        network. In fact, a vertex for the Point-to-MultiPoint
        network does not appear in the graph of the link-state
        database.

Figure 1b展示了点到多点网络的LSDB。在图的左边是点到多点。它假定处理RT4和RT5之外的所有路由器都可以直接交流。I3穿过I6表示路由器在点到多点网络上的路由器接口地址。在图形化的LSDB上可以看到通过点对多点网络直接通信的路由器由双向边缘连接,并且每个路由器还具有与其自己的IP接口地址的短截线连接(这与实际点对点链路的表示形式相反,参见Figure 1a)。

        Figure 1b illustrates the link-state database representation
        of a Point-to-MultiPoint network. On the left side of the
        figure, a Point-to-MultiPoint network is pictured. It is
        assumed that all routers can communicate directly, except
        for routers RT4 and RT5. I3 though I6 indicate the routers'
        IP interface addresses on the Point-to-MultiPoint network.
        In the graphical representation of the link-state database,
        routers that can communicate directly over the Point-to-
        MultiPoint network are joined by bidirectional edges, and
        each router also has a stub connection to its own IP
        interface address (which is in contrast to the
        representation of real point-to-point links; see Figure 1a).

在一些非广播网络上,使用点到多点和链路状态协议如反ARP(参考[Ref14])将允许器自动发现OSPF的邻居,即使器不支持广播网。

        On some non-broadcast networks, use of Point-to-MultiPoint
        mode and data-link protocols such as Inverse ARP (see
        [Ref14]) will allow autodiscovery of OSPF neighbors even
        though broadcast support is not available.

在这里插入图片描述
All routers can communicate directly over N2, except routers RT4 and RT5. I3 through I6 indicate IP interface addresses
除了RT4和RT5,所有的路由器都可在N2上直接交流。I3穿过I6表示IP接口地址。

--------------------------------------------------------------------[Page 17]

2.1.2.一个链路状态数据库的举例

Figure 2 展示一个AS的简单图示。标记为H1的矩形表示主机,该主机与路由器RT12具有 SLIP 连接。因此,路由器RT12正在通告主机路由。路由器之间的线表示物理点对点网络。唯一分配了接口地址的点对点网络是加入路由器RT6和RT10的网络。路由器RT5和RT7具有与其他自治系统的BGP连接。已为这两个路由器显示了一组BGP获知的路由。

        Figure 2 shows a sample map of an Autonomous System.  The
        rectangle labelled H1 indicates a host, which has a SLIP
        connection to Router RT12.  Router RT12 is therefore
        advertising a host route.  Lines between routers indicate
        physical point-to-point networks.  The only point-to-point
        network that has been assigned interface addresses is the
        one joining Routers RT6 and RT10.  Routers RT5 and RT7 have
        BGP connections to other Autonomous Systems.  A set of BGP-
        learned routes have been displayed for both of these
        routers.

开销与每个路由器出接口相关联。开销可由系统管理员配置。开销越低,接口就越有可能用于转发数据流量。开销还与外部派生的路由数据(例如,BGP获知的路由)相关联。

        A cost is associated with the output side of each router
        interface.  This cost is configurable by the system
        administrator.  The lower the cost, the more likely the
        interface is to be used to forward data traffic.  Costs are
        also associated with the externally derived routing data
        (e.g., the BGP-learned routes).

图2中的映射生成的有向图如图3所示。弧线标有相应路由器出接口的开销。 没有标记开销的弧线的开销为0。请注意,从网络到路由器的弧线始终具有0开销;尽管如此,它们仍然很重要。 另请注意,外部派生的路由数据在图形上显示为stub。

        The directed graph resulting from the map in Figure 2 is
        depicted in Figure 3.  Arcs are labelled with the cost of
        the corresponding router output interface.  Arcs having no
        labelled cost have a cost of 0.  Note that arcs leading from
        networks to routers always have cost 0; they are significant
        nonetheless.  Note also that the externally derived routing
        data appears on the graph as stubs.

链路状态数据库由路由器生成的 LSA 拼凑而成。 在关联的图形表示中,每个路由器或传输网络的邻域在单个单独的 LSA 中表示。Figure 4将这些LSAs图形化了。路由器RT12具有一个连接到两个广播网络的接口和一个到主机的SLIP链路。网络N6是一个N6三个路由器的广播网络。 从网络N6到其连接的路由器的所有链路的开销为0。请注意,网络N6的LSA实际上是由附着于网络路由器中的一个生成的:该路由器为网络选择的路由器指定路由器DR。

        The link-state database is pieced together from LSAs
        generated by the routers.  In the associated graphical
        representation, the neighborhood of each router or transit
        network is represented in a single, separate LSA.  Figure 4
        shows these LSAs graphically. Router RT12 has an interface
        to two broadcast networks and a SLIP line to a host.
        Network N6 is a broadcast network with three attached
        routers.  The cost of all links from Network N6 to its
        attached routers is 0.  Note that the LSA for Network N6 is
        actually generated by one of the network's attached routers:
        the router that has been elected Designated Router for the
        network.

             +
             | 3+---+                     N12      N14
           N1|--|RT1|\ 1                    \ N13 /
             |  +---+ \                     8\ |8/8
             +         \ ____                 \|/
                        /    \   1+---+8    8+---+6
                       *  N3  *---|RT4|------|RT5|--------+
                        \____/    +---+      +---+        |
              +         /   |                  |7         |
              | 3+---+ /    |                  |          |
            N2|--|RT2|/1    |1                 |6         |
              |  +---+    +---+8            6+---+        |
              +           |RT3|--------------|RT6|        |
                          +---+              +---+        |
                            |2               Ia|7         |
                            |                  |          |
                       +---------+             |          |
                           N4                  |          |
                                               |          |
                                               |          |
                   N11                         |          |
               +---------+                     |          |
                    |                          |          |    N12
                    |3                         |          |6 2/
                  +---+                        |        +---+/
                  |RT9|                        |        |RT7|---N15
                  +---+                        |        +---+ 9
                    |1                   +     |          |1
                   _|__                  |   Ib|5       __|_
                  /    \      1+----+2   |  3+----+1   /    \
                 *  N9  *------|RT11|----|---|RT10|---*  N6  *
                  \____/       +----+    |   +----+    \____/
                    |                    |                |
                    |1                   +                |1
         +--+   10+----+                N8              +---+
         |H1|-----|RT12|                                |RT8|
         +--+SLIP +----+                                +---+
                    |2                                    |4
                    |                                     |
               +---------+                            +--------+
                   N10                                    N7

                Figure 2: A sample Autonomous System

--------------------------------------------------------------------[Page 19]

在这里插入图片描述
Networks and routers are represented by vertices.
An edge of cost X connects Vertex A to Vertex B iff
the intersection of Column A and Row B is marked
with an X.

--------------------------------------------------------------------[Page 20]
在这里插入图片描述
Networks and routers are represented by vertices.
An edge of cost X connects Vertex A to Vertex B iff
the intersection of Column A and Row B is marked
with an X.
网段和路由器由顶点表示。开销X的边缘将顶点A连接到顶点B,因为列A和行B的交点用X标记。

2.2.最短路径树

当未配置OSPF区域时,自治系统中的每个路由器都由标识一个LSDB,可以用相同的图形表示。路由器通过计算路由器本身作为根的最短路径树,从此图生成其路由表。显然,最短路径树取决于进行计算的路由器。在我们的示例中,路由器RT6的最短路径树如Figure 5所示。

    When no OSPF areas are configured, each router in the Autonomous
    System has an identical link-state database, leading to an
    identical graphical representation.  A router generates its
    routing table from this graph by calculating a tree of shortest
    paths with the router itself as root.  Obviously, the shortest-
    path tree depends on the router doing the calculation.  The
    shortest-path tree for Router RT6 in our example is depicted in
    Figure 5.

生成树给出任何通向目的网络或主机的全部路径。然而,在转发过程中只有一个下一跳指向目的地址。另请注意,还计算了到任何路由器的最佳路由。对于外部数据的处理,我们记录下一跳和到通告外部路由路由器的距离。路由器RT6的结果路由表如表2所示。请注意,一些点对点网络的每一端是一个单独的路由(在本例中为路由器RT6和RT10之间的串行线路)。

    The tree gives the entire path to any destination network or
    host.  However, only the next hop to the destination is used in
    the forwarding process.  Note also that the best route to any
    router has also been calculated.  For the processing of external
    data, we note the next hop and distance to any router
    advertising external routes.  The resulting routing table for
    Router RT6 is pictured in Table 2.  Note that there is a
    separate route for each end of a numbered point-to-point network
    (in this case, the serial line between Routers RT6 and RT10).

属于到其他AS网络的路由(例如N12)在最短路径树Figure 5中表示为虚线。下一节将讨论此外部派生的路由信息。

    Routes to networks belonging to other AS'es (such as N12) appear
    as dashed lines on the shortest path tree in Figure 5.  Use of
    this externally derived routing information is considered in the
    next section.

在这里插入图片描述
Edges that are not marked with a cost have a cost of
of zero (these are network-to-router links). Routes
to networks N12-N15 are external information that is
considered in Section 2.3

2.3.外部路由的使用

在创建树后,将检查外部路由信息。此外部路由信息可能源自其他路由协议(如 BGP),也可能是静态配置的(静态路由)。 默认路由也可以作为自治系统外部路由信息的一部分包含在内。

    After the tree is created the external routing information is
    examined.  This external routing information may originate from
    another routing protocol such as BGP, or be statically
    configured (static routes).  Default routes can also be included
    as part of the Autonomous System's external routing information.

外部路由将不经改变的被泛洪到整个AS域中去。在我们的例子中,AS内所有的路由器都金额知道RT7路由器具有两台metric分别为2和9的外部路由。

    External routing information is flooded unaltered throughout the
    AS.  In our example, all the routers in the Autonomous System
    know that Router RT7 has two external routes, with metrics 2 and
    9.

OSPF支持2种类型的外部路由。Type1型将外部metric视为与OSPF接口cost具有相同数量级(例如链路状态metric)。Type2将外部metric视大一个数量级;任何Type2型metric都被视为大于AS内部任何路径的开销。使用Type2外部指标假定AS之间的路由是路由数据包的主要花销,并且无需将外部花销转换为内部链路状态花销。

    OSPF supports two types of external metrics.  Type 1 external
    metrics are expressed in the same units as OSPF interface cost
    (i.e., in terms of the link state metric).  Type 2 external
    metrics are an order of magnitude larger; any Type 2 metric is
    considered greater than the cost of any path internal to the AS.
    Use of Type 2 external metrics assumes that routing between
    AS'es is the major cost of routing a packet, and eliminates the
    need for conversion of external costs to internal link state
    metrics.

作为Type 1外部metric处理的一个示例,假设Figure 2中的路由器RT7和RT5正在通告Type 1外部metric。对于每个通告的外部路由,路由器RT6的总开销计算为外部路由的通告开销与路由器RT6到通告路由器的距离之和。当两个路由器通告同一个外部目的地时,RT6会选择提供最低总开销的通告路由器。然后,RT6将下一跳设置为外部目标,等于将数据包路由到所选通告路由器时使用的下一跳。

    As an example of Type 1 external metric processing, suppose that
    the Routers RT7 and RT5 in Figure 2 are advertising Type 1
    external metrics.  For each advertised external route, the total
    cost from Router RT6 is calculated as the sum of the external
    route's advertised cost and the distance from Router RT6 to the
    advertising router.  When two routers are advertising the same
    external destination, RT6 picks the advertising router providing
    the minimum total cost. RT6 then sets the next hop to the
    external destination equal to the next hop that would be used
    when routing packets to the chosen advertising router.

在Figure 2中,路由器RT5和RT7都通告了一条通向N12网络的外部路由。RT7路由器因为通告给RT6的N12网路的距离为10比RT5的14小而更优先。Table 3显示了检查外部路由时添加到路由表中的条目:

                     Destination   Next  Hop   Distance
                     __________________________________
                     N12           RT10        10
                     N13           RT5         14
                     N14           RT5         14
                     N15           RT10        17


             Table 3: The portion of Router RT6's routing table
                       listing external destinations.

Type 2外部metrics的过程也类似。metric选择AS边界路由器通告最小外部metric而无视到AS边界路由器的距离。假设在我们的示例中,路由器RT5和路由器RT7都通告了Type 2外部路由。 然后,所有发往网络N12的流量都将转发到路由器 RT7,因为 2 < 8。 当存在多个等价 Type 2 路由时,将使用到通告路由器的内部距离来打破平局。

    In Figure 2, both Router RT5 and RT7 are advertising an external
    route to destination Network N12.  Router RT7 is preferred since
    it is advertising N12 at a distance of 10 (8+2) to Router RT6,
    which is better than Router RT5's 14 (6+8).  Table 3 shows the
    entries that are added to the routing table when external routes
    are examined:

             Table 3: The portion of Router RT6's routing table
                       listing external destinations.

    Processing of Type 2 external metrics is simpler.  The AS
    boundary router advertising the smallest external metric is
    chosen, regardless of the internal distance to the AS boundary
    router.  Suppose in our example both Router RT5 and Router RT7
    were advertising Type 2 external routes.  Then all traffic
    destined for Network N12 would be forwarded to Router RT7, since
    2 < 8.  When several equal-cost Type 2 routes exist, the
    internal distance to the advertising routers is used to break
    the tie.

Type 1和Type 2外部metrics在AS内部可以同时出现。此时Type 1外部metrics总是优先

    Both Type 1 and Type 2 external metrics can be present in the AS
    at the same time.  In that event, Type 1 external metrics always
    take precedence.

这一部分假设,转发数据包总是通过AS边界路由路由实现。这并不总是可取的。例如,假设在Figure 2中,有一个附加路由器连接到网络N6,称为路由器RTX。 进一步假设RTX不参与OSPF路由,但与AS边界路由器RT7交换BGP信息。然后,路由器RT7最终将为应路由到RTX的所有目标通告OSPF 外部路由。如果这些目标的数据包需要始终首先路由到路由器RT7(通告路由器),则有时会引入额外的跃点。

为了处理这种情况,OSPF允许AS边界路由在AS-external-LSAs中定义一个新的“转发地址”。在上述例子中,RT7路由器会将 RTX 的IP地址指定为所有数据包应直接路由到RTX的目标的“转发地址”

    This section has assumed that packets destined for external
    destinations are always routed through the advertising AS
    boundary router.  This is not always desirable.  For example,
    suppose in Figure 2 there is an additional router attached to
    Network N6, called Router RTX.  Suppose further that RTX does
    not participate in OSPF routing, but does exchange BGP
    information with the AS boundary router RT7.  Then, Router RT7
    would end up advertising OSPF external routes for all
    destinations that should be routed to RTX.  An extra hop will
    sometimes be introduced if packets for these destinations need
    always be routed first to Router RT7 (the advertising router).

    To deal with this situation, the OSPF protocol allows an AS
    boundary router to specify a "forwarding address" in its AS-
    external-LSAs.  In the above example, Router RT7 would specify
    RTX's IP address as the "forwarding address" for all those
    destinations whose packets should be routed directly to RTX.

“转发地址”还有一个其他应用。它使自治系统内部的路由器能够充当“路由服务器”。例如,在Figure 2中,路由器RT6可以成为路由服务器,通过静态配置和外部路由协议的组合获取外部路由信息。然后,RT6将开始将自己宣告为AS边界路由器,并将传递一条OSPF的AS外部 LSA。在每个AS外部LSA中,路由器RT6将通过适当设置LSA的“转发地址”字段来指定用于目的地的正确AS出口点。

    The "forwarding address" has one other application.  It enables
    routers in the Autonomous System's interior to function as
    "route servers".  For example, in Figure 2 the router RT6 could
    become a route server, gaining external routing information
    through a combination of static configuration and external
    routing protocols.  RT6 would then start advertising itself as
    an AS boundary router, and would originate a collection of OSPF
    AS-external-LSAs.  In each AS-external-LSA, Router RT6 would
    specify the correct Autonomous System exit point to use for the
    destination through appropriate setting of the LSA's "forwarding
    address" field.

--------------------------------------------------------------------[Page 20]

2.4.等价路由

之前的讨论只简单考虑一条通向目的地址的路由。实际上如果存在等价路由,它们将都被发现并被使用。这不需要对算法进行概念上的更改,并且其讨论被推迟到我们更详细地考虑树构建过程时。
具有等价路由时,路由器可能有多个朝向任何给定目标的可用下一跃点。

    The above discussion has been simplified by considering only a
    single route to any destination.  In reality, if multiple
    equal-cost routes to a destination exist, they are all
    discovered and used.  This requires no conceptual changes to the
    algorithm, and its discussion is postponed until we consider the
    tree-building process in more detail.

    With equal cost multipath, a router potentially has several
    available next hops towards any given destination.

3.AS拆分为多个区域

OSPF允许将连续网络和主机的集合组合在一起。这样的组,连同具有与任何一个所包含网络的接口的路由器,称为一个区域。每个区域都运行基本链路状态路由算法的单独副本。这意味着每个区域都有自己的链路状态数据库和相应的图示,如上一节所述。
从区域外部看,区域的拓扑是不可见的。相反,给定区域内部的路由器对该区域外部的详细拓扑一无所知。与将整个自治系统视为单个链路状态域相比,这种信息隔离使协议能够显着减少路由流量。
OSPF allows collections of contiguous networks and hosts to be
grouped together. Such a group, together with the routers having
interfaces to any one of the included networks, is called an area.
Each area runs a separate copy of the basic link-state routing
algorithm. This means that each area has its own link-state
database and corresponding graph, as explained in the previous
section.

The topology of an area is invisible from the outside of the area.
Conversely, routers internal to a given area know nothing of the
detailed topology external to the area.  This isolation of knowledge
enables the protocol to effect a marked reduction in routing traffic
as compared to treating the entire Autonomous System as a single
link-state domain.

area的引入使得AS中的所有路由器不在具有一个标识LSDB。路由器实际上为它连接到的每个区域都有一个单独的链路状态数据库。(连接到多个区域的路由器称为区域边界路由器)。对于同一区域,属于同一区域的两个路由器具有相同的区域链路状态数据库。

With the introduction of areas, it is no longer true that all
routers in the AS have an identical link-state database.  A router
actually has a separate link-state database for each area it is
connected to.  (Routers connected to multiple areas are called area
border routers).  Two routers belonging to the same area have, for
that area, identical area link-state databases.

在自治系统中的路由在两个级别上进行,具体取决于数据包的源和目标是否位于同一区域(使用区域内路由)或不同区域(使用区域间路由)。在区域内路由中,数据包仅根据在区域内获得的信息进行路由;不能使用从区域外获取的路线信息。这可以保护区域内路由免受错误路由信息的注入。我们将在第 3.2 节中讨论区域间路由。

Routing in the Autonomous System takes place on two levels,
depending on whether the source and destination of a packet reside
in the same area (intra-area routing is used) or different areas
(inter-area routing is used).  In intra-area routing, the packet is
routed solely on information obtained within the area; no routing
information obtained from outside the area can be used.  This
protects intra-area routing from the injection of bad routing
information.  We discuss inter-area routing in Section 3.2.

3.1.AS骨干区域

OSPF骨干区域通常定义为area0(经常被写做area 0.0.0.0,OSPF的areaid以IP地址)。OSPF骨干区域总是包含所有的区域边界路由器。并且为非骨干区域分发路由信息。骨干区域必须连续。然而,其并非是物理连续的;骨干区域可以通过配置虚拟链路来建立/维护骨干连接。

    The OSPF backbone is the special OSPF Area 0 (often written as
    Area 0.0.0.0, since OSPF Area ID's are typically formatted as IP
    addresses). The OSPF backbone always contains all area border
    routers. The backbone is responsible for distributing routing
    information between non-backbone areas. The backbone must be
    contiguous. However, it need not be physically contiguous;
    backbone connectivity can be established/maintained through the
    configuration of virtual links.

虚链路可以被配置在任何两个具有相同非骨干区域的骨干路由器之间。虚拟链路属于骨干区域。该协议将两个由虚拟链路连接的路由器视为由未编号的点对点骨干网络连接。 在骨干网图上,两个这样的路由器由弧连接,其开销是两个路由器之间的区域内距离。沿虚拟链路流动的路由协议流量仅使用区域内路由。

    Virtual links can be configured between any two backbone routers
    that have an interface to a common non-backbone area.  Virtual
    links belong to the backbone.  The protocol treats two routers
    joined by a virtual link as if they were connected by an
    unnumbered point-to-point backbone network.  On the graph of the
    backbone, two such routers are joined by arcs whose costs are
    the intra-area distances between the two routers.  The routing
    protocol traffic that flows along the virtual link uses intra-
    area routing only.

3.2.区域间路由

当在两个非骨干区域之间路由数据包时,使用骨干区域进行。数据包将要传输的路径可以分为三个连续的部分:从源到区域边界路由器的区域内路径,源和目标区域之间的骨干区域,然后是到目标的另一个区域内路径。该算法找到具有最小成本的这类路径的集合。

    When routing a packet between two non-backbone areas the
    backbone is used.  The path that the packet will travel can be
    broken up into three contiguous pieces: an intra-area path from
    the source to an area border router, a backbone path between the
    source and destination areas, and then another intra-area path
    to the destination.  The algorithm finds the set of such paths
    that have the smallest cost.

从另一个角度来看,区域间路由可以被描绘为在自治系统上强制采用星型配置,以骨干区域为中心,每个非骨干区域为辐条。

    Looking at this another way, inter-area routing can be pictured
    as forcing a star configuration on the Autonomous System, with
    the backbone as hub and each of the non-backbone areas as
    spokes.

--------------------------------------------------------------------[Page 27]

骨干拓扑表明了区域所使用的骨干路径。骨干区域的拓扑可通过虚链路来增强。这给与系统管理员在区域间路由一点控制权。

区域路由器用于将数据包转发出源区域,选择区域边界路由器的方式与选择通告外部路由的路由器的方式完全相同。区域的每个边界路由器都汇总了所有到外部其他区域的开销。在所有的SPF树计算生成完成后,所有区域间的路由可由区域边界汇总计算出。

    The topology of the backbone dictates the backbone paths used
    between areas.  The topology of the backbone can be enhanced by
    adding virtual links.  This gives the system administrator some
    control over the routes taken by inter-area traffic.

    The correct area border router to use as the packet exits the
    source area is chosen in exactly the same way routers
    advertising external routes are chosen.  Each area border router
    in an area summarizes for the area its cost to all networks
    external to the area.  After the SPF tree is calculated for the
    area, routes to all inter-area destinations are calculated by
    examining the summaries of the area border routers. 

3.3.路由器的计算

在介绍区域的概念之前,定义只有OSPF路由器具有通告外部信息的能力,例如Figure 2的路由器RT5。当AS划分出不同OSPF区域时,路由器可由如下4个属性功能进一步划分。

内部路由器
一个所有直连网路属于同一个区域的路由器。这些路由器运行单个相同的基本路由算法。
区域边界路由器
一个连接了多个区域的路由器。区域边界路由器可以运行多个可复制的基本算法,每个区域具有相同的算法。区域边界路由器压缩其所连接区域的拓扑信息,以便分发到主干网。主干网又将信息分发到其他区域。
骨干路由器
一个具有连接至骨干区域接口的路由器。这包括所有接口具有超过一个区域的路由器(例如区域边界路由器)。然而骨干路由器并不总是区域边界路由器。那些所有接口都连接至骨干区域的路由器也可称为骨干路由器。
AS边界路由器
交换了属于其他自治系统路由器信息的路由器。这样的路由器在整个自治系统中通告AS外部路由信息。

    Before the introduction of areas, the only OSPF routers having a
    specialized function were those advertising external routing
    information, such as Router RT5 in Figure 2.  When the AS is
    split into OSPF areas, the routers are further divided according
    to function into the following four overlapping categories:

    Internal routers
        A router with all directly connected networks belonging to
        the same area. These routers run a single copy of the basic
        routing algorithm.

    Area border routers
        A router that attaches to multiple areas.  Area border
        routers run multiple copies of the basic algorithm, one copy
        for each attached area. Area border routers condense the
        topological information of their attached areas for
        distribution to the backbone.  The backbone in turn
        distributes the information to the other areas.

    Backbone routers
        A router that has an interface to the backbone area.  This
        includes all routers that interface to more than one area
        (i.e., area border routers).  However, backbone routers do
        not have to be area border routers.  Routers with all
        interfaces connecting to the backbone area are supported.

    AS boundary routers
        A router that exchanges routing information with routers
        belonging to other Autonomous Systems.  Such a router
        advertises AS external routing information throughout the
        Autonomous System.  The paths to each AS boundary router are
        known by every router in the AS.  This classification is
        completely independent of the previous classifications: AS
        boundary routers may be internal or area border routers, and
        may or may not participate in the backbone.

--------------------------------------------------------------------[Page 28]

3.4.一个简易的区域配置

Figure 6 展示了一个简单的区域配置。第一个区域由N1-N4网络及其依附的RT1-RT4构成。第二个区域由N6-N8网络及其依附的RT7, RT8, RT10和 RT11构成。第三个区域由N9-N11网络及其附着RT9, RT11, RT12和主机H1构成。第三个区域这样配置是为了当通告外部信息进区域中时,N9-N11网络和主机H1可被编组到一条路由中。

    Figure 6 shows a sample area configuration.  The first area
    consists of networks N1-N4, along with their attached routers
    RT1-RT4.  The second area consists of networks N6-N8, along with
    their attached routers RT7, RT8, RT10 and RT11.  The third area
    consists of networks N9-N11 and Host H1, along with their
    attached routers RT9, RT11 and RT12.  The third area has been
    configured so that networks N9-N11 and Host H1 will all be
    grouped into a single route, when advertised external to the
    area (see Section 3.5 for more details).

在Figure 6中,路由器RT1, RT2, RT5, RT6, RT8, RT9和RT12是内部路由器。路由器RT3, RT4, RT7, RT10和RT11是区域边界路由器。最终,如之前所定义,路由器RT5和RT7是AS边界路由器。

    In Figure 6, Routers RT1, RT2, RT5, RT6, RT8, RT9 and RT12 are
    internal routers.  Routers RT3, RT4, RT7, RT10 and RT11 are area
    border routers.  Finally, as before, Routers RT5 and RT7 are AS
    boundary routers.

Figure 7展示了area1的LSDB。图片完全描述了区域的内部路由。它也完全描述了两个内部路由器RT1和RT2的网络图。区域边界路由器RT3和RT4的工作是向area1通告到其他目的区域的距离。这些在Figure 7中由虚线末节路由指示。此外,RT3和RT4必须将 AS 边界路由器RT5和RT7的位置通告到area1。最后,来自RT5和RT7的AS外部LSA在整个AS中泛滥,尤其是在整个area1中。这些LSA包含在area1的数据库中,并生成到网络N12-N15的路由。

    Figure 7 shows the resulting link-state database for the Area 1.
    The figure completely describes that area's intra-area routing.
    It also shows the complete view of the internet for the two
    internal routers RT1 and RT2.  It is the job of the area border
    routers, RT3 and RT4, to advertise into Area 1 the distances to
    all destinations external to the area.  These are indicated in
    Figure 7 by the dashed stub routes.  Also, RT3 and RT4 must
    advertise into Area 1 the location of the AS boundary routers
    RT5 and RT7.  Finally, AS-external-LSAs from RT5 and RT7 are
    flooded throughout the entire AS, and in particular throughout
    Area 1.  These LSAs are included in Area 1's database, and yield
    routes to Networks N12-N15.


         ...........................
         .   +                     .
         .   | 3+---+              .      N12      N14
         . N1|--|RT1|\ 1           .        \ N13 /
         .   |  +---+ \            .        8\ |8/8
         .   +         \ ____      .          \|/
         .              /    \   1+---+8    8+---+6
         .             *  N3  *---|RT4|------|RT5|--------+
         .              \____/    +---+      +---+        |
         .    +         /      \   .           |7         |
         .    | 3+---+ /        \  .           |          |
         .  N2|--|RT2|/1        1\ .           |6         |
         .    |  +---+            +---+8    6+---+        |
         .    +                   |RT3|------|RT6|        |
         .                        +---+      +---+        |
         .                      2/ .         Ia|7         |
         .                      /  .           |          |
         .             +---------+ .           |          |
         .Area 1           N4      .           |          |
         ...........................           |          |
      ..........................               |          |
      .            N11         .               |          |
      .        +---------+     .               |          |
      .             |          .               |          |    N12
      .             |3         .             Ib|5         |6 2/
      .           +---+        .             +----+     +---+/
      .           |RT9|        .    .........|RT10|.....|RT7|---N15.
      .           +---+        .    .        +----+     +---+ 9    .
      .             |1         .    .    +  /3    1\      |1       .
      .            _|__        .    .    | /        \   __|_       .
      .           /    \      1+----+2   |/          \ /    \      .
      .          *  N9  *------|RT11|----|            *  N6  *     .
      .           \____/       +----+    |             \____/      .
      .             |          .    .    |                |        .
      .             |1         .    .    +                |1       .
      .  +--+   10+----+       .    .   N8              +---+      .
      .  |H1|-----|RT12|       .    .                   |RT8|      .
      .  +--+SLIP +----+       .    .                   +---+      .
      .             |2         .    .                     |4       .
      .             |          .    .                     |        .
      .        +---------+     .    .                 +--------+   .
      .            N10         .    .                     N7       .
      .                        .    .Area 2                        .
      .Area 3                  .    ................................
      ..........................

                Figure 6: A sample OSPF area configuration

路由器RT3和RT4必须也汇总area1的拓扑分发到骨干区域中。这些骨干LSAs展示于Table 4。这一汇总信息展示了那些网络蕴含于area1中(例如N1-N4),以及路由器RT3和RT4分别到这些网络的距离

    Routers RT3 and RT4 must also summarize Area 1's topology for
    distribution to the backbone.  Their backbone LSAs are shown in
    Table 4.  These summaries show which networks are contained in
    Area 1 (i.e., Networks N1-N4), and the distance to these
    networks from the routers RT3 and RT4 respectively.

骨干区域的LSDB展示于Figure 8。这些路由器都属于骨干路由器。路由器RT11是骨干路由器因为其属于两个区域。为了使骨干区域连续,在路由器R10和R11之间配置了一条虚链路。

    The link-state database for the backbone is shown in Figure 8.
    The set of routers pictured are the backbone routers.  Router
    RT11 is a backbone router because it belongs to two areas.  In
    order to make the backbone connected, a virtual link has been
    configured between Routers R10 and R11.

区域边界路由器RT3, RT4, RT7, RT10和RT11压缩他们所附着的非骨干区域路由信息以传递给骨干区域,这些虚线末节显示于Figure 8。请记住,第三个区域已将网络N9-N11和主机H1压缩为单个路由。这将为Figure 8中的网络N9-N11和主机H1生成一条虚线。路由器RT5和RT7是AS边界路由器;它们的外部路由信息也作为stub出现在Figure 8中的图形上。

    The area border routers RT3, RT4, RT7, RT10 and RT11 condense
    the routing information of their attached non-backbone areas for
    distribution via the backbone; these are the dashed stubs that
    appear in Figure 8.  Remember that the third area has been
    configured to condense Networks N9-N11 and Host H1 into a single
    route.  This yields a single dashed line for networks N9-N11 and
    Host H1 in Figure 8.  Routers RT5 and RT7 are AS boundary
    routers; their externally derived information also appears on
    the graph in Figure 8 as stubs.


                 Network   RT3 adv.   RT4 adv.
                 _____________________________
                 N1        4          4
                 N2        4          4
                 N3        1          1
                 N4        2          3

          Table 4: Networks advertised to the backbone
                    by Routers RT3 and RT4.

--------------------------------------------------------------------[Page 31]
在这里插入图片描述
Networks and routers are represented by vertices.
An edge of cost X connects Vertex A to Vertex B iff
the intersection of Column A and Row B is marked
with an X.

--------------------------------------------------------------------[Page 32]
在这里插入图片描述
Networks and routers are represented by vertices.
An edge of cost X connects Vertex A to Vertex B iff
the intersection of Column A and Row B is marked
with an X.

骨干区域使能了在区域边界路由器间交换汇总信息。每个区域边界路由器都会从所有其他区域边界路由器监听区域汇总。然后,它通过检查收集的LSA并添加到每个通告路由器的骨干距离,并形成与其区域外所有网络的距离的图片

    The backbone enables the exchange of summary information between
    area border routers.  Every area border router hears the area
    summaries from all other area border routers.  It then forms a
    picture of the distance to all networks outside of its area by
    examining the collected LSAs, and adding in the backbone
    distance to each advertising router.

再次以路由器RT3和RT4为例,该过程如下:它们首先计算骨干区域的SPF树。这给出了到所有其他区域边界路由器的距离。还注意到属于骨干的网络(la和lb)和AS边界路由器(RT5和RT7)的距离。计算结果如Table 5所示。

    Again using Routers RT3 and RT4 as an example, the procedure
    goes as follows: They first calculate the SPF tree for the
    backbone.  This gives the distances to all other area border
    routers.  Also noted are the distances to networks (Ia and Ib)
    and AS boundary routers (RT5 and RT7) that belong to the
    backbone.  This calculation is shown in Table 5.

接下来,通过寻找这些区域边界路由器的汇总,RT3和RT4可以确定到除其自身区域的所有其他区域。然后通过RT3和RT4在该区域内部公布这些距离。路由器RT3和RT4将制作到area1中的通告如Table 6所示。请注意,Table 6假定为骨干区域配置了一个区域范围,并且骨干区域将Ia和Ib分组成单个LSA。两者之间的负载分担用于到网络N8的流量。

    Next, by looking at the area summaries from these area border
    routers, RT3 and RT4 can determine the distance to all networks
    outside their area.  These distances are then advertised
    internally to the area by RT3 and RT4.  The advertisements that
    Router RT3 and RT4 will make into Area 1 are shown in Table 6.
    Note that Table 6 assumes that an area range has been configured
    for the backbone which groups Ia and Ib into a single LSA.
    load share between the two for traffic to Network N8.

由输入到area1的信息使能了一个内部路由器,
路由器RT3和RT4输入到area1的信息使内部路由器,例如RT1,能够智能地选择区域边界路由器。路由器RT1将使用RT4处理到网络N6的流量,使用RT3处理到网络N10的流量,并将两者之间到网络N8的流量使用负载均衡。

    The information imported into Area 1 by Routers RT3 and RT4
    enables an internal router, such as RT1, to choose an area
    border router intelligently.  Router RT1 would use RT4 for
    traffic to Network N6, RT3 for traffic to Network N10, and would
    load share between the two for traffic to Network N8.

在这里插入图片描述
--------------------------------------------------------------------[Page 34]
在这里插入图片描述
RT1路由器也以这种方式确定到AS边界路由器RT5和RT7的最短路径。并且,在发送到目的为另一个自治系统的信息时,通过寻找RT5和RT7的AS-external-LSAs,路由器RT1可以将RT5或RT7确定为目的节点(N12-N15网络之一)。
请注意,路由器RT6和RT10之间的线路故障将导致骨干网断开连接。在路由器RT7和RT10之间配置虚拟链路将为骨干网提供更多的连接性和对此类故障的更多抵抗力。

    Router RT1 can also determine in this manner the shortest path
    to the AS boundary routers RT5 and RT7.  Then, by looking at RT5
    and RT7's AS-external-LSAs, Router RT1 can decide between RT5 or
    RT7 when sending to a destination in another Autonomous System
    (one of the networks N12-N15).

    Note that a failure of the line between Routers RT6 and RT10
    will cause the backbone to become disconnected.  Configuring a
    virtual link between Routers RT7 and RT10 will give the backbone
    more connectivity and more resistance to such failures.

3.5.对IP子网的支持

OSPF 将IP地址掩码附加到每个通告的路由。掩码指定了特定路由所描述的地址范围。例如,一个summary-LSA为掩码0xffff0000目的网段128.185.0.0描述了128.185.0.0-128.185.255.255路由信息。相似的,具有掩码0xffffffff的主机路由,表明了只有一个目的地址

    OSPF attaches an IP address mask to each advertised route.  The
    mask indicates the range of addresses being described by the
    particular route.  For example, a summary-LSA for the
    destination 128.185.0.0 with a mask of 0xffff0000 actually is
    describing a single route to the collection of destinations
    128.185.0.0 - 128.185.255.255.  Similarly, host routes are
    always advertised with a mask of 0xffffffff, indicating the
    presence of only a single destination.

--------------------------------------------------------------------[Page 35]

将掩码包含在每个通告的目标中,可以实现通常称为可变长度子网划分的功能。这意味着单个 A、B或C类网络号可以分解为多个不同大小的子网。例如,网络128.185.0.0可以分解为 62 个大小可变的子网:15个大小为 4K 的子网、15个大小为256的子网和32个大小为8的子网。Table 7显示了一些生成的网络地址及其掩码。

    Including the mask with each advertised destination enables the
    implementation of what is commonly referred to as variable-
    length subnetting.  This means that a single IP class A, B, or C
    network number can be broken up into many subnets of various
    sizes.  For example, the network 128.185.0.0 could be broken up
    into 62 variable-sized subnets: 15 subnets of size 4K, 15
    subnets of size 256, and 32 subnets of size 8.  Table 7 shows
    some of the resulting network addresses together with their
    masks.

              Network address   IP address mask   Subnet size
              _______________________________________________
              128.185.16.0      0xfffff000        4K
              128.185.1.0       0xffffff00        256
              128.185.0.8       0xfffffff8        8


                     Table 7: Some sample subnet sizes.

有许多将A、B或C类网络划分成不同可变大小子网的方式。执行此操作的详细过程超出了本规范的范围。但是,此规范建立了以下准则:转发 IP 数据包时,它始终转发到与数据包目标最匹配的网络。在这里,最佳匹配是最长或最具体的匹配项的同义词。例如,目标为0.0.0.0且掩码0x00000000的默认路由始终与每个IP目标匹配。 然而,它总是不如任何其他匹配项那么具体。必须分配子网掩码,以便明确与任何 IP 目标的最佳匹配。

    There are many possible ways of dividing up a class A, B, and C
    network into variable sized subnets.  The precise procedure for
    doing so is beyond the scope of this specification.  This
    specification however establishes the following guideline: When
    an IP packet is forwarded, it is always forwarded to the network
    that is the best match for the packet's destination.  Here best
    match is synonymous with the longest or most specific match.
    For example, the default route with destination of 0.0.0.0 and
    mask 0x00000000 is always a match for every IP destination.  Yet
    it is always less specific than any other match.  Subnet masks
    must be assigned so that the best match for any IP destination
    is unambiguous.

将地址掩码附加到每个路由还可以启用IP超网的支持。例如,可以为单个物理网段分配 [地址,掩码] 对 [192.9.4.0,0xfffffc00/22]。然后,该网段将是单个IP网络,包含来自四个连续的C类网络号192.9.4.0到192.9.7.0的地址。随着CIDR的出现,这种处理现在变得司空见惯(见[参考文献10])。

    Attaching an address mask to each route also enables the support
    of IP supernetting. For example, a single physical network
    segment could be assigned the [address,mask] pair
    [192.9.4.0,0xfffffc00]. The segment would then be single IP
    network, containing addresses from the four consecutive class C
    network numbers 192.9.4.0 through 192.9.7.0. Such addressing is
    now becoming commonplace with the advent of CIDR (see [Ref10]).

为了在区域边界上得到最佳的聚合,可以使用区域地址范围(详细内容可查看Section C.2)。每个地址范围都定义为一个[地址,掩码]对。然后,许多单独的网络可能包含在单个地址范围内,就像子网网络由许多单独的子网组成一样。 然后,区域边界路由器通过为每个地址范围通告单个路由来汇总区域内容(以便分到到骨干区域)。路由的开销是落在指定范围内的任何网络的最大成本。
例如,在单个OSPF区域内配置一个IP子网。此时,单个地址范围可配置为:属于其原本掩码一个A、B或C类地址范围。在区域内,可以定义任意数量的可变大小的子网。但是,在该区域之外,将分发整个子网网络的单个路由,甚至隐藏了网络根本没有子网的事实。此路由的开销取组件子网的开销集合中的最大开销。

    In order to get better aggregation at area boundaries, area
    address ranges can be employed (see Section C.2 for more
    details).  Each address range is defined as an [address,mask]
    pair.  Many separate networks may then be contained in a single
    address range, just as a subnetted network is composed of many
    separate subnets.  Area border routers then summarize the area
    contents (for distribution to the backbone) by advertising a
    single route for each address range.  The cost of the route is
    the maximum cost to any of the networks falling in the specified
    range.

    For example, an IP subnetted network might be configured as a
    single OSPF area.  In that case, a single address range could be
    configured:  a class A, B, or C network number along with its
    natural IP mask.  Inside the area, any number of variable sized
    subnets could be defined.  However, external to the area a
    single route for the entire subnetted network would be
    distributed, hiding even the fact that the network is subnetted
    at all.  The cost of this route is the maximum of the set of
    costs to the component subnets.

3.6.末节网络的支持

在一些自治系统中,主要的LSDB可能主要由AS-external-LSAs组成。一个OSPFAS-external-LSAs同擦汗给你在整个AS内泛洪。然而,OSPF 允许将某些区域配置为“末节区域”。AS-external-LSAs不会在末节区域泛洪,而是仅基于(每个区域)默认产生到这些区域中的AS外部目标的路由。这减少了末节区域内部路由器的链路状态数据库大小,从而降低了内存要求。

    In some Autonomous Systems, the majority of the link-state
    database may consist of AS-external-LSAs.  An OSPF AS-external-
    LSA is usually flooded throughout the entire AS.  However, OSPF
    allows certain areas to be configured as "stub areas".  AS-
    external-LSAs are not flooded into/throughout stub areas;
    routing to AS external destinations in these areas is based on a
    (per-area) default only.  This reduces the link-state database
    size, and therefore the memory requirements, for a stub area's
    internal routers.

为了OSPFOSPF末节区域,必须在末节区域使用默认路由。具体如下。 一个或多个末节区域边界路由器必须通过summary-LSAs将默认路由通告到末节区域。这些默认summary-LSAs会泛洪在整个末节区域中,但不会再进一步泛洪。 (因此,这些缺省值仅适用于特定的末节区域)。这些汇总默认路由将用于区域内或区域间路径无法显式访问的任何目标。(即 AS 外部目标)

    In order to take advantage of the OSPF stub area support,
    default routing must be used in the stub area.  This is
    accomplished as follows.  One or more of the stub area's area
    border routers must advertise a default route into the stub area
    via summary-LSAs.  These summary defaults are flooded throughout
    the stub area, but no further.  (For this reason these defaults
    pertain only to the particular stub area).  These summary
    default routes will be used for any destination that is not
    explicitly reachable by an intra-area or inter-area path (i.e.,
    AS external destinations).

当一个区域只有一个出口点时,或者当不需要在每个外部目标的基础上选择出口点时,可以将该区域配置为末节区域。 例如,Figure 6中的area3可以配置为末节区域,因为所有外部流量都必须通过其单区域边界路由器RT11传输。如果将area3配置为末节区域,则路由器RT11将通告默认路由以在area3内进行泛洪(在summary-LSA),而不是将网络N12-N15的 AS外部LSA泛洪到整个区域中。

    An area can be configured as a stub when there is a single exit
    point from the area, or when the choice of exit point need not
    be made on a per-external-destination basis.  For example, Area
    3 in Figure 6 could be configured as a stub area, because all
    external traffic must travel though its single area border
    router RT11.  If Area 3 were configured as a stub, Router RT11
    would advertise a default route for distribution inside Area 3
    (in a summary-LSA), instead of flooding the AS-external-LSAs for
    Networks N12-N15 into/throughout the area.

OSPF协议确保属于某个区域的所有路由器就该区域是否已配置为末节区域达成一致。这保证了在AS外部LSA泛洪时不会出现混淆。
对末节区域的使用有一些限制。无法通过末节区域配置虚拟链路。此外,AS边界路由器不能放置在末节区域的内部。

    The OSPF protocol ensures that all routers belonging to an area
    agree on whether the area has been configured as a stub.  This
    guarantees that no confusion will arise in the flooding of AS-
    external-LSAs.

    There are a couple of restrictions on the use of stub areas.
    Virtual links cannot be configured through stub areas.  In
    addition, AS boundary routers cannot be placed internal to stub
    areas.

3.7.区域分区

OSPF不会主动尝试修复区域分区。当一个区域被分割时,每个部分都只是一个单独的区域。然后,骨干区域在新区域之间执行路由。在分区之前可通过区域内路由到达的某些目标现在将需要区域间路由。
但是,为了在分区后保持完整的路由,地址范围不得拆分为区域分区的多个部分。此外,骨干区域本身不得分区。如果分区,自治系统的某些部分将变得无法访问。此时可以通过配置虚链路来修复骨干区域(请参见第15节)。

    OSPF does not actively attempt to repair area partitions.  When
    an area becomes partitioned, each component simply becomes a
    separate area.  The backbone then performs routing between the
    new areas.  Some destinations reachable via intra-area routing
    before the partition will now require inter-area routing.

    However, in order to maintain full routing after the partition,
    an address range must not be split across multiple components of
    the area partition. Also, the backbone itself must not
    partition.  If it does, parts of the Autonomous System will
    become unreachable.  Backbone partitions can be repaired by
    configuring virtual links (see Section 15).

考虑区域分区的另一种方法是查看第2节中介绍的自治系统图。可以将区域ID视为图形边缘的颜色[1]。图的每个边缘都连接到一个网络,或者本身就是一个点对点网络。在任一情况下,边缘都使用网络的区域ID着色。

    Another way to think about area partitions is to look at the
    Autonomous System graph that was introduced in Section 2.  Area
    IDs can be viewed as colors for the graph's edges.[1] Each edge
    of the graph connects to a network, or is itself a point-to-
    point network.  In either case, the edge is colored with the
    network's Area ID.

一个区域的边缘,总是具有相同的颜色,并且由顶点相互连接,表示一个区域。如果自治系统的拓扑结构完好无损,则图形将具有多个颜色区域,每种颜色都是不同的区域 ID

    A group of edges, all having the same color, and interconnected
    by vertices, represents an area.  If the topology of the
    Autonomous System is intact, the graph will have several regions
    of color, each color being a distinct Area ID.

当 AS 拓扑更改时,其中一个区域可能会被分区。然后,AS的图形将具有相同颜色(区域ID)的多个区域。只要这些相同颜色的区域由单个骨干区域连接,自治系统中的路由将继续运行。

    When the AS topology changes, one of the areas may become
    partitioned.  The graph of the AS will then have multiple
    regions of the same color (Area ID).  The routing in the
    Autonomous System will continue to function as long as these
    regions of same color are connected by the single backbone
    region.

--------------------------------------------------------------------[Page 39]

4.汇聚功能

OSPF 基本路由算法的单独副本在每个区域中运行。具有多个区域接口的路由器运行算法的多个副本。路由算法的简要摘要如下。

A separate copy of OSPF's basic routing algorithm runs in each area.
Routers having interfaces to multiple areas run multiple copies of
the algorithm.  A brief summary of the routing algorithm follows.

当路由器启动时,它首先初始化路由协议数据结构。然后,路由器等待来自较低级别协议的指示,表明其接口正常工作。

When a router starts, it first initializes the routing protocol data
structures.  The router then waits for indications from the lower-
level protocols that its interfaces are functional.

随后,一个路由器使用OSPF的Hello协议进行邻居发现。路由器发送Hello包给邻居,兵器收到邻居的Hello包。在广播和点到点网络上,路由器通过发送它的Hello包给组播地址AllSPFRouters从而动态探测到邻居的存在。在非广播网络上,为了发现邻居一些配置信息可能是必要的。在广播和NBMA网络上,Hello也为网络选举DR。

A router then uses the OSPF's Hello Protocol to acquire neighbors.
The router sends Hello packets to its neighbors, and in turn
receives their Hello packets.  On broadcast and point-to-point
networks, the router dynamically detects its neighboring routers by
sending its Hello packets to the multicast address AllSPFRouters.
On non-broadcast networks, some configuration information may be
necessary in order to discover neighbors.  On broadcast and NBMA
networks the Hello Protocol also elects a Designated router for the
network.

路由器在它的新邻居之间可能试图形成邻接。LSDB在邻接路由器对之间同步。在广播和NBMA网络上,DR将会形成邻接。

The router will attempt to form adjacencies with some of its newly
acquired neighbors.  Link-state databases are synchronized between
pairs of adjacent routers.  On broadcast and NBMA networks, the
Designated Router determines which routers should become adjacent.

邻接控制着路由信息的分发。路由更新的发送和接受只在邻接关系路由器上进行。

Adjacencies control the distribution of routing information.
Routing updates are sent and received only on adjacencies.

一个路由器周期性的通告状态,也叫做链路状态。当路由状态改变时链路状态也被通告。路由器的邻接反映在其LSA的内容中。邻接和链路状态之间的这种关系允许协议及时检测死路由器。

A router periodically advertises its state, which is also called
link state.  Link state is also advertised when a router's state
changes.  A router's adjacencies are reflected in the contents of
its LSAs.  This relationship between adjacencies and link state
allows the protocol to detect dead routers in a timely fashion.

LSA在整个区域泛洪。泛洪算法是可靠的以确保区域内所有路由器都有精确的LSDB。该数据库由属于该区域的每个路由器发起的LSA集合组成。根据此数据库,每个路由器计算一个最短路径树,其自身为根。此最短路径树反过来为协议生成一个路由表。

LSAs are flooded throughout the area.  The flooding algorithm is
reliable, ensuring that all routers in an area have exactly the same
link-state database.  This database consists of the collection of
LSAs originated by each router belonging to the area.  From this
database each router calculates a shortest-path tree, with itself as
root.  This shortest-path tree in turn yields a routing table for
the protocol.

--------------------------------------------------------------------[Page 40]

4.1.区域间路由

上一节描述了协议在单个区域中的操作。对于区域内路由,没有其他路由信息是相关的。为了能够路由到区域外的目的地,区域边界路由器将其他路由信息注入该区域。这些附加信息是对自治系统拓扑其余部分的提炼。

    The previous section described the operation of the protocol
    within a single area.  For intra-area routing, no other routing
    information is pertinent.  In order to be able to route to
    destinations outside of the area, the area border routers inject
    additional routing information into the area.  This additional
    information is a distillation of the rest of the Autonomous
    System's topology.

这种提炼按如下方式完成:根据定义,每个区域边界路由器都连接到骨干区域。每个区域边界路由器汇总了其连接的非骨干区域的拓扑结构,以便在主干上传输,从而传输到所有其他区域边界路由器。然后,区域边界路由器具有有关骨干区域的完整拓扑信息,以及来自其他每个区域边界路由器的区域摘要。根据此信息,路由器计算到所有区域间目标的路径。然后,路由器将这些路径通告到其连接区域。这使该区域的内部路由器能够在转发流量区域间目标时选择最佳的出口路由器。

    This distillation is accomplished as follows: Each area border
    router is by definition connected to the backbone.  Each area
    border router summarizes the topology of its attached non-
    backbone areas for transmission on the backbone, and hence to
    all other area border routers.  An area border router then has
    complete topological information concerning the backbone, and
    the area summaries from each of the other area border routers.
    From this information, the router calculates paths to all
    inter-area destinations.  The router then advertises these paths
    into its attached areas.  This enables the area's internal
    routers to pick the best exit router when forwarding traffic
    inter-area destinations.

4.2.AS外部路由

具有有关其他自治系统信息的路由器可以在整个AS中泛洪此信息。此外部路由信息将逐字分发给每个参与路由器。有一个例外:外部路由信息不会泛洪到“末节”区域(请参见第3.6节)。

    Routers that have information regarding other Autonomous Systems
    can flood this information throughout the AS.  This external
    routing information is distributed verbatim to every
    participating router.  There is one exception: external routing
    information is not flooded into "stub" areas (see Section 3.6).

要利用外部路由信息,必须在整个AS中知道通告外部信息的所有路由器的路径(末节区域除外)。因此,这些AS边界路由器的位置由(非末节)区域边界路由器汇总。

    To utilize external routing information, the path to all routers
    advertising external information must be known throughout the AS
    (excepting the stub areas).  For that reason, the locations of
    these AS boundary routers are summarized by the (non-stub) area
    border routers.

--------------------------------------------------------------------[Page 40]

4.3.路由协议数据包

OSPF协议使用IP协议89直接通过IP运行。OSPF不提供任何显式分段/重组支持。当需要分段时,使用IP分段/重组。OSPF协议数据包的设计使得大型协议数据包通常可以拆分为多个较小的协议数据包。建议采用这种做法,尽可能避免IP分片。

    The OSPF protocol runs directly over IP, using IP protocol 89.
    OSPF does not provide any explicit fragmentation/reassembly
    support.  When fragmentation is necessary, IP
    fragmentation/reassembly is used.  OSPF protocol packets have
    been designed so that large protocol packets can generally be
    split into several smaller protocol packets.  This practice is
    recommended; IP fragmentation should be avoided whenever
    possible.

发送路由协议数据包时,应始终将IP TOS字段设置为0。如果可能,路由协议数据包在发送和接收时都应优先于常规IP数据流量。为了帮助实现此目的,OSPF协议数据包的IP优先级字段应设置为值“互联控制”(请参阅 [Ref5])。

    Routing protocol packets should always be sent with the IP TOS
    field set to 0.  If at all possible, routing protocol packets
    should be given preference over regular IP data traffic, both
    when being sent and received.  As an aid to accomplishing this,
    OSPF protocol packets should have their IP precedence field set
    to the value Internetwork Control (see [Ref5]).

所有OSPF协议数据包共享附录A中所述的通用协议标头。Table 8中列出了OSPF数据包类型。 附录A中也描述了它们的格式。

    All OSPF protocol packets share a common protocol header that is
    described in Appendix A.  The OSPF packet types are listed below
    in Table 8.  Their formats are also described in Appendix A.


         Type   Packet  name           Protocol  function
         __________________________________________________________
         1      Hello                  Discover/maintain  neighbors
         2      Database Description   Summarize database contents
         3      Link State Request     Database download
         4      Link State Update      Database update
         5      Link State Ack         Flooding acknowledgment


                        Table 8: OSPF packet types.

OSPF的Hello协议使用Hello包发现和维护邻居关系。DBD和LSR用于形成邻接。OSPF的可靠更新机制由LSU和LSAck实现。

    OSPF's Hello protocol uses Hello packets to discover and
    maintain neighbor relationships.  The Database Description and
    Link State Request packets are used in the forming of
    adjacencies.  OSPF's reliable update mechanism is implemented by
    the Link State Update and Link State Acknowledgment packets.

--------------------------------------------------------------------[Page 40]

每个链路状态更新数据包都携带一组新的链路状态通告(LSA),距离其发起点一跳。一个LSU可能包含多个路由器的LSA。每个LSA都使用原始路由器的ID及其链路状态内容的校验和进行标记。每个LSA还有一个类型字段;Table 9列出了不同类型的OSPF LSA。
OSPF 路由数据包(Hello 除外)仅通过邻接发送。这意味着所有OSPF协议数据包都通过单个IP跃点传输,但通过虚连接发送的数据包除外。OSPF协议数据包的IP源地址是路由器邻接的一端,IP目标地址是邻接的另一端或 IP 多播地址。

    Each Link State Update packet carries a set of new link state
    advertisements (LSAs) one hop further away from their point of
    origination.  A single Link State Update packet may contain the
    LSAs of several routers.  Each LSA is tagged with the ID of the
    originating router and a checksum of its link state contents.
    Each LSA also has a type field; the different types of OSPF LSAs
    are listed below in Table 9.

    OSPF routing packets (with the exception of Hellos) are sent
    only over adjacencies.  This means that all OSPF protocol
    packets travel a single IP hop, except those that are sent over
    virtual adjacencies.  The IP source address of an OSPF protocol
    packet is one end of a router adjacency, and the IP destination
    address is either the other end of the adjacency or an IP
    multicast address.


    LS     LSA                LSA description
    type   name
    ________________________________________________________
    1      Router-LSAs        Originated by all routers.
                              This LSA describes
                              the collected states of the
                              router's interfaces to an
                              area. Flooded throughout a
                              single area only.
    ________________________________________________________
    2      Network-LSAs       Originated for broadcast
                              and NBMA networks by
                              the Designated Router. This
                              LSA contains the
                              list of routers connected
                              to the network. Flooded
                              throughout a single area only.
    ________________________________________________________
    3,4    Summary-LSAs       Originated by area border
                              routers, and flooded through-
                              out the LSA's associated
                              area. Each summary-LSA
                              describes a route to a
                              destination outside the area,
                              yet still inside the AS
                              (i.e., an inter-area route).
                              Type 3 summary-LSAs describe
                              routes to networks. Type 4
                              summary-LSAs describe
                              routes to AS boundary routers.
    ________________________________________________________
    5      AS-external-LSAs   Originated by AS boundary
                              routers, and flooded through-
                              out the AS. Each
                              AS-external-LSA describes
                              a route to a destination in
                              another Autonomous System.
                              Default routes for the AS can
                              also be described by
                              AS-external-LSAs.
        Table 9: OSPF link state advertisements (LSAs).

4.4.基本实现要求

OSPF 的实现需要以下部分支持:

定时器
需要两种不同类型的计时器。第一种称为“单发计时器”,触发一次并导致协议事件被处理。第二种称为“间隔计时器”,以连续间隔发射。它们用于定期发送数据包。一个很好的例子是Hello数据包的定期广播。这两种计时器的粒度均为一秒。
应使用间隔计时器以避免漂移。在某些路由器实现中,数据包处理可能会影响计时器的执行。 当多个路由器连接到单个网络时,所有路由器都进行广播,这可能导致路由数据包的同步(应避免)。如果无法实现定时器以避免漂移,则应在每次触发时从间隔定时器中添加/减去少量随机量。

IP组播
某些OSPF数据包采用IP组播数据包的形式。需要支持接收和发送IP组播数据包,以及相应的较低级别协议支持。OSPF 使用的IP组播数据包永远不会传输超过一个跃点。因此,不需要能够转发 IP组播数据包。有关IP组播数据包的信息,请参见[Ref7]。

可变长子网支持
路由器的IP协议支持必须包括将单个A、B 或 C类网络号划分为多个不同大小的子网的功能。这通常称为可变长度子网划分;有关详细信息,请参见第3.5节。

IP超网支持
路由器的IP协议支持必须包括将A、B 和 C 类网络的连续集合聚合为更大数量的IP集合(称为超网)的能力。超网已被提议作为改善全球互联网中IP路由扩展的一种方法。有关 IP 超网的详细信息,请参阅 [Ref10]。

低水平协议支持
这里所指的较低级别的协议是网络访问协议,例如以太网数据链路层。当网络接口up和down时,必须将指示从这些协议传递到OSPF。例如,在以太网上,知道以太网收发器电缆何时拔出是很有价值的。

非广播低水平协议支持
在非广播网络上,OSPF Hello协议可以通过在尝试将数据包发送到死路由器或不存在路由器时提供指示来提供帮助。 例如,在X.25 PDN上,如果接收到具有适当原因和诊断的X.25清除,则可能指示相邻路由器的死机,并且此信息将传递给OSPF。

列表操作基元
OSPF的大部分功能都是根据其在LSA列表中的操作来描述的。例如,持续重传LSA到相邻路由器直到确认的LSA集合被描述为一个列表。任何特定的LSA都可能在许多这样的列表上。OSPF 的实现需要能够操作这些列表,根据需要添加和删除组成 LSA。

任务支持
本规范中描述的某些过程调用其他过程。有时,这些其他过程应以内联方式执行,即在当前过程完成之前执行。这在文本中通过执行过程的指令来指示。在其他时候,仅当当前过程完成时才执行其他过程。这由计划任务的说明指示。

    An implementation of OSPF requires the following pieces of
    system support:


    Timers
        Two different kind of timers are required.  The first kind,
        called "single shot timers", fire once and cause a protocol
        event to be processed.  The second kind, called "interval
        timers", fire at continuous intervals.  These are used for
        the sending of packets at regular intervals.  A good example
        of this is the regular broadcast of Hello packets. The
        granularity of both kinds of timers is one second.

        Interval timers should be implemented to avoid drift.  In
        some router implementations, packet processing can affect
        timer execution.  When multiple routers are attached to a
        single network, all doing broadcasts, this can lead to the
        synchronization of routing packets (which should be
        avoided).  If timers cannot be implemented to avoid drift,
        small random amounts should be added to/subtracted from the
        interval timer at each firing.

    IP multicast
        Certain OSPF packets take the form of IP multicast
        datagrams.  Support for receiving and sending IP multicast
        datagrams, along with the appropriate lower-level protocol
        support, is required.  The IP multicast datagrams used by
        OSPF never travel more than one hop. For this reason, the
        ability to forward IP multicast datagrams is not required.
        For information on IP multicast, see [Ref7].

    Variable-length subnet support
        The router's IP protocol support must include the ability to
        divide a single IP class A, B, or C network number into many
        subnets of various sizes.  This is commonly called
        variable-length subnetting; see Section 3.5 for details.

    IP supernetting support
        The router's IP protocol support must include the ability to
        aggregate contiguous collections of IP class A, B, and C
        networks into larger quantities called supernets.
        Supernetting has been proposed as one way to improve the
        scaling of IP routing in the worldwide Internet. For more
        information on IP supernetting, see [Ref10].

    Lower-level protocol support
        The lower level protocols referred to here are the network
        access protocols, such as the Ethernet data link layer.
        Indications must be passed from these protocols to OSPF as
        the network interface goes up and down.  For example, on an
        ethernet it would be valuable to know when the ethernet
        transceiver cable becomes unplugged.

    Non-broadcast lower-level protocol support
        On non-broadcast networks, the OSPF Hello Protocol can be
        aided by providing an indication when an attempt is made to
        send a packet to a dead or non-existent router.  For
        example, on an X.25 PDN a dead neighboring router may be
        indicated by the reception of a X.25 clear with an
        appropriate cause and diagnostic, and this information would
        be passed to OSPF.

    List manipulation primitives
        Much of the OSPF functionality is described in terms of its
        operation on lists of LSAs.  For example, the collection of
        LSAs that will be retransmitted to an adjacent router until
        acknowledged are described as a list.  Any particular LSA
        may be on many such lists.  An OSPF implementation needs to
        be able to manipulate these lists, adding and deleting
        constituent LSAs as necessary.

    Tasking support
        Certain procedures described in this specification invoke
        other procedures.  At times, these other procedures should
        be executed in-line, that is, before the current procedure
        is finished.  This is indicated in the text by instructions
        to execute a procedure.  At other times, the other
        procedures are to be executed only when the current
        procedure has finished.  This is indicated by instructions
        to schedule a task.

4.5.OSPF能力可选项

OSPF协议定义了几种可选能力。一个路由器通过其OSPF的Hello包,DBD和LSA表明自己对可选能力的支持。这使得路由器能在单个自治系统中支持混合可选能力。

    The OSPF protocol defines several optional capabilities.  A
    router indicates the optional capabilities that it supports in
    its OSPF Hello packets, Database Description packets and in its
    LSAs.  This enables routers supporting a mix of optional
    capabilities to coexist in a single Autonomous System.

一些能力必须特定区域所有路由器都支持。此时,路由器不会接受邻居Hello包,除非其具有可匹配的通告能力(例如,能力不匹配会阻止邻居关系的形成)。一个例子是外部路由能力(见如下)。

    Some capabilities must be supported by all routers attached to a
    specific area.  In this case, a router will not accept a
    neighbor's Hello Packet unless there is a match in reported
    capabilities (i.e., a capability mismatch prevents a neighbor
    relationship from forming).  An example of this is the
    ExternalRoutingCapability (see below).

其他功能可以在数据库交换过程中进行协商。这是通过在数据库描述数据包中指定可选功能来实现的。在这种情况下,如果功能与邻居不匹配,则只会导致链路状态数据库的一个子集在两个邻居之间交换。

    Other capabilities can be negotiated during the Database
    Exchange process.  This is accomplished by specifying the
    optional capabilities in Database Description packets.  A
    capability mismatch with a neighbor in this case will result in
    only a subset of the link state database being exchanged between
    the two neighbors.

路由表建立过程也收可选能力支持和不支持的影响。例如,由于LSA通告了可选能力,在构建最短路径树时,可以避免无法执行某些功能的路由器。
本文档定义的OSPF可选能力罗列如下。A.2节可见更多详细信息。
外部路由能力
整个OSPF区域可被配置为“末节”(可见3.6节)。AS外部LSA不会在末节区域泛洪。此功能由“OSPF 选项”字段中的E位表示(请参见第 A.2 节)。为了确保末节区域的配置一致,连接到此类区域的所有路由器都必须在其Hello数据包中清除E位(请参阅第 9.5 节和第 10.5 节)

    The routing table build process can also be affected by the
    presence/absence of optional capabilities.  For example, since
    the optional capabilities are reported in LSAs, routers
    incapable of certain functions can be avoided when building the
    shortest path tree.

    The OSPF optional capabilities defined in this memo are listed
    below.  See Section A.2 for more information.
    ExternalRoutingCapability
        Entire OSPF areas can be configured as "stubs" (see Section
        3.6).  AS-external-LSAs will not be flooded into stub areas.
        This capability is represented by the E-bit in the OSPF
        Options field (see Section A.2).  In order to ensure
        consistent configuration of stub areas, all routers
        interfacing to such an area must have the E-bit clear in
        their Hello packets (see Sections 9.5 and 10.5).

5.协议数据结构

本文描述了OSPF协议在各种协议数据结构上的操作。以下列表包含顶级OSPF数据结构。将记录任何需要完成的初始化。OSPF 区域、接口和邻居还具有本规范后面部分所述的关联数据结构。

The OSPF protocol is described herein in terms of its operation on
various protocol data structures.  The following list comprises the
top-level OSPF data structures.  Any initialization that needs to be
done is noted.  OSPF areas, interfaces and neighbors also have
associated data structures that are described later in this
specification.

Router ID
一个32位数字,用于在AS中唯一标识此路由器。一种可能的实现策略是使用属于路由器的最小IP 接口地址。如果路由器的OSPF路由器ID发生更改,则应在新的路由器 ID 生效之前重新启动路由器的OSPF软件。在这种情况下,路由器应在重新启动之前从路由域中刷新自己产生的 LSA(请参阅第 14.1 节),否则它们将持续长达MaxAge分钟。

区域结构
路由器连接到的每个区域都有自己的数据结构。此数据结构描述了基本OSPF算法的工作原理。 请记住,每个区域都运行基本OSPF算法的单独副本。

骨干区域结构
OSPF骨干区域负责区域间路由信息的传播。

虚链路配置
虚链路需要将此路由器配置为一个端节点。为了配置虚拟链路,路由器本身必须是区域边界路由器。虚拟链路由另一个端点的路由器ID标识,该端点是另一个区域边界路由器。这两个端点路由器必须连接到一个公用区域,称为虚拟链路的传输区域。虚链路是骨干区域的一部分,其行为就像是两个路由器之间未编号的点对点网络一样。虚拟链路使用其传输区域的区域内路由来转发数据包。虚拟链路通过为“传输”区域构建最短路径树来上下移动。

外部路由列表
这些是到自治系统外部目标的路由,通常从另一个路由协议(如 BGP)直接获得的,或者通过配置信息,或者通过两者的组合(例如,OSPF 使用配置的指标公布的动态外部信息)获得的。任何具有这些外部路由的路由器都称为AS边界路由器。这些路由由路由器通过AS-external-LSAs泛洪到OSPF路由域中。

AS-external-LSAs列表
链路状态数据库的一部分。这些路由器源自AS边界路由器。它们包括到自治系统外部目的地的路线。请注意,如果路由器本身是AS边界路由器,则其中一些AS外部LSA是自己产生的。

路由表
派生自链路状态数据库。路由表中的每个条目都按目标编制索引,并包含目标的开销和一组用于将数据包转发到目标的路径。路径由其类型和下一跃点描述。详细信息,请参阅第11节。

Router ID
    A 32-bit number that uniquely identifies this router in the AS.
    One possible implementation strategy would be to use the
    smallest IP interface address belonging to the router. If a
    router's OSPF Router ID is changed, the router's OSPF software
    should be restarted before the new Router ID takes effect.  In
    this case the router should flush its self-originated LSAs from
    the routing domain (see Section 14.1) before restarting, or they
    will persist for up to MaxAge minutes.

--------------------------------------------------------------------[Page 40]

Area structures
    Each one of the areas to which the router is connected has its
    own data structure.  This data structure describes the working
    of the basic OSPF algorithm.  Remember that each area runs a
    separate copy of the basic OSPF algorithm.

Backbone (area) structure
    The OSPF backbone area is responsible for the dissemination of
    inter-area routing information.

Virtual links configured
    The virtual links configured with this router as one endpoint.
    In order to have configured virtual links, the router itself
    must be an area border router.  Virtual links are identified by
    the Router ID of the other endpoint -- which is another area
    border router.  These two endpoint routers must be attached to a
    common area, called the virtual link's Transit area.  Virtual
    links are part of the backbone, and behave as if they were
    unnumbered point-to-point networks between the two routers.  A
    virtual link uses the intra-area routing of its Transit area to
    forward packets.  Virtual links are brought up and down through
    the building of the shortest-path trees for the Transit area.

List of external routes
    These are routes to destinations external to the Autonomous
    System, that have been gained either through direct experience
    with another routing protocol (such as BGP), or through
    configuration information, or through a combination of the two
    (e.g., dynamic external information to be advertised by OSPF
    with configured metric). Any router having these external routes
    is called an AS boundary router.  These routes are advertised by
    the router into the OSPF routing domain via AS-external-LSAs.

List of AS-external-LSAs
    Part of the link-state database.  These have originated from the
    AS boundary routers.  They comprise routes to destinations
    external to the Autonomous System.  Note that, if the router is
    itself an AS boundary router, some of these AS-external-LSAs
    have been self-originated.

--------------------------------------------------------------------[Page 40]

The routing table
    Derived from the link-state database.  Each entry in the routing
    table is indexed by a destination, and contains the
    destination's cost and a set of paths to use in forwarding
    packets to the destination. A path is described by its type and
    next hop.  For more information, see Section 11.

Figure 9展示了一个典型路由器收集的数据结构。图中的路由器是RT10,如Figure 6所示。请注意,路由器RT10具有配置为路由器RT11的虚拟链路,其中area2是链路的传输区域。这由Figure 9中的虚线表示。当虚拟链路变为活动状态时,通过构建区域 2 的最短路径树,它将成为骨干区域的接口(参见图 9 中描述的两个骨干区域接口)。

Figure 9 shows the collection of data structures present in a
typical router.  The router pictured is RT10, from the map in Figure
6.  Note that Router RT10 has a virtual link configured to Router
RT11, with Area 2 as the link's Transit area.  This is indicated by
the dashed line in Figure 9.  When the virtual link becomes active,
through the building of the shortest path tree for Area 2, it
becomes an interface to the backbone (see the two backbone
interfaces depicted in Figure 9).

6.区域数据结构

区域数据结构包含了所有运行基本OSPF路由算法的所有信息。每个区域包含了它自己的LSDB。一个网络属于单个区域,并且一个路由接口连接到单个区域。每个路由器邻接也属于单个区域。

The area data structure contains all the information used to run the
basic OSPF routing algorithm. Each area maintains its own link-state
database. A network belongs to a single area, and a router interface
connects to a single area. Each router adjacency also belongs to a
single area.

OSPF骨干区域是一个传播区域间路由信息特殊区域。

The OSPF backbone is the special OSPF area responsible for
disseminating inter-area routing information.

LSDB包含了起源于区域路由器的router-LSAs,network-LSAs和summary-LSAs。这些信息只在单个区域内泛洪。AS-external-LSAs列表(可见第5章)也被考虑为每个区域的LSDB的一部分。

The area link-state database consists of the collection of router-
LSAs, network-LSAs and summary-LSAs that have originated from the
area's routers.  This information is flooded throughout a single
area only.  The list of AS-external-LSAs (see Section 5) is also
considered to be part of each area's link-state database.

区域ID
一个32-bit的区域身份标识。0.0.0.0的区域ID标识为骨干区域

Area ID
    A 32-bit number identifying the area. The Area ID of 0.0.0.0 is
    reserved for the backbone.

区域地址范围
为了在区域边界上聚合路由信息,可以使用区域地址范围。每个地址范围都由[地址、掩码]对和“播发”或“不广告”状态指示指定(请参见第 12.4.3 节)。

List of area address ranges
    In order to aggregate routing information at area boundaries,
    area address ranges can be employed. Each address range is
    specified by an [address,mask] pair and a status indication of
    either Advertise or DoNotAdvertise (see Section 12.4.3).

--------------------------------------------------------------------[Page 49]
在这里插入图片描述
协商路由接口
此路由器的接口连接到该区域。路由器接口属于一个且只有一个区域(或骨干区域)。对于骨干区域,此列表包括所有虚拟链路。虚拟链路由其其他端节点的路由器ID标识;其开销是两个路由器之间存在的通过传输区域的最短区域内路径的开销。

Associated router interfaces
    This router's interfaces connecting to the area.  A router
    interface belongs to one and only one area (or the backbone).
    For the backbone area this list includes all the virtual links.
    A virtual link is identified by the Router ID of its other
    endpoint; its cost is the cost of the shortest intra-area path
    through the Transit area that exists between the two routers.

--------------------------------------------------------------------[Page 50]

router-LSAs列表
区域内每个路由器都会产生router-LSAs。其描述了到区域路由器接口的状态

network-LSAs列表
区域内每个transit 广播和NBMA网络都会产生network-LSAs。一个network-LSAs描述了连接到网络的一系列路由器

summary-LSAs列表
summary-LSAs由区域边界路由器产生。他们描述了到自治系统内部网络的路由,当然是外部区域(区域间目的)

最短路径树
区域的最短路径树以其自身为根。通过Dijkstra算法计算router-LSAs和network-LSAs而来。(可见16.1节)

传输能力
这个参数表明区域是否可以承载既不源自也不终止于该区域本身的数据流量。此参数在构建区域的最短路径树时计算(请参见第16.1节,其中TransitCapability设置为TRUE,当且仅当有一个或多个完全相邻的虚链路使用该区域作为传输区域时设置),并用作路由表构建过程的后续步骤的输入(请参见第 16.3 节)。当某个区域的“运输能力”设置为TRUE时,该区域称为“运输区域”。

外部路由能力
AS外部LSA是否会泛洪进整个区域。这是一个可配置的参数。如果从该区域中排除AS-external-LSAs,则该区域称为“末节”。在末节区域中,到 AS 外部目标的路由将仅基于默认汇总路由。骨干区域不能配置为末节区域。此外,虚拟链路不能通过末节区域进行配置。有关详细信息,请参见第 3.6 节。

List of router-LSAs
    A router-LSA is generated by each router in the area.  It
    describes the state of the router's interfaces to the area.

List of network-LSAs
    One network-LSA is generated for each transit broadcast and NBMA
    network in the area.  A network-LSA describes the set of routers
    currently connected to the network.

List of summary-LSAs
    Summary-LSAs originate from the area's area border routers.
    They describe routes to destinations internal to the Autonomous
    System, yet external to the area (i.e., inter-area
    destinations).

Shortest-path tree
    The shortest-path tree for the area, with this router itself as
    root.  Derived from the collected router-LSAs and network-LSAs
    by the Dijkstra algorithm (see Section 16.1).

TransitCapability
    This parameter indicates whether the area can carry data traffic
    that neither originates nor terminates in the area itself. This
    parameter is calculated when the area's shortest-path tree is
    built (see Section 16.1, where TransitCapability is set to TRUE
    if and only if there are one or more fully adjacent virtual
    links using the area as Transit area), and is used as an input
    to a subsequent step of the routing table build process (see
    Section 16.3). When an area's TransitCapability is set to TRUE,
    the area is said to be a "transit area".

ExternalRoutingCapability
    Whether AS-external-LSAs will be flooded into/throughout the
    area.  This is a configurable parameter.  If AS-external-LSAs
    are excluded from the area, the area is called a "stub". Within
    stub areas, routing to AS external destinations will be based
    solely on a default summary route.  The backbone cannot be
    configured as a stub area.  Also, virtual links cannot be
    configured through stub areas.  For more information, see
    Section 3.6.

--------------------------------------------------------------------[Page 51]

末节默认开销
如果区域已配置为末节区域,并且路由器本身是区域边界路由器,则StubDefaultCost表明了路由器应通告到该区域的默认summary-LSA的开销。有关更多信息,请参见第 12.4.3 节。

StubDefaultCost
    If the area has been configured as a stub area, and the router
    itself is an area border router, then the StubDefaultCost
    indicates the cost of the default summary-LSA that the router
    should advertise into the area. See Section 12.4.3 for more
    information.

除非其他特殊要求,本文档剩余章节只涉及单个区域的OSPF协议

Unless otherwise specified, the remaining sections of this document
refer to the operation of the OSPF protocol within a single area.

7.建立邻接up

OSPF在相邻路由器之间创建邻接,以便交换路由信息。并非每两个相邻的路由器都会成为相邻路由器。 本节介绍创建邻接所涉及的一般情况。有关更多详细信息,请参阅第 10 节。

OSPF creates adjacencies between neighboring routers for the purpose
of exchanging routing information.  Not every two neighboring
routers will become adjacent. This section covers the generalities
involved in creating adjacencies.  For further details consult
Section 10.

7.1.Hello协议

Hello 协议负责建立和维护邻居关系。它还确保邻居之间的通信是双向的。Hello 数据包定期从所有路由器接口发送。当路由器看到自己列在邻居的Hello数据包中时,将指示双向通信。在广播和NBMA网络上,Hello协议为网络选择DR路由器。

    The Hello Protocol is responsible for establishing and
    maintaining neighbor relationships.  It also ensures that
    communication between neighbors is bidirectional.  Hello packets
    are sent periodically out all router interfaces.  Bidirectional
    communication is indicated when the router sees itself listed in
    the neighbor's Hello Packet.  On broadcast and NBMA networks,
    the Hello Protocol elects a Designated Router for the network.

Hello协议在广播网络、NBMA网络和点对多点网络上的工作方式不同。在广播网络上,每个路由器通过定期多播Hello数据包来通告自己。这允许邻居进行动态发现。这些Hello数据包包含路由器对指定路由器标识的视图,以及最近看到其Hello数据包的路由器列表。

    The Hello Protocol works differently on broadcast networks, NBMA
    networks and Point-to-MultiPoint networks.  On broadcast
    networks, each router advertises itself by periodically
    multicasting Hello Packets.  This allows neighbors to be
    discovered dynamically.  These Hello Packets contain the
    router's view of the Designated Router's identity, and the list
    of routers whose Hello Packets have been seen recently.

在NBMA网络上,某些配置信息对于Hello协议的操作可能是必需的。每个可能成为DR指定路由器的路由器都有一个连接到网络的所有其他路由器的列表。具有DR指定路由器潜力的路由器在其与NBMA网络的接口首次正常运行时,会将Hello数据包发送到所有其他潜在的DR指定路由器。这是为网络查找指定路由器的尝试。如果路由器本身被选为“指定路由器”,它将开始向连接到网络的所有其他路由器发送 Hello 数据包。

    On NBMA networks some configuration information may be necessary
    for the operation of the Hello Protocol.  Each router that may
    potentially become Designated Router has a list of all other
    routers attached to the network.  A router, having Designated
    Router potential, sends Hello Packets to all other potential
    Designated Routers when its interface to the NBMA network first
    becomes operational.  This is an attempt to find the Designated
    Router for the network.  If the router itself is elected
    Designated Router, it begins sending Hello Packets to all other
    routers attached to the network.

在点到多点网络上,一个路由器发送Hello包给所有可以直接交流的邻居。这些邻居可以通过反ARP或配置进行动态发现。

    On Point-to-MultiPoint networks, a router sends Hello Packets to
    all neighbors with which it can communicate directly. These
    neighbors may be discovered dynamically through a protocol such
    as Inverse ARP (see [Ref14]), or they may be configured.

在邻居被发现后,确保双向通信,并且(如果在广播或NBMA网络上)选择了DR指定路由器,则决定是否应与邻居形成邻接(参见第10.4节)。如果要形成邻接,则第一步是同步邻居的链路状态数据库。这将在下一节中介绍。

    After a neighbor has been discovered, bidirectional
    communication ensured, and (if on a broadcast or NBMA network) a
    Designated Router elected, a decision is made regarding whether
    or not an adjacency should be formed with the neighbor (see
    Section 10.4). If an adjacency is to be formed, the first step
    is to synchronize the neighbors' link-state databases.  This is
    covered in the next section.

7.2.数据库的同步

在链路状态路由算法中,所有路由器的链路状态数据库保持同步是非常重要的。OSPF通过只要求邻接路由器保持同步来简化这一过程。一旦路由器试图建立邻接关系,同步过程就开始了。每个路由器通过向其邻居发送一系列DBD包来描述其数据库。每个DBD包描述一系列属于路由器数据库的LSA。当邻居看到一个LSA比它自己的数据库副本更新时,它会注意到应该请求这个更新的LSA。

    In a link-state routing algorithm, it is very important for all
    routers' link-state databases to stay synchronized.  OSPF
    simplifies this by requiring only adjacent routers to remain
    synchronized.  The synchronization process begins as soon as the
    routers attempt to bring up the adjacency.  Each router
    describes its database by sending a sequence of Database
    Description packets to its neighbor.  Each Database Description
    Packet describes a set of LSAs belonging to the router's
    database.  When the neighbor sees an LSA that is more recent
    than its own database copy, it makes a note that this newer LSA
    should be requested

发送和接收DBD包称为“数据库交换过程”。在此过程中,两个路由器形成主/从关系。每个DBD包都有一个序列号。主设备发送的DBD包(轮询)由从设备通过回显序列号来确认。两次轮询及其响应都包含链路状态数据的摘要。主设备是唯一允许重传DBD。它只以固定的间隔执行此操作,其长度为配置的每个接口常数RxmtInterval。

    This sending and receiving of Database Description packets is
    called the "Database Exchange Process".  During this process,
    the two routers form a master/slave relationship.  Each Database
    Description Packet has a sequence number.  Database Description
    Packets sent by the master (polls) are acknowledged by the slave
    through echoing of the sequence number.  Both polls and their
    responses contain summaries of link state data.  The master is
    the only one allowed to retransmit Database Description Packets.
    It does so only at fixed intervals, the length of which is the
    configured per-interface constant RxmtInterval.

每个DBD都包含一个指示,指示后面有更多的数据包——M位。当路由器接收并发送M位关闭的DBD包时,数据库交换过程结束。

    Each Database Description contains an indication that there are
    more packets to follow --- the M-bit.  The Database Exchange
    Process is over when a router has received and sent Database
    Description Packets with the M-bit off.

在数据库交换过程期间和之后,每个路由器都有一个LSA列表,其中邻居拥有最新实例。这些LSA在LSR中被请求。不满足的LSR以固定的时间间隔RxmtInterval重新发送。当数据库描述过程完成且所有链路状态请求都已满足时,数据库被视为已同步,路由器被标记为完全相邻。此时,邻接功能完全可用,并在两个路由器的路由器LSA中进行通告。

    During and after the Database Exchange Process, each router has
    a list of those LSAs for which the neighbor has more up-to-date
    instances.  These LSAs are requested in Link State Request
    Packets.  Link State Request packets that are not satisfied are
    retransmitted at fixed intervals of time RxmtInterval.  When the
    Database Description Process has completed and all Link State
    Requests have been satisfied, the databases are deemed
    synchronized and the routers are marked fully adjacent.  At this
    time the adjacency is fully functional and is advertised in the
    two routers' router-LSAs.

数据库交换过程一开始,洪泛过程就使用邻接。这简化了数据库同步,并确保它在可预测的时间段内完成。

    The adjacency is used by the flooding procedure as soon as the
    Database Exchange Process begins.  This simplifies database
    synchronization, and guarantees that it finishes in a
    predictable period of time.

7.3.指定路由器

每个广播和NBMA网络都有一个指定路由器。指定路由器为路由协议执行两个主要功能:
@指定路由器代表网络发起network-LSA。此LSA列出了当前连接到网络的一组路由器(包括指定路由器本身)。此LSA的链路状态ID(见第12.1.4节)是指定路由器的IP接口地址。然后,可以通过使用网络的子网/网络掩码获得IP网络号。

    Every broadcast and NBMA network has a Designated Router.  The
    Designated Router performs two main functions for the routing
    protocol:

    o   The Designated Router originates a network-LSA on behalf of
        the network.  This LSA lists the set of routers (including
        the Designated Router itself) currently attached to the
        network.  The Link State ID for this LSA (see Section
        12.1.4) is the IP interface address of the Designated
        Router.  The IP network number can then be obtained by using
        the network's subnet/network mask.

--------------------------------------------------------------------[Page 54]

@指定路由器与网络上的所有其他路由器相邻。由于链路状态数据库是跨邻接同步的(通过邻接启动,然后是洪泛过程),因此指定路由器在同步过程中起着核心作用。

    o   The Designated Router becomes adjacent to all other routers
        on the network.  Since the link state databases are
        synchronized across adjacencies (through adjacency bring-up
        and then the flooding procedure), the Designated Router
        plays a central part in the synchronization process.

指定路由器由Hello协议选举。路由器的Hello包包含其路由器优先级,可根据每个接口进行配置。一般来说,当路由器与网络的接口首次开始工作时,它会检查网络当前是否有指定路由器。如果存在,它接受指定路由器,而不管其路由器优先级如何。(这使得预测指定路由器的身份更加困难,但可确保指定路由器的更改频率更低。见下文。)。否则,如果路由器在网络上具有最高的路由器优先级,则路由器本身将成为指定路由器。第9.4节给出了指定路由器选择的更详细(和更准确)描述。

    The Designated Router is elected by the Hello Protocol.  A
    router's Hello Packet contains its Router Priority, which is
    configurable on a per-interface basis.  In general, when a
    router's interface to a network first becomes functional, it
    checks to see whether there is currently a Designated Router for
    the network.  If there is, it accepts that Designated Router,
    regardless of its Router Priority.  (This makes it harder to
    predict the identity of the Designated Router, but ensures that
    the Designated Router changes less often.  See below.)
    Otherwise, the router itself becomes Designated Router if it has
    the highest Router Priority on the network.  A more detailed
    (and more accurate) description of Designated Router election is
    presented in Section 9.4.

指定路由器是许多相邻的端点。为了优化广播网络上的洪泛过程,指定路由器将其链路状态更新数据包多播到地址AllSPFRouters,而不是在每个相邻节点上发送单独的数据包。

    The Designated Router is the endpoint of many adjacencies.  In
    order to optimize the flooding procedure on broadcast networks,
    the Designated Router multicasts its Link State Update Packets
    to the address AllSPFRouters, rather than sending separate
    packets over each adjacency.

本文件第2节讨论了区域的有向图表示。路由器节点用其路由器ID进行标记。传输网络节点实际上用其指定路由器的IP地址进行标记。因此,当指定路由器更改时,图形上的网络节点似乎被一个全新的节点取代。这将导致网络及其所有连接的路由器发起新的LSA。在链路状态数据库再次收敛之前,可能会导致一些暂时的连接丢失。这可能导致发送ICMP不可达访问的消息以响应数据流量。因此,指定路由器应仅偶尔更改。应配置路由器优先级,以便网络上最可靠的路由器最终成为指定路由器。

    Section 2 of this document discusses the directed graph
    representation of an area.  Router nodes are labelled with their
    Router ID.  Transit network nodes are actually labelled with the
    IP address of their Designated Router.  It follows that when the
    Designated Router changes, it appears as if the network node on
    the graph is replaced by an entirely new node.  This will cause
    the network and all its attached routers to originate new LSAs.
    Until the link-state databases again converge, some temporary
    loss of connectivity may result.  This may result in ICMP
    unreachable messages being sent in response to data traffic.
    For that reason, the Designated Router should change only
    infrequently.  Router Priorities should be configured so that
    the most dependable router on a network eventually becomes
    Designated Router.

7.4.备份指定路由器

为了更顺利地过渡到新的指定路由器,每个广播和NBMA网络都有一个备用指定路由器。备份指定路由器也与网络上的所有路由器邻接,并且在前一个指定路由器出现故障时成为指定路由器。如果没有备用指定路由器,当需要新的指定路由器时,必须在新指定路由器和连接到网络的所有其他路由器之间形成新的邻接。邻接形成过程的一部分是LSDB的同步,这可能需要相当长的时间。在此期间,网络将无法用于传输数据流量。指定的备份消除了形成这些邻接的需要,因为它们已经存在。这意味着,只要新的LSA(宣布新的指定路由器)泛洪,传输流量中断的时间就会持续。

    In order to make the transition to a new Designated Router
    smoother, there is a Backup Designated Router for each broadcast
    and NBMA network.  The Backup Designated Router is also adjacent
    to all routers on the network, and becomes Designated Router
    when the previous Designated Router fails.  If there were no
    Backup Designated Router, when a new Designated Router became
    necessary, new adjacencies would have to be formed between the
    new Designated Router and all other routers attached to the
    network.  Part of the adjacency forming process is the
    synchronizing of link-state databases, which can potentially
    take quite a long time.  During this time, the network would not
    be available for transit data traffic.  The Backup Designated
    obviates the need to form these adjacencies, since they already
    exist.  This means the period of disruption in transit traffic
    lasts only as long as it takes to flood the new LSAs (which
    announce the new Designated Router).

备份指定路由器不会为网络生成network-LSA。(如果生成的话,过渡到新的指定路由器的速度会更快。但是,当指定路由器消失时,存在数据库大小和收敛速度之间的权衡。)

    The Backup Designated Router does not generate a network-LSA for
    the network.  (If it did, the transition to a new Designated
    Router would be even faster.  However, this is a tradeoff
    between database size and speed of convergence when the
    Designated Router disappears.)

备份指定路由器也由Hello协议选择。每个Hello Packet都有一个字段,用于指定网络的备份指定路由器。

    The Backup Designated Router is also elected by the Hello
    Protocol.  Each Hello Packet has a field that specifies the
    Backup Designated Router for the network.

在泛洪过程的某些步骤中,备份指定路由器扮演被动角色,让指定路由器完成更多工作。这减少了本地路由流量。详见第13.3节。

    In some steps of the flooding procedure, the Backup Designated
    Router plays a passive role, letting the Designated Router do
    more of the work.  This cuts down on the amount of local routing
    traffic.  See Section 13.3 for more information.

7.5.邻接图

邻接被绑定到两个路由器共同拥有的网络。如果两个路由器有多个共同的网络,它们之间可能有多个邻接。

    An adjacency is bound to the network that the two routers have
    in common.  If two routers have multiple networks in common,
    they may have multiple adjacencies between them.

--------------------------------------------------------------------[Page 56]

人们可以把网络上的邻接集合想象成一个无向图。顶点由路由器组成,并且如果两个路由器相邻,则有一条线连接两个路由器。邻接图描述了路由协议包的流向,尤其是通过自治系统的LSU包的流。

    One can picture the collection of adjacencies on a network as
    forming an undirected graph.  The vertices consist of routers,
    with an edge joining two routers if they are adjacent.  The
    graph of adjacencies describes the flow of routing protocol
    packets, and in particular Link State Update Packets, through
    the Autonomous System.

根据是否为网络选择了指定路由器,可以使用两个图表。在物理点对点网络、点对多点网络和虚链路上,只要可以直接通信,相邻路由器就可形成邻接。相反,在广播和NBMA网络上,只有指定路由器和备份指定路由器与连接到网络的所有其他路由器形成邻接。

    Two graphs are possible, depending on whether a Designated
    Router is elected for the network.  On physical point-to-point
    networks, Point-to-MultiPoint networks and virtual links,
    neighboring routers become adjacent whenever they can
    communicate directly.  In contrast, on broadcast and NBMA
    networks only the Designated Router and the Backup Designated
    Router become adjacent to all other routers attached to the
    network.

在这里插入图片描述
--------------------------------------------------------------------[Page 57]

这些图如Figure 10所示。假设网络N2中路由器RT7已成为的指定路由器,路由器RT3已成为备用指定路由器。备用指定路由器在洪泛过程中的功能比指定路由器的功能小(见第13.3节)。这就是虚线连接备份指定路由器RT3的原因。

    These graphs are shown in Figure 10.  It is assumed that Router
    RT7 has become the Designated Router, and Router RT3 the Backup
    Designated Router, for the Network N2.  The Backup Designated
    Router performs a lesser function during the flooding procedure
    than the Designated Router (see Section 13.3).  This is the
    reason for the dashed lines connecting the Backup Designated
    Router RT3.

8.协议包处理过程

本节讨论OSPF路由协议包的一般处理过程。路由器LSDB保持同步非常重要。出于这个原因,路由协议包应该在发送和接收过程中比普通数据包获得优先待遇。

路由协议数据包仅在邻接关系间发送(Hello数据包除外,用于发现邻接)。这意味着除了那些通过虚链路发送的数据包之外,所有路由协议数据包都在单跳上传输。

所有路由协议包都以标准报头开头。以下各节提供了如何填写和验证此标准标题的详细信息。然后,对于每种数据包类型,列出了关于该特定数据包类型处理的更多详细信息。

This section discusses the general processing of OSPF routing
protocol packets.  It is very important that the router link-state
databases remain synchronized.  For this reason, routing protocol
packets should get preferential treatment over ordinary data
packets, both in sending and receiving.

Routing protocol packets are sent along adjacencies only (with the
exception of Hello packets, which are used to discover the
adjacencies).  This means that all routing protocol packets travel a
single IP hop, except those sent over virtual links.

All routing protocol packets begin with a standard header.  The
sections below provide details on how to fill in and verify this
standard header.  Then, for each packet type, the section giving
more details on that particular packet type's processing is listed.

8.1.发送协议包

当路由器发送路由协议包时,它将按如下方式填写标准OSPF包头的字段。有关头部格式的更多详细信息,请参阅第A.3.1节:

版本
设为2,本文档所定义

包类型
OSPF包类型,例如LSU或Hello

    When a router sends a routing protocol packet, it fills in the
    fields of the standard OSPF packet header as follows.  For more
    details on the header format consult Section A.3.1:

    Version #
        Set to 2, the version number of the protocol as documented
        in this specification.

    Packet type
        The type of OSPF packet, such as Link state Update or Hello
        Packet.

--------------------------------------------------------------------[Page 58]

包长度
整个OSPF包的字节长度,包括标准OSPF包头部

ROuter ID
路由器自身标识(谁产生了数据包)

区域ID
包被发往的区域

校验和
整个OSPF数据包的标准IP 16位1的补码校验和,不包括64位身份验证字段。该校验和是作为适当认证程序的一部分计算的;对于某些OSPF认证类型,省略校验和计算。详见第D.4节。

认证类型和认证
每个OSPF数据包交换都经过身份验证。认证类型由协议分配,并在附录D中记录。每个IP网络/子网可以使用不同的认证程序。Autype表示正在使用的身份验证过程的类型。然后,64bit认证字段供所选认证过程使用。在形成要发送的数据包时,应最后调用此过程。详见第D.4节。

    Packet length
        The length of the entire OSPF packet in bytes, including the
        standard OSPF packet header.

    Router ID
        The identity of the router itself (who is originating the
        packet).

    Area ID
        The OSPF area that the packet is being sent into.

    Checksum
        The standard IP 16-bit one's complement checksum of the
        entire OSPF packet, excluding the 64-bit authentication
        field.  This checksum is calculated as part of the
        appropriate authentication procedure; for some OSPF
        authentication types, the checksum calculation is omitted.
        See Section D.4 for details.

    AuType and Authentication
        Each OSPF packet exchange is authenticated.  Authentication
        types are assigned by the protocol and are documented in
        Appendix D.  A different authentication procedure can be
        used for each IP network/subnet.  Autype indicates the type
        of authentication procedure in use. The 64-bit
        authentication field is then for use by the chosen
        authentication procedure.  This procedure should be the last
        called when forming the packet to be sent. See Section D.4
        for details.

数据包的IP目的地地址选择如下。在物理点对点网络上,IP目标始终设置为地址AllSPFRouters。在所有其他网络类型(包括虚拟链路)上,大多数OSPF数据包作为单播发送,即直接发送到相邻的另一端。在这种情况下,IP目的地只是与邻接的另一端关联的邻居IP地址(参见第10节)。唯一未作为单播发送的数据包是在广播网络上;在这些网络上,Hello包被发送到组播目的地AllSPFRouters,指定路由器及其备份向多播地址AllSPFRrouters发送LSU和LSAck,而所有其他路由器将其LSU和LSAck都发送到组播地址AllDRouters。

    The IP destination address for the packet is selected as
    follows.  On physical point-to-point networks, the IP
    destination is always set to the address AllSPFRouters.  On all
    other network types (including virtual links), the majority of
    OSPF packets are sent as unicasts, i.e., sent directly to the
    other end of the adjacency.  In this case, the IP destination is
    just the Neighbor IP address associated with the other end of
    the adjacency (see Section 10).  The only packets not sent as
    unicasts are on broadcast networks; on these networks Hello
    packets are sent to the multicast destination AllSPFRouters, the
    Designated Router and its Backup send both Link State Update
    Packets and Link State Acknowledgment Packets to the multicast
    address AllSPFRouters, while all other routers send both their
    Link State Update and Link State Acknowledgment Packets to the
    multicast address AllDRouters.

链路状态更新数据包的重新传输总是直接发送到邻居。在多址网络上,这意味着重传应该发送到邻居的IP地址。

    Retransmissions of Link State Update packets are ALWAYS sent
    directly to the neighbor. On multi-access networks, this means
    that retransmissions should be sent to the neighbor's IP
    address.

IP源地址应设置为发送接口的IP地址。到未编号的点对点网络的接口与其IP地址无关。在这些接口上,IP源应设置为属于路由器的任何其他IP地址。因此,必须至少有一个IP地址分配给路由器。[2]请注意,在大多数情况下,虚链路的作用与未编号的点对点网络完全相同。但是,每个虚链路都有一个IP接口地址(在路由表构建过程中发现),当通过虚拟链路发送数据包时,该地址用作IP源。

更多关于OSPF包类型的格式信息,请参阅Table 10中列出的章节。

    The IP source address should be set to the IP address of the
    sending interface.  Interfaces to unnumbered point-to-point
    networks have no associated IP address.  On these interfaces,
    the IP source should be set to any of the other IP addresses
    belonging to the router.  For this reason, there must be at
    least one IP address assigned to the router.[2] Note that, for
    most purposes, virtual links act precisely the same as
    unnumbered point-to-point networks.  However, each virtual link
    does have an IP interface address (discovered during the routing
    table build process) which is used as the IP source when sending
    packets over the virtual link.

    For more information on the format of specific OSPF packet
    types, consult the sections listed in Table 10.

         Type   Packet name            detailed section (transmit)
         _________________________________________________________
         1      Hello                  Section  9.5
         2      Database description   Section 10.8
         3      Link state request     Section 10.9
         4      Link state update      Section 13.3
         5      Link state ack         Section 13.5


  Table 10: Sections describing OSPF protocol packet transmission.

--------------------------------------------------------------------[Page 58]

8.2.收到协议包

每当路由器接收到协议数据包时,它都会标记上接收到的接口。对于配置了虚链路的路由器,将数据包与哪个接口关联可能不立刻展现。例如,以Figure 6所示的路由器RT11为例。如果RT11在其连到网络N8的接口上接收到OSPF协议包,它可能希望将该包与到区域2的接口或到路由器RT10的虚拟链路(这是骨干区域的一部分)联系起来。在下面,我们假设数据包最初与非虚拟链路相关联。[3]

    Whenever a protocol packet is received by the router it is
    marked with the interface it was received on.  For routers that
    have virtual links configured, it may not be immediately obvious
    which interface to associate the packet with.  For example,
    consider the Router RT11 depicted in Figure 6.  If RT11 receives
    an OSPF protocol packet on its interface to Network N8, it may
    want to associate the packet with the interface to Area 2, or
    with the virtual link to Router RT10 (which is part of the
    backbone).  In the following, we assume that the packet is
    initially associated with the non-virtual  link.[3]

为了在IP层接受数据包,它必须通过一些测试,这一过程甚至在数据包被传递给OSPF进行处理之前开始:
@IP校验和必须正确
@包的目的IP必须是收到接口的IP或者AllSPFRouters和AllDRouters组播地址之一。
@IP协议号必须是89
@本地发起的数据包不应传递到OSPF。也就是说,应检查源IP地址,以确保这不是路由器本身生成的组播数据包。

    In order for the packet to be accepted at the IP level, it must
    pass a number of tests, even before the packet is passed to OSPF
    for processing:

    o   The IP checksum must be correct.

    o   The packet's IP destination address must be the IP address
        of the receiving interface, or one of the IP multicast
        addresses AllSPFRouters or AllDRouters.

    o   The IP protocol specified must be OSPF (89).

    o   Locally originated packets should not be passed on to OSPF.
        That is, the source IP address should be examined to make
        sure this is not a multicast packet that the router itself
        generated.

之后,检查OSPF头部。标头中指定的字段必须与为接收接口配置的字段匹配。如果没有,则应丢弃数据包
@版本号必须为协议version2
@OSPF头部的areaID必须被检查。如果如下两部分都是被了,包将会被丢弃。头部的areaID必须为
1、匹配接收接口的区域ID。在这种情况下,数据包是通过单跳发送的。因此,要求数据包的源IP与接收接口位于同一网络上。这可以通过在用接口掩码匹配两个地址之后,将数据包的源IP与接口的IP地址进行比较来验证。不应在点对点网络上执行此比较。在点对点网络上,链路每一端的接口地址都是独立分配的,如果它们被分配的话。
2、标识骨干区域。在这种情况下,数据包是通过虚拟链路发送的。接收路由器必须是区域边界路由器,数据包中指定的路由器ID(源路由器)必须是配置的另一端虚链路。接收接口还必须连接到虚链路的配置传输区域。如果所有这些检查都成功,则数据包将被接受,并开始与虚链路(和骨干区域)相关联。
@目的地址为AllDRouters的IP包之应当接受接口为DR或BDR的包
@认证类型必须与所配置的区域相匹配
@数据包必须经过身份验证。认证过程由AuType的设置指示(见附录D)。认证过程可以使用一个或多个认证密钥,这些密钥可以基于每个接口进行配置。认证过程还可以验证OSPF分组报头中的校验和字段(当使用时,在排除64位认证字段之后,将其设置为OSPF包内容的标准IP 16位1的补码校验和)。如果身份验证过程失败,则应丢弃数据包。

    Next, the OSPF packet header is verified.  The fields specified
    in the header must match those configured for the receiving
    interface.  If they do not, the packet should be discarded:

    o   The version number field must specify protocol version 2.

    o   The Area ID found in the OSPF header must be verified.  If
        both of the following cases fail, the packet should be
        discarded.  The Area ID specified in the header must either:

        (1) Match the Area ID of the receiving interface.  In this
            case, the packet has been sent over a single hop.
            Therefore, the packet's IP source address is required to
            be on the same network as the receiving interface.  This
            can be verified by comparing the packet's IP source
            address to the interface's IP address, after masking
            both addresses with the interface mask.  This comparison
            should not be performed on point-to-point networks. On
            point-to-point networks, the interface addresses of each
            end of the link are assigned independently, if they are
            assigned at all.

        (2) Indicate the backbone.  In this case, the packet has
            been sent over a virtual link.  The receiving router
            must be an area border router, and the Router ID
            specified in the packet (the source router) must be the
            other end of a configured virtual link.  The receiving
            interface must also attach to the virtual link's
            configured Transit area.  If all of these checks
            succeed, the packet is accepted and is from now on
            associated with the virtual link (and the backbone
            area).

    o   Packets whose IP destination is AllDRouters should only be
        accepted if the state of the receiving interface is DR or
        Backup (see Section 9.1).

    o   The AuType specified in the packet must match the AuType
        specified for the associated area.

    o   The packet must be authenticated.  The authentication
        procedure is indicated by the setting of AuType (see
        Appendix D).  The authentication procedure may use one or
        more Authentication keys, which can be configured on a per-
        interface basis.  The authentication procedure may also
        verify the checksum field in the OSPF packet header (which,
        when used, is set to the standard IP 16-bit one's complement
        checksum of the OSPF packet's contents after excluding the
        64-bit authentication field).  If the authentication
        procedure fails, the packet should be discarded.

--------------------------------------------------------------------[Page 62]

如果数据包类型为Hello,则应由Hello协议进一步处理(见第10.5节)。所有其他类型包仅在相邻上发送/接收。这意味着数据包必须由路由器的一个活动邻居发送。如果接收接口连接到广播网络、点对多点网络或NBMA网络,则发送方由数据包IP报头中的IP源地址识别。如果接收接口连接到点对点网络或虚拟链路,则发送方由数据包的OSPF报头中的路由器ID(源路由器)标识。与接收接口相关的数据结构包含活动邻居的列表集合。与任何活动邻居不匹配的数据包将被丢弃。

    If the packet type is Hello, it should then be further processed
    by the Hello Protocol (see Section 10.5).  All other packet
    types are sent/received only on adjacencies.  This means that
    the packet must have been sent by one of the router's active
    neighbors.  If the receiving interface connects to a broadcast
    network, Point-to-MultiPoint network or NBMA network the sender
    is identified by the IP source address found in the packet's IP
    header.  If the receiving interface connects to a point-to-point
    network or a virtual link, the sender is identified by the
    Router ID (source router) found in the packet's OSPF header.
    The data structure associated with the receiving interface
    contains the list of active neighbors.  Packets not matching any
    active neighbor are discarded.

此时,所有接收的协议分组都与活动邻居相关联。有关特定数据包类型的进一步输入处理,请参阅Table 11中列出的部分。

    At this point all received protocol packets are associated with
    an active neighbor.  For the further input processing of
    specific packet types, consult the sections listed in Table 11.

          Type   Packet name            detailed section (receive)
          ________________________________________________________
          1      Hello                  Section 10.5
          2      Database description   Section 10.6
          3      Link state request     Section 10.7
          4      Link state update      Section 13
          5      Link state ack         Section 13.7

  Table 11: Sections describing OSPF protocol packet reception.

9.接口数据结构

OSPF接口是路由器和网络之间的连接。我们假设每个连接的网络/子网都有一个OSPF接口,尽管附录F中考虑了在单个网络上支持多个接口。每个接口结构最多有一个IP接口地址。

An OSPF interface is the connection between a router and a network.
We assume a single OSPF interface to each attached network/subnet,
although supporting multiple interfaces on a single network is
considered in Appendix F. Each interface structure has at most one
IP interface address.

--------------------------------------------------------------------[Page 63]

可以认为OSPF接口属于包含所连接网络的区域。路由器在此接口上发起的所有路由协议包都标有接口的区域ID。一个或多个路由器邻接关系可能在接口上延伸。路由器的LSA反映了其接口状态及其相的关邻接信息。

An OSPF interface can be considered to belong to the area that
contains the attached network.  All routing protocol packets
originated by the router over this interface are labelled with the
interface's Area ID.  One or more router adjacencies may develop
over an interface.  A router's LSAs reflect the state of its
interfaces and their associated adjacencies.

以下数据项与接口关联。注意,这些项目中的许多实际上是所连接网络的配置;对于连接到网络的所有路由器,这些项必须相同。
类型
OSPF接口类型为点对点、广播、NBMA、点对多点或虚拟链路。

状态
接口的功能级别。状态确定是否允许在接口上形成完全邻接关系。状态也反映在路由器的LSA中。

IP接口地址
IP接口地址与接口相关。通过此接口发起的所有路由协议数据包中以源IP显示。未编号点对点网络的接口没有关联的IP地址。

IP接口掩码
也称为子网掩码,它表示IP接口地址中标识连接网络的部分。用IP接口掩码匹配IP接口地址会产生所连接网络的IP网络号。在点对点网络和虚拟链路上,未定义IP接口掩码。在这些网络上,链路本身没有分配IP网络号,因此,链路每一侧的地址都是独立分配的(如果分配的话)。

areaID
连接的网络所属区域的区域ID。源于接口的所有路由协议数据包都标有此区域ID。

Hello间隔
路由器在接口上发送的Hello数据包间隔的时间长度(秒)。由此接口发送的Hello数据包通告。

路由器死亡间隔
当路由器的邻居停止听到路由器的Hello包时,路由器的邻居宣布关闭之前的秒数。由此接口发送的Hello数据包通告。

传输时延
通过此接口传输LSU所需的估计秒数。LSU中包含的LSA将在传输之前使其寿命增加该值。该值应考虑传输和传播延迟;它必须大于零。

路由器优先级
8位无符号整数。当连接到网络的两个路由器都试图成为指定路由器时,具有最高路由器优先级的路由器优先。路由器优先级设置为0的路由器没有资格成为依附网络上的指定路由器。由此接口发送的Hello数据包通告。

Hello定时器
接口发送Hello数据包的间隔计时器。此计时器每HelloInterval秒触发一次。注意,在非广播网络上,单独的Hello包被发送到每个正确的邻居。

等待定时器
单触发定时器,使接口退出等待状态,并因此选择网络上的指定路由器。计时器的长度为RouterDeadInterval秒

邻居路由器列表
连接到此网络的其他路由器。此列表由Hello协议形成。其中一些邻居将形成邻接关系。可以通过检查所有邻居的状态来确定邻接邻居的集合。

DR路由器
为连接的网络选择的指定路由器。在所有广播和NBMA网络上,通过Hello协议选择指定路由器。指定路由器有两个标识:其路由器ID和网络上的IP接口地址。指定路由器通告网络的链路状态;该network-LSA被标记为指定路由器的IP地址。指定路由器初始化为0.0.0.0,这表示缺少指定路由器。

备份DR路由器
在所有广播和NBMA网络上,Hello协议也会选择备份指定路由器。连接网络上的所有路由器都与指定路由器和备份指定路由器形成邻接关系。当前指定路由器出现故障时,备份指定路由器变为指定路由器。备份指定路由器初始化为0.0.0.0,表示缺少备份指定路由器。

接口出开销
在接口上发送数据包的成本,用链路状态metric表示。这在router-LSA中被公布为该接口的链路开销。接口的开销必须大于零。

最大重传间隔RxmtInterval
属于此接口的邻接关系的LSA重传之间的秒数。也用于重传DBD和LSR。

认证类型
连接的网络/子网上使用的身份验证类型。认证类型在附录D中定义。所有OSPF数据包交换都经过认证。不同的认证方案可用于不同的网络/子网。

认证密钥
该配置数据允许认证过程生成和/或验证OSPF协议包。可以在每个接口的基础上配置认证密钥。例如,如果AuType指示简单密码,则认证密钥将是插入OSPF数据包头中的64位明文密码。如果Autype表示加密身份验证,则身份验证密钥是一个共享密钥,可以生成/验证附加到OSPF协议包的消息摘要。使用加密身份验证时,支持多个模拟密钥,以实现平滑的密钥转换(见第D.3节)。

The following data items are associated with an interface.  Note
that a number of these items are actually configuration for the
attached network; such items must be the same for all routers
connected to the network.

Type
    The OSPF interface type is either point-to-point, broadcast,
    NBMA, Point-to-MultiPoint or virtual link.

State
    The functional level of an interface.  State determines whether
    or not full adjacencies are allowed to form over the interface.
    State is also reflected in the router's LSAs.

IP interface address
    The IP address associated with the interface.  This appears as
    the IP source address in all routing protocol packets originated
    over this interface.  Interfaces to unnumbered point-to-point
    networks do not have an associated IP address.

IP interface mask
    Also referred to as the subnet mask, this indicates the portion
    of the IP interface address that identifies the attached
    network.  Masking the IP interface address with the IP interface
    mask yields the IP network number of the attached network.  On
    point-to-point networks and virtual links, the IP interface mask
    is not defined. On these networks, the link itself is not
    assigned an IP network number, and so the addresses of each side
    of the link are assigned independently, if they are assigned at
    all.

Area ID
    The Area ID of the area to which the attached network belongs.
    All routing protocol packets originating from the interface are
    labelled with this Area ID.

HelloInterval
    The length of time, in seconds, between the Hello packets that
    the router sends on the interface.  Advertised in Hello packets
    sent out this interface.

RouterDeadInterval
    The number of seconds before the router's neighbors will declare
    it down, when they stop hearing the router's Hello Packets.
    Advertised in Hello packets sent out this interface.

InfTransDelay
    The estimated number of seconds it takes to transmit a Link
    State Update Packet over this interface.  LSAs contained in the
    Link State Update packet will have their age incremented by this
    amount before transmission.  This value should take into account
    transmission and propagation delays; it must be greater than
    zero.

Router Priority
    An 8-bit unsigned integer.  When two routers attached to a
    network both attempt to become Designated Router, the one with
    the highest Router Priority takes precedence.  A router whose
    Router Priority is set to 0 is ineligible to become Designated
    Router on the attached network.  Advertised in Hello packets
    sent out this interface.

Hello Timer
    An interval timer that causes the interface to send a Hello
    packet.  This timer fires every HelloInterval seconds.  Note
    that on non-broadcast networks a separate Hello packet is sent
    to each qualified neighbor.

Wait Timer
    A single shot timer that causes the interface to exit the
    Waiting state, and as a consequence select a Designated Router
    on the network.  The length of the timer is RouterDeadInterval
    seconds.

List of neighboring routers
    The other routers attached to this network.  This list is formed
    by the Hello Protocol.  Adjacencies will be formed to some of
    these neighbors.  The set of adjacent neighbors can be
    determined by an examination of all of the neighbors' states.

Designated Router
    The Designated Router selected for the attached network.  The
    Designated Router is selected on all broadcast and NBMA networks
    by the Hello Protocol.  Two pieces of identification are kept
    for the Designated Router: its Router ID and its IP interface
    address on the network.  The Designated Router advertises link
    state for the network; this network-LSA is labelled with the
    Designated Router's IP address.  The Designated Router is
    initialized to 0.0.0.0, which indicates the lack of a Designated
    Router.

Backup Designated Router
    The Backup Designated Router is also selected on all broadcast
    and NBMA networks by the Hello Protocol.  All routers on the
    attached network become adjacent to both the Designated Router
    and the Backup Designated Router.  The Backup Designated Router
    becomes Designated Router when the current Designated Router
    fails.  The Backup Designated Router is initialized to 0.0.0.0,
    indicating the lack of a Backup Designated Router.

Interface output cost(s)
    The cost of sending a data packet on the interface, expressed in
    the link state metric.  This is advertised as the link cost for
    this interface in the router-LSA. The cost of an interface must
    be greater than zero.

RxmtInterval
    The number of seconds between LSA retransmissions, for
    adjacencies belonging to this interface.  Also used when
    retransmitting Database Description and Link State Request
    Packets.

AuType
    The type of authentication used on the attached network/subnet.
    Authentication types are defined in Appendix D.  All OSPF packet
    exchanges are authenticated.  Different authentication schemes
    may be used on different networks/subnets.

Authentication key
    This configured data allows the authentication procedure to
    generate and/or verify OSPF protocol packets.  The
    Authentication key can be configured on a per-interface basis.
    For example, if the AuType indicates simple password, the
    Authentication key would be a 64-bit clear password which is
    inserted into the OSPF packet header. If instead Autype
    indicates Cryptographic authentication, then the Authentication
    key is a shared secret which enables the generation/verification
    of message digests which are appended to the OSPF protocol
    packets. When Cryptographic authentication is used, multiple
    simultaneous keys are supported in order to achieve smooth key
    transition (see Section D.3).

9.1.接口状态

在本节中记录了路由器接口可能达到的各种状态。这些状态按功能的进展顺序列出。例如,首先列出不工作状态,然后是在实现最终的完全功能状态之前的中间状态列表。规范通过有时引用诸如“那些状态大于X的接口”来利用这种排序。Figure 11显示了界面状态变化的图表。图中的弧线被标记为导致状态变化的事件。这些事件被记录在了第9.2节。第9.3节更详细地描述了接口状态机。

    The various states that router interfaces may attain is
    documented in this section.  The states are listed in order of
    progressing functionality.  For example, the inoperative state
    is listed first, followed by a list of intermediate states
    before the final, fully functional state is achieved.  The
    specification makes use of this ordering by sometimes making
    references such as "those interfaces in state greater than X".
    Figure 11 shows the graph of interface state changes.  The arcs
    of the graph are labelled with the event causing the state
    change.  These events are documented in Section 9.2.  The
    interface state machine is described in more detail in Section
    9.3.

Down
初始接口状态。在这种状态下,较低级别的协议表示接口不可用。在这样的接口上根本不会发送或接收任何协议流量。在此状态下,接口参数应设置为其初始值。应禁用所有接口计时器,并且不应存在与接口关联的相邻项。

Loopback
在这种状态下,路由器与网络的接口是环回的。接口可以在硬件或软件中回送。该接口将无法用于常规数据通信。然而,通过向接口发送ICMP ping或通过诸如位错误测试之类的方法,获取有关该接口质量的信息仍然是可取的。因此,IP数据包仍可能寻址到处于环回状态的接口。为了促进这一点,这些接口在路由器LSA中作为单主机路由进行公告,其目的地是IP接口地址

等待
在此状态下,路由器正在尝试确定网络的(备份)指定路由器的身份。为此,路由器监视它收到的Hello Packets。不允许路由器选择备份指定路由器或指定路由器,直到它脱离等待状态。这可防止对(备份)指定路由器进行不必要的更改

点到点
在这种状态下,接口是可操作的,并可连接到物理点对点网络或虚拟链路。进入此状态后,路由器尝试与相邻路由器形成邻接。Hello数据包每隔HelloInterval秒发送一次给邻居

DR other
该接口连接到广播或NBMA网络,在该网络上已有其他路由器被选择为指定路由器。在此状态下,路由器本身也未选择备份指定路由器。路由器与指定路由器和备份指定路由器(如果存在)都相邻

Backup
在此状态下,路由器自身是连接网络上的备份指定路由器。当当前指定路由器出现故障时,它将升级为指定路由器。此状态路由器与连接到网络的所有其他路由器建立邻接。与指定路由器相比,备份指定路由器在泛洪过程中执行的功能略有不同(见第13.3节)。有关备份指定路由器执行的功能的更多详细信息,请参阅第7.4节。

DR
在此状态下,路由器自身是连接网络上的指定路由器。与连接到网络的所有其他路由器建立邻接。路由器还必须为网络节点发起network-LSA。network-LSA将包含连接到网络的所有路由器(包括指定路由器本身)的链接。有关指定路由器执行的功能的更多详细信息,请参阅第7.3节。

在这里插入图片描述

             In addition to the state transitions pictured,
             Event InterfaceDown always forces Down State, and
             Event LoopInd always forces Loopback State

    Down
        This is the initial interface state.  In this state, the
        lower-level protocols have indicated that the interface is
        unusable.  No protocol traffic at all will be sent or
        received on such a interface.  In this state, interface
        parameters should be set to their initial values.  All
        interface timers should be disabled, and there should be no
        adjacencies associated with the interface.

    Loopback
        In this state, the router's interface to the network is
        looped back.  The interface may be looped back in hardware
        or software.  The interface will be unavailable for regular
        data traffic.  However, it may still be desirable to gain
        information on the quality of this interface, either through
        sending ICMP pings to the interface or through something
        like a bit error test.  For this reason, IP packets may
        still be addressed to an interface in Loopback state.  To
        facilitate this, such interfaces are advertised in router-
        LSAs as single host routes, whose destination is the IP
        interface address.[4]

    Waiting
        In this state, the router is trying to determine the
        identity of the (Backup) Designated Router for the network.
        To do this, the router monitors the Hello Packets it
        receives.  The router is not allowed to elect a Backup
        Designated Router nor a Designated Router until it
        transitions out of Waiting state.  This prevents unnecessary
        changes of (Backup) Designated Router.

    Point-to-point
        In this state, the interface is operational, and connects
        either to a physical point-to-point network or to a virtual
        link.  Upon entering this state, the router attempts to form
        an adjacency with the neighboring router.  Hello Packets are
        sent to the neighbor every HelloInterval seconds.

    DR Other
        The interface is to a broadcast or NBMA network on which
        another router has been selected to be the Designated
        Router.  In this state, the router itself has not been
        selected Backup Designated Router either.  The router forms
        adjacencies to both the Designated Router and the Backup
        Designated Router (if they exist).

    Backup
        In this state, the router itself is the Backup Designated
        Router on the attached network.  It will be promoted to
        Designated Router when the present Designated Router fails.
        The router establishes adjacencies to all other routers
        attached to the network.  The Backup Designated Router
        performs slightly different functions during the Flooding
        Procedure, as compared to the Designated Router (see Section
        13.3).  See Section 7.4 for more details on the functions
        performed by the Backup Designated Router.

    DR  In this state, this router itself is the Designated Router
        on the attached network.  Adjacencies are established to all
        other routers attached to the network.  The router must also
        originate a network-LSA for the network node.  The network-
        LSA will contain links to all routers (including the
        Designated Router itself) attached to the network.  See
        Section 7.3 for more details on the functions performed by
        the Designated Router.

9.2.造成接口状态改变的事件

状态变化可由多个事件影响。这些事件如Figure 11中的弧线标记所示。标记定义如下所示。有关这些事件对OSPF协议操作的影响的详细说明,请参阅第9.3节。

    State changes can be effected by a number of events.  These
    events are pictured as the labelled arcs in Figure 11.  The
    label definitions are listed below.  For a detailed explanation
    of the effect of these events on OSPF protocol operation,
    consult Section 9.3.

接口up
较低级别的协议已指示网络接口是可操作的。这使接口能够从Down状态转换出来。在虚链路上,接口操作指示实际上是最短路径计算的结果(见第16.7节)。

等待定时器
等待定时器触发时,表示选举(B)DR的等待周期结束

Backup选举完成
路由器检测到网络是否存在备份指定路由器。这是通过两种方式之一实现的。首先,可能会从邻居处收到自称为备份指定路由器的Hello Packet。或者,可以从邻居处接收自称为指定路由器的Hello Packet,并指示没有备份指定路由器。无论哪种情况,都必须与邻居进行双向通信,即路由器也必须出现在邻居的Hello Packet中。此事件表示等待状态结束。

邻居改变
与接口相关联的双向邻居集合发生了变化。需要重新计算(备份)指定路由器。以下邻居更改导致NeighborChange事件。有关邻居状态的解释,请参见第10.1节。
@已与邻居建立双向通信。换句话说,邻居的状态已转换为2-way或更高。
@不再有与neighbor的双向通信。换句话说,邻居的状态已转换为Init或更低
@其中一个双向邻居最近宣布自己为指定路由器或备份指定路由器。这是通过检查邻居的Hello Packets检测到的。
@其中一个双向邻居不再将自己声明为指定路由器,或不再将自己宣布为备份指定路由器。这再次通过检查邻居的Hello Packets检测到。
@双向邻居的通告路由器优先级已更改。这再次通过检查邻居的Hello Packets检测到

LoopInd
已收到一个指示,表示接口现在回送到自身。该指示可以从网络管理或从较低级别协议接收。

UnloopInd
已收到接口不再环回的指示。与LoopId事件一样,此指示可以从网络管理或较低级别协议接收。

接口down
较低级别的协议表示此接口不再起作用。无论当前接口状态是什么,新的接口状态都将是Down。

    InterfaceUp
        Lower-level protocols have indicated that the network
        interface is operational.  This enables the interface to
        transition out of Down state.  On virtual links, the
        interface operational indication is actually a result of the
        shortest path calculation (see Section 16.7).

    WaitTimer
        The Wait Timer has fired, indicating the end of the waiting
        period that is required before electing a (Backup)
        Designated Router.

    BackupSeen
        The router has detected the existence or non-existence of a
        Backup Designated Router for the network.  This is done in
        one of two ways.  First, an Hello Packet may be received
        from a neighbor claiming to be itself the Backup Designated
        Router.  Alternatively, an Hello Packet may be received from
        a neighbor claiming to be itself the Designated Router, and
        indicating that there is no Backup Designated Router.  In
        either case there must be bidirectional communication with
        the neighbor, i.e., the router must also appear in the
        neighbor's Hello Packet.  This event signals an end to the
        Waiting state.

--------------------------------------------------------------------[Page 70]

    NeighborChange
        There has been a change in the set of bidirectional
        neighbors associated with the interface.  The (Backup)
        Designated Router needs to be recalculated.  The following
        neighbor changes lead to the NeighborChange event.  For an
        explanation of neighbor states, see Section 10.1.

        o   Bidirectional communication has been established to a
            neighbor.  In other words, the state of the neighbor has
            transitioned to 2-Way or higher.

        o   There is no longer bidirectional communication with a
            neighbor.  In other words, the state of the neighbor has
            transitioned to Init or lower.

        o   One of the bidirectional neighbors is newly declaring
            itself as either Designated Router or Backup Designated
            Router.  This is detected through examination of that
            neighbor's Hello Packets.

        o   One of the bidirectional neighbors is no longer
            declaring itself as Designated Router, or is no longer
            declaring itself as Backup Designated Router.  This is
            again detected through examination of that neighbor's
            Hello Packets.

        o   The advertised Router Priority for a bidirectional
            neighbor has changed.  This is again detected through
            examination of that neighbor's Hello Packets.

    LoopInd
        An indication has been received that the interface is now
        looped back to itself.  This indication can be received
        either from network management or from the lower level
        protocols.

    UnloopInd
        An indication has been received that the interface is no
        longer looped back.  As with the LoopInd event, this

        indication can be received either from network management or
        from the lower level protocols.

    InterfaceDown
        Lower-level protocols indicate that this interface is no
        longer functional.  No matter what the current interface
        state is, the new interface state will be Down.

9.3.接口状态机

接口状态更改的详细描述如下。每个状态更改都由一个事件调用(第9.2节)。根据接口的当前状态,此事件可能会产生不同的效果。因此,下面的状态机按当前接口状态和接收的事件进行描述。状态机中的每个条目都描述了生成的新接口状态和所需的附加操作集。
当一个接口状态改变是,必须产生新的router-LSA。详细内容请参阅第12.5章节
下面的一些必需操作涉及为邻居状态机生成事件。例如,当一个接口不起作用时,必须销毁与该接口相关联的所有邻居连接。有关邻居状态机的更多信息,请参阅第10.3节。

    A detailed description of the interface state changes follows.
    Each state change is invoked by an event (Section 9.2).  This
    event may produce different effects, depending on the current
    state of the interface.  For this reason, the state machine
    below is organized by current interface state and received
    event.  Each entry in the state machine describes the resulting
    new interface state and the required set of additional actions.

    When an interface's state changes, it may be necessary to
    originate a new router-LSA.  See Section 12.4 for more details.

    Some of the required actions below involve generating events for
    the neighbor state machine.  For example, when an interface
    becomes inoperative, all neighbor connections associated with
    the interface must be destroyed.  For more information on the
    neighbor state machine, see Section 10.3.

状态:Down
事件:接口UP
新状态:取决于操作程序
动作:启动Hello间隔定时器,使能接口周期发送Hello数据包。如果连接的网络是物理点对点网络、点对多点网络或虚链路,则接口状态转换为点对点。否则,如果路由器不符合成为指定路由器的条件,则接口状态将转换为DR Other。
否则,连接的网络是广播或NBMA网络,路由器有资格成为指定路由器。在这种情况下,在试图发现连接网络的指定路由器时,接口状态设置为“等待”,并启动一次等待计时器。此外,如果网络是NBMA网络,检查此接口的邻居配置列表,并为每个有资格成为指定路由器的邻居生成邻居事件Start。

     State(s):  Down
        Event:  InterfaceUp
    New state:  Depends upon action routine
       Action:  Start the interval Hello Timer, enabling the
                periodic sending of Hello packets out the interface.
                If the attached network is a physical point-to-point
                network, Point-to-MultiPoint network or virtual
                link, the interface state transitions to Point-to-
                Point.  Else, if the router is not eligible to
                become Designated Router the interface state
                transitions to DR Other.
                Otherwise, the attached network is a broadcast or
                NBMA network and the router is eligible to become
                Designated Router.  In this case, in an attempt to
                discover the attached network's Designated Router
                the interface state is set to Waiting and the single
                shot Wait Timer is started.  Additionally, if the
                network is an NBMA network examine the configured
                list of neighbors for this interface and generate
                the neighbor event Start for each neighbor that is
                also eligible to become Designated Router.

状态:等待
事件:观察到Backup
新状态:取决于操作程序
动作:如第9.4章节所示,计算所附着网络的BDR和DR。计算完成后,接口状态改变为DR Other,BDR或DR

     State(s):  Waiting
        Event:  BackupSeen
    New state:  Depends upon action routine.
       Action:  Calculate the attached network's Backup Designated
                Router and Designated Router, as shown in Section
                9.4.  As a result of this calculation, the new state
                of the interface will be either DR Other, Backup or
                DR.

状态:等待
事件:等待定时器
新状态:取决于操作程序
动作:如第9.4章节所示,计算所附着网络的BDR和DR。计算完成后,接口状态改变为DR Other,BDR或DR

     State(s):  Waiting
        Event:  WaitTimer
    New state:  Depends upon action routine.
       Action:  Calculate the attached network's Backup Designated
                Router and Designated Router, as shown in Section
                9.4.  As a result of this calculation, the new state
                of the interface will be either DR Other, Backup or
                DR.

状态:DR Other,BDR或DR
事件:邻居改变
新状态:取决于操作程序
动作:如第9.4章节所示,计算所附着网络的BDR和DR。计算完成后,接口状态改变为DR Other,BDR或DR

     State(s):  DR Other, Backup or DR
        Event:  NeighborChange
    New state:  Depends upon action routine.
       Action:  Recalculate the attached network's Backup Designated
                Router and Designated Router, as shown in Section
                9.4.  As a result of this calculation, the new state
                of the interface will be either DR Other, Backup or
                DR.

状态:任何状态
事件:接口down
新状态:down
动作:所有接口变量被重置,接口定时器关闭。此外,与该接口相关联的所有邻居连接都将被销毁。这是通过在所有相关邻居上生成事件KillNbr来完成的(参见第10.2节)。

     State(s):  Any State
        Event:  InterfaceDown
    New state:  Down
       Action:  All interface variables are reset, and interface
                timers disabled.  Also, all neighbor connections
                associated with the interface are destroyed.  This
                is done by generating the event KillNbr on all
                associated neighbors (see Section 10.2).

状态:任何状态
事件:LoopInd
新状态:Loopback
动作:由于此接口不再连接到连接的网络,因此执行与上述InterfaceDown事件相关的操作

     State(s):  Any State
        Event:  LoopInd
    New state:  Loopback
       Action:  Since this interface is no longer connected to the
                attached network the actions associated with the
                above InterfaceDown event are executed.

状态:Loopback
事件:UnloopInd
新状态:Down
动作:无需采取任何行动。例如,在进入环回状态时,接口变量已被重置。请注意,在接口再次完全工作之前,必须接收InterfaceUp事件。

     State(s):  Loopback
        Event:  UnloopInd
    New state:  Down
       Action:  No actions are necessary.  For example, the
                interface variables have already been reset upon
                entering the Loopback state.  Note that reception of
                an InterfaceUp event is necessary before the
                interface again becomes fully functional.

9.4选举DR

本节介绍用于计算网络的指定路由器和备份指定路由器的算法。此算法由接口状态机调用。路由器首次运行网络的选择算法时,网络的指定路由器和备份指定路由器被初始化为0.0.0.0。这表明指定路由器和备用指定路由器都不存在。

    This section describes the algorithm used for calculating a
    network's Designated Router and Backup Designated Router.  This
    algorithm is invoked by the Interface state machine.  The
    initial time a router runs the election algorithm for a network,
    the network's Designated Router and Backup Designated Router are
    initialized to 0.0.0.0.  This indicates the lack of both a
    Designated Router and a Backup Designated Router.

指定路由器选择算法如下进行:调用进行计算的路由器X。检查连接到网络并与路由器X建立双向通信的邻居列表。此列表正是路由器X的邻居(在此网络上)的集合,其状态大于或等于2-way(参见第10.1节)。路由器X本身也被认为在列表中。排查列表中不符合成为指定路由器资格的所有路由器。(路由器优先级为0的路由器没有资格成为指定路由器)。然后执行以下步骤,只考虑列表中保留的路由器:

    The Designated Router election algorithm proceeds as follows:
    Call the router doing the calculation Router X.  The list of
    neighbors attached to the network and having established
    bidirectional communication with Router X is examined.  This
    list is precisely the collection of Router X's neighbors (on
    this network) whose state is greater than or equal to 2-Way (see
    Section 10.1).  Router X itself is also considered to be on the
    list.  Discard all routers from the list that are ineligible to
    become Designated Router.  (Routers having Router Priority of 0
    are ineligible to become Designated Router.)  The following
    steps are then executed, considering only those routers that
    remain on the list:

1@记录当前网络的指定路由器和备份指定路由器的值。稍后用于比较。

    (1) Note the current values for the network's Designated Router
        and Backup Designated Router.  This is used later for
        comparison purposes.

2@以如下所示方法计算网络的备份指定路由器。只有列表中未声明自己为指定路由器的路由器才有资格成为备份指定路由器。如果这些路由器中的一个或多个已声明自己为备份指定路由器(即,它们当前在Hello Packet中将自己列为备份指定路由,而不是指定路由器),则具有最高路由器优先级的路由器将被声明为备份指定的路由器。在平局的情况下,选择具有最高Router ID的一个。如果没有路由器声明自己为备份指定路由器,选择具有最高Router ID的一个(同样不包括那些声明自己为指定路由器的路由器),然后再次使用路由器ID打破平衡。

    (2) Calculate the new Backup Designated Router for the network
        as follows.  Only those routers on the list that have not
        declared themselves to be Designated Router are eligible to
        become Backup Designated Router.  If one or more of these
        routers have declared themselves Backup Designated Router
        (i.e., they are currently listing themselves as Backup
        Designated Router, but not as Designated Router, in their
        Hello Packets) the one having highest Router Priority is
        declared to be Backup Designated Router.  In case of a tie,
        the one having the highest Router ID is chosen.  If no
        routers have declared themselves Backup Designated Router,
        choose the router having highest Router Priority, (again
        excluding those routers who have declared themselves
        Designated Router), and again use the Router ID to break
        ties.

3@以如下所示方法计算网络的指定路由器。如果一个或多个路由器已声明自己为指定路由器(即,它们当前在其Hello数据包中将自己列为指定路由器),则具有最高路由器优先级的路由器被声明为指定路由器。在平局的情况下,选择具有最高Router ID的一个。如果没有路由器声明自己为指定路由器,请将指定路由器指定为与新选择的备份指定路由器相同。

    (3) Calculate the new Designated Router for the network as
        follows.  If one or more of the routers have declared
        themselves Designated Router (i.e., they are currently
        listing themselves as Designated Router in their Hello
        Packets) the one having highest Router Priority is declared
        to be Designated Router.  In case of a tie, the one having
        the highest Router ID is chosen.  If no routers have
        declared themselves Designated Router, assign the Designated
        Router to be the same as the newly elected Backup Designated
        Router.

4@如果路由器X现在是新的指定路由器或新的备份指定路由器,或者现在不再是指定路由器或不再是备份指定路由器。请重复步骤2和3,然后继续执行步骤5。例如,如果路由器X目前是指定路由器,重复步骤2后,X将不再有资格选择备份指定路由器了。除此之外,这将确保任何路由器都不会同时声明自己为备份指定路由器和指定路由器。[5]

    (4) If Router X is now newly the Designated Router or newly the
        Backup Designated Router, or is now no longer the Designated
        Router or no longer the Backup Designated Router, repeat
        steps 2 and 3, and then proceed to step 5.  For example, if
        Router X is now the Designated Router, when step 2 is
        repeated X will no longer be eligible for Backup Designated
        Router election.  Among other things, this will ensure that
        no router will declare itself both Backup Designated Router
        and Designated Router.[5]

5@经过这些计算,路由器本身现在可能是指定路由器或备份指定路由器。参见第7.3节和第7.4节了解额外信息。路由器的接口状态应相应设置。如果路由器本身现在是指定路由器,则新接口状态为DR。如果路由器本身是备份指定路由器,新接口状态是备份。否则,新接口状态为DR Other。

    (5) As a result of these calculations, the router itself may now
        be Designated Router or Backup Designated Router.  See
        Sections 7.3 and 7.4 for the additional duties this would
        entail.  The router's interface state should be set
        accordingly.  If the router itself is now Designated Router,
        the new interface state is DR.  If the router itself is now
        Backup Designated Router, the new interface state is Backup.
        Otherwise, the new interface state is DR Other.

6@如果连接的网络是NBMA网络,并且路由器本身刚刚成为指定路由器或备份指定路由器,它必须开始向那些没有资格成为指定路由器的邻居发送Hello Packet(请参阅第9.5.1节)。这是通过为每个路由器优先级为0的邻居调用邻居事件Start来完成的。

    (6) If the attached network is an NBMA network, and the router
        itself has just become either Designated Router or Backup
        Designated Router, it must start sending Hello Packets to
        those neighbors that are not eligible to become Designated
        Router (see Section 9.5.1).  This is done by invoking the
        neighbor event Start for each neighbor having a Router
        Priority of 0.

--------------------------------------------------------------------[Page 76]

7@如果上述计算导致指定路由器或备份指定路由器的身份发生更改,则需要修改与此接口相关的邻接集。一些与该接口相关的邻接可能需要重新形成,而另一些可能需要中断。为此,调用事件AdjOK?其状态至少为2-Way的所有邻居。这将导致重新检查其邻接资格(见第10.3节和第10.4节)。

    (7) If the above calculations have caused the identity of either
        the Designated Router or Backup Designated Router to change,
        the set of adjacencies associated with this interface will
        need to be modified.  Some adjacencies may need to be
        formed, and others may need to be broken.  To accomplish
        this, invoke the event AdjOK?  on all neighbors whose state
        is at least 2-Way.  This will cause their eligibility for
        adjacency to be reexamined (see Sections 10.3 and 10.4).

选举算法的复杂性背后的原因是,当当前指定路由器出现故障时,可以从备份指定路由器有序过渡到指定路由器。这种有序的过渡是通过引入滞后来确保的:在旧备份指定路由器接受新的指定路由器职责之前,不能选择新的备份指定路由器。

    The reason behind the election algorithm's complexity is the
    desire for an orderly transition from Backup Designated Router
    to Designated Router, when the current Designated Router fails.
    This orderly transition is ensured through the introduction of
    hysteresis: no new Backup Designated Router can be chosen until
    the old Backup accepts its new Designated Router
    responsibilities.

上述过程可能会选择同一路由器作为指定路由器和备份指定路由器,尽管该路由器本身永远不会是计算路由器(路由器X)。选定的指定路由器可能不是具有最高路由器优先级的路由器,备份指定路由器也不一定具有第二高路由器优先级。如果路由器X本身不符合成为指定路由器的条件,则可能在上述过程中既不会选择备份指定路由器,也不会选择指定路由器。还请注意,如果路由器X是唯一有资格成为指定路由器的连接路由器,它将选择自己作为指定路由器,并且网络将没有备份指定路由器。

    The above procedure may elect the same router to be both
    Designated Router and Backup Designated Router, although that
    router will never be the calculating router (Router X) itself.
    The elected Designated Router may not be the router having the
    highest Router Priority, nor will the Backup Designated Router
    necessarily have the second highest Router Priority.  If Router
    X is not itself eligible to become Designated Router, it is
    possible that neither a Backup Designated Router nor a
    Designated Router will be selected in the above procedure.  Note
    also that if Router X is the only attached router that is
    eligible to become Designated Router, it will select itself as
    Designated Router and there will be no Backup Designated Router
    for the network.

9.5.发送Hello包

Hello数据包被发送到每个正常工作的路由器接口。它们用于发现和维护邻居关系。[6]在广播和NBMA网络上,Hello Packets还用于选择指定路由器和备份指定路由器。

    Hello packets are sent out each functioning router interface.
    They are used to discover and maintain neighbor
    relationships.[6] On broadcast and NBMA networks, Hello Packets
    are also used to elect the Designated Router and Backup
    Designated Router.

--------------------------------------------------------------------[Page 77]

Hello包的格式详细描述于A.3.2节。Hello Packet包含路由器的router Priority(用于选择指定路由器),以及发送到接口的Hello Packats之间的间隔(HelloInterval)。Hello Packet还指示邻居必须在多长时间保持活动状态(RouterDeadInterval)。对于连接到公共网络的所有路由器,HelloInterval和RouterDeadInterval必须相同。Hello数据包还包含连接网络的IP地址掩码(网络掩码)。在未编号的点对点网络和虚链路上,此字段应设置为0.0.0.0。

    The format of an Hello packet is detailed in Section A.3.2.  The
    Hello Packet contains the router's Router Priority (used in
    choosing the Designated Router), and the interval between Hello
    Packets sent out the interface (HelloInterval).  The Hello
    Packet also indicates how often a neighbor must be heard from to
    remain active (RouterDeadInterval).  Both HelloInterval and
    RouterDeadInterval must be the same for all routers attached to
    a common network.  The Hello packet also contains the IP address
    mask of the attached network (Network Mask).  On unnumbered
    point-to-point networks and on virtual links this field should
    be set to 0.0.0.0.

Hello数据包的Options字段描述了路由器的可选OSPF功能。本规范中定义了一种可选能力(见第4.5节和第A.2节)。选项字段的E位当且仅当连接区域能够处理AS-external-LSAs(即,它不是末节区域)时才应设置。如果E位设置不正确,相邻路由器将拒绝接受Hello包(见第10.5节)。Hello Packet选项字段中无法识别的位应设置为零。

    The Hello packet's Options field describes the router's optional
    OSPF capabilities.  One optional capability is defined in this
    specification (see Sections 4.5 and A.2).  The E-bit of the
    Options field should be set if and only if the attached area is
    capable of processing AS-external-LSAs (i.e., it is not a stub
    area).  If the E-bit is set incorrectly the neighboring routers
    will refuse to accept the Hello Packet (see Section 10.5).
    Unrecognized bits in the Hello Packet's Options field should be
    set to zero.

为了确保邻接路由器之间的2-way通信,Hello数据包包含最近从中看到Hello数据的网络上所有路由器的列表。Hello数据包还包含指定路由器和备份指定路由器的当前选择。这些字段中的值为0.0.0.0表示尚未选择

    In order to ensure two-way communication between adjacent
    routers, the Hello packet contains the list of all routers on
    the network from which Hello Packets have been seen recently.
    The Hello packet also contains the router's current choice for
    Designated Router and Backup Designated Router.  A value of
    0.0.0.0 in these fields means that one has not yet been
    selected.

在广播网络和物理点对点网络上,Hello数据包每HelloInterval秒发送一次到IP组播地址AllSPFRouters。在虚链路上,Hello数据包每HelloInterval秒单播(直接寻址到虚拟链路的另一端)发送一次。在点对多点网络上,每HelloInterval秒就向每个连接的邻居分别发送Hello数据包。下一节将介绍在NBMA网络上发送Hello数据包。

    On broadcast networks and physical point-to-point networks,
    Hello packets are sent every HelloInterval seconds to the IP
    multicast address AllSPFRouters.  On virtual links, Hello
    packets are sent as unicasts (addressed directly to the other
    end of the virtual link) every HelloInterval seconds. On Point-
    to-MultiPoint networks, separate Hello packets are sent to each
    attached neighbor every HelloInterval seconds. Sending of Hello
    packets on NBMA networks is covered in the next section.

--------------------------------------------------------------------[Page 78]

9.5.1.在NBMA网络上发送Hello包

为了使Hello协议在非广播网络上运行,可能需要静态配置信息(见C.5和C.6节)。在NBMA网络上,每个有资格成为指定路由器的连接路由器都知道网络上的所有邻居(通过配置或通过某种未指定的机制)。每个邻居都标有邻居的指定路由器资格。

        Static configuration information may be necessary in order
        for the Hello Protocol to function on non-broadcast networks
        (see Sections C.5 and C.6).  On NBMA networks, every
        attached router which is eligible to become Designated
        Router becomes aware of all of its neighbors on the network
        (either through configuration or by some unspecified
        mechanism).  Each neighbor is labelled with the neighbor's
        Designated Router eligibility.

任何发送Hello Packets的NBMA接口,接口状态必须至少为Waiting。然后,Hello数据包被直接发送(作为单播)到路由器邻居的某个子集。有时,Hello Packet会在定时器上周期发送;在其他时间,它被发送作为对接收到的Hello包的响应。路由器的Hello发送行为取决于路由器本身是否有资格成为指定路由器。

        The interface state must be at least Waiting for any Hello
        Packets to be sent out the NBMA interface.  Hello Packets
        are then sent directly (as unicasts) to some subset of a
        router's neighbors.  Sometimes an Hello Packet is sent
        periodically on a timer; at other times it is sent as a
        response to a received Hello Packet.  A router's hello-
        sending behavior varies depending on whether the router
        itself is eligible to become Designated Router.

如果路由器有资格成为指定路由器,它必须周期向所有符合条件的邻居发送Hello包。此外,如果路由器本身是指定路由器或备份指定路由器,它还必须周期向所有其他邻居发送Hello 包。这意味着任何两个符合条件的路由器总是在交换Hello包,这对于指定路由器选择算法的正确操作是必要的。为了尽量减少发送的Hello包的数量,NBMA网络上符合条件的路由器的数量应该保持较小。

        If the router is eligible to become Designated Router, it
        must periodically send Hello Packets to all neighbors that
        are also eligible.  In addition, if the router is itself the
        Designated Router or Backup Designated Router, it must also
        send periodic Hello Packets to all other neighbors.  This
        means that any two eligible routers are always exchanging
        Hello Packets, which is necessary for the correct operation
        of the Designated Router election algorithm.  To minimize
        the number of Hello Packets sent, the number of eligible
        routers on an NBMA network should be kept small.

如果路由器没有资格成为指定路由器,它必须定期向指定路由器和备份指定路由器(如果存在)发送Hello包。它还必须发送Hello包,以回复从任何有资格邻居(当前指定路由器和备份指定路由器除外)接收到的Hello包。这是与任何潜在的指定路由器建立初始双向关系所必需的。

        If the router is not eligible to become Designated Router,
        it must periodically send Hello Packets to both the
        Designated Router and the Backup Designated Router (if they
        exist).  It must also send an Hello Packet in reply to an
        Hello Packet received from any eligible neighbor (other than
        the current Designated Router and Backup Designated Router).
        This is needed to establish an initial bidirectional
        relationship with any potential Designated Router.

当定期向任何邻居发送Hello包时,Hello包之间的间隔由邻居的状态决定。如果邻居处于Down状态,则每隔PollInterval间隔秒发送Hello包。否则,Hello数据包每HelloInterval秒发送一次。

        When sending Hello packets periodically to any neighbor, the
        interval between Hello Packets is determined by the
        neighbor's state.  If the neighbor is in state Down, Hello
        Packets are sent every PollInterval seconds.  Otherwise,
        Hello Packets are sent every HelloInterval seconds.

10.邻居数据结构

OSPF路由器与其邻居路由器进行通信。每个单独的对话都由“邻居数据结构”描述。每个会话都绑定到特定的OSPF路由器接口,并由相邻路由器的OSPF路由器ID或其邻居IP地址标识(见下文)。因此,如果OSPF路由器和另一个路由器有多个共同的连接网络,则会发生多个会话,每个会话都由唯一的邻居数据结构描述。每一个单独的对话在文本中被松散地称为单独的“邻居”。

An OSPF router converses with its neighboring routers.  Each
separate conversation is described by a "neighbor data structure".
Each conversation is bound to a particular OSPF router interface,
and is identified either by the neighboring router's OSPF Router ID
or by its Neighbor IP address (see below).  Thus if the OSPF router
and another router have multiple attached networks in common,
multiple conversations ensue, each described by a unique neighbor
data structure.  Each separate conversation is loosely referred to
in the text as being a separate "neighbor".

邻居数据结构包含与两个邻居之间形成或形成的邻接相关的所有信息。(但是,请记住,并非所有邻居都形成邻接关系的)。邻接可以被视为两个路由器之间高度发展的会话。

The neighbor data structure contains all information pertinent to
the forming or formed adjacency between the two neighbors.
(However, remember that not all neighbors become adjacent.)  An
adjacency can be viewed as a highly developed conversation between
two routers.

状态
邻居会话的功能水平。详细描述可见10.1节

State
    The functional level of the neighbor conversation.  This is
    described in more detail in Section 10.1.

不活动定时器
一个单次计时器,它的触发表明最近没有从邻居那里看到Hello包。定时器的长度为RouterDeadInterval秒。

Inactivity Timer
    A single shot timer whose firing indicates that no Hello Packet
    has been seen from this neighbor recently.  The length of the
    timer is RouterDeadInterval seconds.

主/从
当两个邻居交换数据库时,它们形成主/从关系。主发送第一个数据库描述包,并且是唯一允许重传的部分。从设备只能响应主设备的数据库描述包。主/从关系在状态ExStart下协商。

Master/Slave
    When the two neighbors are exchanging databases, they form a
    master/slave relationship.  The master sends the first Database
    Description Packet, and is the only part that is allowed to
    retransmit.  The slave can only respond to the master's Database
    Description Packets.  The master/slave relationship is
    negotiated in state ExStart.

--------------------------------------------------------------------[Page 80]

DD序列号
DBD报文的DD序列号用于描述当前发送给邻居的序列。

DD Sequence Number
    The DD Sequence number of the Database Description packet that
    is currently being sent to the neighbor.

持续收到DBD包
从邻居持续接收的数据库描述数据包中包含的初始化(I)、更多(M)和主(MS)位、Optional字段和DD序列号。用于确定从邻居接收的下一个数据库描述数据包是否重复。

Last received Database Description packet
    The initialize(I), more (M) and master(MS) bits, Options field,
    and DD sequence number contained in the last Database
    Description packet received from the neighbor. Used to determine
    whether the next Database Description packet received from the
    neighbor is a duplicate.

邻居ID
邻居路由器的OSPF Router ID。当收到邻居发送的Hello包或者配置了虚邻接时,可学习到该邻居ID

Neighbor ID
    The OSPF Router ID of the neighboring router.  The Neighbor ID
    is learned when Hello packets are received from the neighbor, or
    is configured if this is a virtual adjacency (see Section C.4).

邻居优先级
邻居路由器的邻居优先级。包含在邻居的Hello数据包中,此项用于为连接的网络选择指定路由器

Neighbor Priority
    The Router Priority of the neighboring router.  Contained in the
    neighbor's Hello packets, this item is used when selecting the
    Designated Router for the attached network.

邻居IP地址
连接网络的邻居路由器接口的IP地址。当协议包作为单播沿此邻接发送时,用作目标IP地址。如果邻居路由器被选择为指定路由器,则在router-LSAs中也用作连接网络的链路ID(参见第12.4.1节)。当从邻居接收到Hello数据包时,邻居IP地址被学习到。对于虚链路,在路由表构建过程中学习邻居IP地址(参见第15节)

Neighbor IP address
    The IP address of the neighboring router's interface to the
    attached network.  Used as the Destination IP address when
    protocol packets are sent as unicasts along this adjacency.
    Also used in router-LSAs as the Link ID for the attached network
    if the neighboring router is selected to be Designated Router
    (see Section 12.4.1).  The Neighbor IP address is learned when
    Hello packets are received from the neighbor.  For virtual
    links, the Neighbor IP address is learned during the routing
    table build process (see Section 15).

邻居选项
邻居支持的可选OSPF功能。在数据库Exchange过程中学习(见第10.6节)。邻居的可选OSPF功能也在其Hello数据包中列出。如果某些关键的OSPF功能不匹配,则可以拒绝接收到的Hello包(即,邻居关系甚至不会开始形成)(见第10.5节)。可选OSPF功能见第4.5节。

Neighbor Options
    The optional OSPF capabilities supported by the neighbor.
    Learned during the Database Exchange process (see Section 10.6).
    The neighbor's optional OSPF capabilities are also listed in its
    Hello packets.  This enables received Hello Packets to be
    rejected (i.e., neighbor relationships will not even start to
    form) if there is a mismatch in certain crucial OSPF
    capabilities (see Section 10.5).  The optional OSPF capabilities
    are documented in Section 4.5.

邻居的DR
邻居对指定路由器的想法。如果这是邻居本身,这在指定路由器的本地计算中非常重要。仅在广播和NBMA网络上定义

Neighbor's Designated Router
    The neighbor's idea of the Designated Router.  If this is the
    neighbor itself, this is important in the local calculation of
    the Designated Router.  Defined only on broadcast and NBMA
    networks.

邻居的BDR
邻居对备份指定路由器的想法。如果这是邻居本身,这在备份指定路由器的本地计算中非常重要。仅在广播和NBMA网络上定义

Neighbor's Backup Designated Router
    The neighbor's idea of the Backup Designated Router.  If this is
    the neighbor itself, this is important in the local calculation
    of the Backup Designated Router.  Defined only on broadcast and
    NBMA networks.

下一组变量是一系列LSA列表。这些列表描述了区域链接状态数据库的子集。本备忘录定义了五种不同类型的LSA,所有这些LSA都可能存在于区域链路状态数据库中:router-LSAs、network-LSAs、类型3和类型4summary-LSAs(均存储在区域数据结构中),以及AS-external-LSAs(存储在全局数据结构中)

The next set of variables are lists of LSAs.  These lists describe
subsets of the area link-state database.  This memo defines five
distinct types of LSAs, all of which may be present in an area
link-state database: router-LSAs, network-LSAs, and Type 3 and 4
summary-LSAs (all stored in the area data structure), and AS-
external-LSAs (stored in the global data structure).

链路状态重传列表
已被泛洪但未在该邻接处确认的LSA列表。这些将每隔一段时间重新传输,直到它们被确认,或者直到邻接被破坏。

Link state retransmission list
    The list of LSAs that have been flooded but not acknowledged on
    this adjacency.  These will be retransmitted at intervals until
    they are acknowledged, or until the adjacency is destroyed.

数据库汇总列表
当邻居进入数据库Exchange状态时,组成区域链路状态数据库的LSA的完整列表。此列表在DBD包中发送给邻居。

Database summary list
    The complete list of LSAs that make up the area link-state
    database, at the moment the neighbor goes into Database Exchange
    state.  This list is sent to the neighbor in Database
    Description packets.

链路状态请求列表
为了同步两个邻居的链路状态数据库,需要从该邻居接收的LSA列表。此列表在接收到DBD包时创建,然后在链路状态请求数据包中发送给邻居。当接收到适当的链路状态更新数据包时,该列表将耗尽。

Link state request list
    The list of LSAs that need to be received from this neighbor in
    order to synchronize the two neighbors' link-state databases.
    This list is created as Database Description packets are
    received, and is then sent to the neighbor in Link State Request
    packets.  The list is depleted as appropriate Link State Update
    packets are received.

--------------------------------------------------------------------[Page 82]

10.1.邻居状态

邻居的状态(实际上,与邻居路由器进行对话的状态)将在以下部分中记录。这些状态按功能的进展顺序列出。例如,首先列出不工作状态,然后是在实现最终的完全功能状态之前的中间状态列表。规范通过有时引用诸如“状态大于X的那些邻居/邻接”来利用这种排序。Figures 12和13显示了邻居状态变化的图表。图中的弧线标记有导致状态变化的事件。第10.2节记录了相邻事件。

    The state of a neighbor (really, the state of a conversation
    being held with a neighboring router) is documented in the
    following sections.  The states are listed in order of
    progressing functionality.  For example, the inoperative state
    is listed first, followed by a list of intermediate states
    before the final, fully functional state is achieved.  The
    specification makes use of this ordering by sometimes making
    references such as "those neighbors/adjacencies in state greater
    than X".  Figures 12 and 13 show the graph of neighbor state
    changes.  The arcs of the graphs are labelled with the event
    causing the state change.  The neighbor events are documented in
    Section 10.2.

Figure 12中的图表显示了Hello协议影响的状态变化。Hello协议负责邻居的获取和维护,并确保邻居之间的双向通信。

    The graph in Figure 12 shows the state changes effected by the
    Hello Protocol.  The Hello Protocol is responsible for neighbor
    acquisition and maintenance, and for ensuring two way
    communication between neighbors.

Figure 13中的图表显示了邻接的形成。并非每两个相邻的路由器都相邻(见第10.4节)。当邻居处于状态ExStart时,邻接开始形成。在两个路由器发现它们的主/从状态后,状态转换为Exchange。此时,邻居开始在洪泛过程中使用,两个邻居路由器开始同步它们的数据库。当此同步完成时,邻居处于状态Full,我们称这两个路由器完全邻接。此时,邻接关系列在LSA中。

    The graph in Figure 13 shows the forming of an adjacency.  Not
    every two neighboring routers become adjacent (see Section
    10.4).  The adjacency starts to form when the neighbor is in
    state ExStart.  After the two routers discover their
    master/slave status, the state transitions to Exchange.  At this
    point the neighbor starts to be used in the flooding procedure,
    and the two neighboring routers begin synchronizing their
    databases.  When this synchronization is finished, the neighbor
    is in state Full and we say that the two routers are fully
    adjacent.  At this point the adjacency is listed in LSAs.

有关邻居状态更改的更详细描述,以及每个更改中涉及的其他操作,请参见第10.3节

    For a more detailed description of neighbor state changes,
    together with the additional actions involved in each change,
    see Section 10.3.

Down
这是邻居会话的初始状态。这表明没有从邻居接收到最近的信息。在NBMA网络上,Hello数据包仍可发送到“Down”邻居,尽管频率较低(见第9.5.1节)

    Down
        This is the initial state of a neighbor conversation.  It
        indicates that there has been no recent information received
        from the neighbor.  On NBMA networks, Hello packets may
        still be sent to "Down" neighbors, although at a reduced
        frequency (see Section 9.5.1).

--------------------------------------------------------------------[Page 83]
在这里插入图片描述
In addition to the state transitions pictured,
Event KillNbr always forces Down State,
Event InactivityTimer always forces Down State,
Event LLDown always forces Down State

--------------------------------------------------------------------[Page 84]
在这里插入图片描述
In addition to the state transitions pictured,
Event SeqNumberMismatch forces ExStart state,
Event BadLSReq forces ExStart state,
Event 1-Way forces Init state,
Event KillNbr always forces Down State,
Event InactivityTimer always forces Down State,
Event LLDown always forces Down State,
Event AdjOK? leads to adjacency forming/breaking

尝试
此状态仅对连接到NBMA网络的邻居有效。这表明没有从邻居那里收到最近的信息,但应该更加协调一致地与邻居联系。这是通过以HelloInterval的间隔发送邻居Hello包来完成的(参见第9.5.1节)。

    Attempt
        This state is only valid for neighbors attached to NBMA
        networks.  It indicates that no recent information has been
        received from the neighbor, but that a more concerted effort
        should be made to contact the neighbor.  This is done by
        sending the neighbor Hello packets at intervals of
        HelloInterval (see Section 9.5.1).

Init
在这种状态下,最近从邻居那里看到了一个Hello数据包。然而,尚未与邻居建立双向通信(即,路由器本身未出现在邻居的Hello数据包中)。此状态(或更高)下的所有邻居都列在从相关接口发送的Hello数据包中。

    Init
        In this state, an Hello packet has recently been seen from
        the neighbor.  However, bidirectional communication has not
        yet been established with the neighbor (i.e., the router
        itself did not appear in the neighbor's Hello packet).  All
        neighbors in this state (or higher) are listed in the Hello
        packets sent from the associated interface.

2-way
在这种状态下,两个路由器之间的通信是双向的。这已经通过Hello协议的运行得到了保证。这是还没有开始建立邻接关系前一个最先进的状态。(备份)指定路由器从状态为2-way或更大的邻居集中选择。

    2-Way
        In this state, communication between the two routers is
        bidirectional.  This has been assured by the operation of
        the Hello Protocol.  This is the most advanced state short
        of beginning adjacency establishment.  The (Backup)
        Designated Router is selected from the set of neighbors in
        state 2-Way or greater.

Exstart
这是在两个相邻路由器之间创建邻接的第一步。这一步的目标是决定哪个路由器是主,并决定初始DD序列号。此状态或更高状态下的邻居对话称为邻接

    ExStart
        This is the first step in creating an adjacency between the
        two neighboring routers.  The goal of this step is to decide
        which router is the master, and to decide upon the initial
        DD sequence number.  Neighbor conversations in this state or
        greater are called adjacencies.

Exchange
在这种状态下,路由器通过向邻居发送DBD包来描述其整个链路状态数据库。每个DBD包都有一个DD序列号,并被明确确认。任何时候只允许一个数据库描述包未完成。在这种状态下,还可以发送LSR请求邻居最近的LSA。Exchange状态或更高状态的所有邻接关系由泛洪完成。事实上,这些邻接完全能够发送和接收所有类型的OSPF路由协议包。

    Exchange
        In this state the router is describing its entire link state
        database by sending Database Description packets to the
        neighbor.  Each Database Description Packet has a DD
        sequence number, and is explicitly acknowledged.  Only one
        Database Description Packet is allowed outstanding at any
        one time.  In this state, Link State Request Packets may
        also be sent asking for the neighbor's more recent LSAs.
        All adjacencies in Exchange state or greater are used by the
        flooding procedure.  In fact, these adjacencies are fully
        capable of transmitting and receiving all types of OSPF
        routing protocol packets.

Loading
在此状态下,将向邻居发送LSR包,请求在Exchange状态下发现(但尚未收到)的最近LSA

    Loading
        In this state, Link State Request packets are sent to the
        neighbor asking for the more recent LSAs that have been
        discovered (but not yet received) in the Exchange state.

Full
在此状态下,相邻路由器完全邻接。这些邻接现在将出现在router-LSAs和network-LSAs中

    Full
        In this state, the neighboring routers are fully adjacent.
        These adjacencies will now appear in router-LSAs and
        network-LSAs.

--------------------------------------------------------------------[Page 86]

10.2.造成邻居状态改变的事件

状态改变可能是一系列事件影响的。这些事件显示在Figures 12和13中弧线标识的标签中。标签定义如下:
State changes can be effected by a number of events. These
events are shown in the labels of the arcs in Figures 12 and 13.
The label definitions are as follows:

HelloReceived
从邻居收到一个Hello包

    HelloReceived
        An Hello packet has been received from the neighbor.

Start
这表示Hello数据包现在应该以HelloInterval秒的间隔发送给邻居。此事件仅为与NBMA网络相关联的邻居生成。

    Start
        This is an indication that Hello Packets should now be sent
        to the neighbor at intervals of HelloInterval seconds.  This
        event is generated only for neighbors associated with NBMA
        networks.

2-wayReceived
在两个相邻路由器之间实现了双向通信。这由路由器在邻居的Hello包中看到自己来表示。

    2-WayReceived
        Bidirectional communication has been realized between the
        two neighboring routers.  This is indicated by the router
        seeing itself in the neighbor's Hello packet.

NegotiationDone
已协商主/从关系,并交换了DD序列号。这表示开始发送/接收DBD包。有关此事件生成的更多信息,请参阅第10.8节。

    NegotiationDone
        The Master/Slave relationship has been negotiated, and DD
        sequence numbers have been exchanged.  This signals the
        start of the sending/receiving of Database Description
        packets.  For more information on the generation of this
        event, consult Section 10.8.

ExchangeDone
两个路由器都已成功传输了完整的数据库描述数据包序列。每个路由器现在都知道其链路状态数据库的哪些部分已经过时。有关此事件生成的更多信息,请参阅第10.8节

    ExchangeDone
        Both routers have successfully transmitted a full sequence
        of Database Description packets.  Each router now knows what
        parts of its link state database are out of date.  For more
        information on the generation of this event, consult Section
        10.8.

BadLSReq
已收到数据库中未包含的LSA的链路状态请求。这表示数据库交换进程中出现错误

    BadLSReq
        A Link State Request has been received for an LSA not
        contained in the database.  This indicates an error in the
        Database Exchange process.

Loading Done
已收到数据库所有过期部分的链接状态更新。在数据库交换过程完成后,LSR列表变为空,表明了这一点

    Loading Done
        Link State Updates have been received for all out-of-date
        portions of the database.  This is indicated by the Link
        state request list becoming empty after the Database
        Exchange process has completed.

AdjOK
必须决定是否应该与邻居建立/保持邻接。这一事件将开始一些邻接的形成,并摧毁其他邻接。

    AdjOK?
        A decision must be made as to whether an adjacency should be
        established/maintained with the neighbor.  This event will
        start some adjacencies forming, and destroy others.

以下事件导致发达的邻居恢复到较小的状态。与上述事件不同,当邻居会话处于多种状态中的任何一种时,可能会发生这些事件。

    The following events cause well developed neighbors to revert to
    lesser states.  Unlike the above events, these events may occur
    when the neighbor conversation is in any of a number of states.

SeqNumberMismatch
已收到数据库描述数据包,其中A)具有意外的DD序列号,b)意外地设置了初始位,或c)具有与DBD包接收的最后一个OPtions字段不同的Options字段。这些条件中的任何一个都表明在邻接建立期间发生了一些错误。

    SeqNumberMismatch
        A Database Description packet has been received that either
        a) has an unexpected DD sequence number, b) unexpectedly has
        the Init bit set or c) has an Options field differing from
        the last Options field received in a Database Description
        packet.  Any of these conditions indicate that some error
        has occurred during adjacency establishment.

1-way
邻居收到了一个Hello数据包,其中没有提到路由器自己。这表明与邻居的通信不是双向的

    1-Way
        An Hello packet has been received from the neighbor, in
        which the router is not mentioned.  This indicates that
        communication with the neighbor is not bidirectional.

KillNbr
这表明现在无法与邻居进行所有通信,迫使邻居恢复到Down状态。

    KillNbr
        This  is  an  indication that  all  communication  with  the
        neighbor  is now  impossible,  forcing  the  neighbor  to
        revert  to  Down  state.

InactivityTimer
非活动计时器已启动。这意味着最近没有从邻居那里看到Hello数据包。邻居恢复到Down状态

    InactivityTimer
        The inactivity Timer has fired.  This means that no Hello
        packets have been seen recently from the neighbor.  The
        neighbor reverts to Down state.

LLDown
这是来自较低级别协议的指示,即邻居现在不可访问。例如,在X.25网络上,这可以通过带有适当原因和诊断字段的X.25清除指示来指示。此事件迫使邻居进入Down状态。

    LLDown
        This is an indication from the lower level protocols that
        the neighbor is now unreachable.  For example, on an X.25
        network this could be indicated by an X.25 clear indication
        with appropriate cause and diagnostic fields.  This event
        forces the neighbor into Down state.

10.3.邻居状态机

以下是对邻居状态变化的详细描述。每个状态更改都由一个事件调用(第10.2节)。根据邻居的当前状态,此事件可能会产生不同的效果。因此,下面的状态机由当前邻居状态和接收到的事件组织。状态机中的每个条目描述了生成的新邻居状态和所需的一组附加操作。

    A detailed description of the neighbor state changes follows.
    Each state change is invoked by an event (Section 10.2).  This
    event may produce different effects, depending on the current
    state of the neighbor.  For this reason, the state machine below
    is organized by current neighbor state and received event.  Each
    entry in the state machine describes the resulting new neighbor
    state and the required set of additional actions.

当邻居的状态发生变化时,可能需要重新运行指定路由器选择算法。这取决于是否生成了接口NeighborChange事件(参见第9.2节)。此外,如果接口处于DR状态(路由器本身是指定路由器),邻居状态的变化可能会导致产生新的network-LSA(参见第12.4节)。

    When a neighbor's state changes, it may be necessary to rerun
    the Designated Router election algorithm.  This is determined by
    whether the interface NeighborChange event is generated (see
    Section 9.2).  Also, if the Interface is in DR state (the router
    is itself Designated Router), changes in neighbor state may
    cause a new network-LSA to be originated (see Section 12.4).

当邻居状态机需要调用接口状态机时,应将其作为计划任务进行(见第4.4节)。这通过确保两个状态机都不会递归执行来简化事情

    When the neighbor state machine needs to invoke the interface
    state machine, it should be done as a scheduled task (see
    Section 4.4).  This simplifies things, by ensuring that neither
    state machine will be executed recursively.

状态:Down
事件:Start
新状态:Attempt
动作:向邻居发送Hello包(该邻居总是与NBMA网络相关联),并启动该邻居的非活动定时器。稍后的定时器触发将表明未与邻居进行通信。

     State(s):  Down
        Event:  Start
    New state:  Attempt
       Action:  Send an Hello Packet to the neighbor (this neighbor
                is always associated with an NBMA network) and start
                the Inactivity Timer for the neighbor.  The timer's
                later firing would indicate that communication with
                the neighbor was not attained.

状态:Attempt
事件:HelloReceived
新状态:Init
动作:由于没有收到邻居信息,为邻居重启非活动定时器

     State(s):  Attempt
        Event:  HelloReceived
    New state:  Init
       Action:  Restart the Inactivity Timer for the neighbor, since
                the neighbor has now been heard from.

状态:Down
事件:HelloReceived
新状态:Init
动作:为邻居重启非活动定时器。定时器触发表明邻居处于私网状态

     State(s):  Down
        Event:  HelloReceived
    New state:  Init
       Action:  Start the Inactivity Timer for the neighbor.  The
                timer's later firing would indicate that the
                neighbor is dead.

状态:Init或更高
事件:HelloReceived
新状态:状态不改变
动作:由于没有收到邻居信息,为邻居重启非活动定时器

     State(s):  Init or greater
        Event:  HelloReceived
    New state:  No state change.
       Action:  Restart the Inactivity Timer for the neighbor, since
                the neighbor has again been heard from.

状态:Init
事件:2-WayReceived
新状态:取决于操作程序
动作:确定是否应与邻居建立邻接关系(见第10.4节)。如果不是,则新的邻居状态为2-Way。
否则(应建立邻接),邻居状态将转换到ExStart。进入此状态后,路由器将增加邻居数据结构中的DD序列号。如果这是第一次尝试建立邻接,则应为DD序列号分配一些唯一的值(如时间时钟)。然后,它声明自己为master(将主/从位设置为master),并开始发送DBD包,并设置初始化(I)、更多(M)和主(MS)位。否则,此DBD包应为空。该DBD包应以RxmtInterval的间隔重新传输,直到进入下一状态(见第10.8节)。

     State(s):  Init
        Event:  2-WayReceived
    New state:  Depends upon action routine.
       Action:  Determine whether an adjacency should be established
                with the neighbor (see Section 10.4).  If not, the
                new neighbor state is 2-Way.

                Otherwise (an adjacency should be established) the
                neighbor state transitions to ExStart.  Upon
                entering this state, the router increments the DD
                sequence number in the neighbor data structure.  If
                this is the first time that an adjacency has been
                attempted, the DD sequence number should be assigned
                some unique value (like the time of day clock).  It
                then declares itself master (sets the master/slave
                bit to master), and starts sending Database
                Description Packets, with the initialize (I), more
                (M) and master (MS) bits set.  This Database
                Description Packet should be otherwise empty.  This
                Database Description Packet should be retransmitted
                at intervals of RxmtInterval until the next state is
                entered (see Section 10.8).

状态:Exstart
事件:NegotiationDone
新状态:Exchange
动作:路由器必须在邻居数据库摘要列表中列出其整个区域链路状态数据库的内容。区域链路状态数据库包括含有区域结构的router-LSAs, network-LSAs和summary-LSAs,以及全局结构中的AS-external-LSAs。从虚邻居的数据库获得的AS-external-LSAs摘要列表将省略。如果该区域已配置为末节Stub,则从数据库摘要列表中省略AS-external-LSAs(见第3.6节)。Age等于MaxAge的LSA将被添加到邻居的链路状态重传列表中。数据库摘要列表的摘要将在DBD包中发送给邻居。每个数据库描述包都有一个DD序列号,并被明确确认。任何时候只允许一个数据库描述包未完成。有关发送和接收DBD包的详细信息,请参阅第10.8节和第10.6节。

     State(s):  ExStart
        Event:  NegotiationDone
    New state:  Exchange
       Action:  The router must list the contents of its entire area
                link state database in the neighbor Database summary
                list.  The area link state database consists of the
                router-LSAs, network-LSAs and summary-LSAs contained
                in the area structure, along with the AS-external-
                LSAs contained in the global structure.  AS-
                external-LSAs are omitted from a virtual neighbor's
                Database summary list.  AS-external-LSAs are omitted
                from the Database summary list if the area has been
                configured as a stub (see Section 3.6).  LSAs whose
                age is equal to MaxAge are instead added to the
                neighbor's Link state retransmission list.  A
                summary of the Database summary list will be sent to
                the neighbor in Database Description packets.  Each
                Database Description Packet has a DD sequence
                number, and is explicitly acknowledged.  Only one
                Database Description Packet is allowed outstanding
                at any one time.  For more detail on the sending and
                receiving of Database Description packets, see
                Sections 10.8 and 10.6.

--------------------------------------------------------------------[Page 91]

状态:Exchange
事件:ExchangeDone
新状态:取决于操作程序
动作:如果邻居LSR列表为空,新的邻居状态为Full。不在需要其他动作。此为邻接最终状态
否则,新的邻居状态是Loading。开始(或继续)向邻居发送LSR包(参见第10.9节)。这些是对邻居最近的LSA的请求(在Exchange状态下已发现但尚未收到)。这些LSA列在与邻居相关联的LSR列表中。

     State(s):  Exchange
        Event:  ExchangeDone
    New state:  Depends upon action routine.
       Action:  If the neighbor Link state request list is empty,
                the new neighbor state is Full.  No other action is
                required.  This is an adjacency's final state.

                Otherwise, the new neighbor state is Loading.  Start
                (or continue) sending Link State Request packets to
                the neighbor (see Section 10.9).  These are requests
                for the neighbor's more recent LSAs (which were
                discovered but not yet received in the Exchange
                state).  These LSAs are listed in the Link state
                request list associated with the neighbor.

状态:Loading
事件:Loading Done
新状态:Full
动作:不在需要其他动作。这是邻接的最终状态

     State(s):  Loading
        Event:  Loading Done
    New state:  Full
       Action:  No action required.  This is an adjacency's final
                state.

状态:2-Way
事件:AdjOK?
新状态:取决于操作程序
动作:确定是否应与邻居路由器形成邻接(参见第10.4节)。如果不应,则相邻状态保持为2-Way。否则,请将邻居状态转换为ExStart,并执行与状态Init和事件2-WayReceived的上述状态机条目相关联的操作。

     State(s):  2-Way
        Event:  AdjOK?
    New state:  Depends upon action routine.
       Action:  Determine whether an adjacency should be formed with
                the neighboring router (see Section 10.4).  If not,
                the neighbor state remains at 2-Way.  Otherwise,
                transition the neighbor state to ExStart and perform
                the actions associated with the above state machine
                entry for state Init and event 2-WayReceived.

--------------------------------------------------------------------[Page 92]

状态:Exstart或更高
事件:AdjOK?
新状态:取决于操作程序
动作:确定邻居路由器是否仍应邻接。如果是,则不存在状态更改,也不需要进一步的操作。
否则,(可能部分形成的)邻接必须被破坏。邻居状态转换为2-Way。链路状态重传列表、数据库摘要列表和链路状态请求列表清除LSA

     State(s):  ExStart or greater
        Event:  AdjOK?
    New state:  Depends upon action routine.
       Action:  Determine whether the neighboring router should
                still be adjacent.  If yes, there is no state change
                and no further action is necessary.

                Otherwise, the (possibly partially formed) adjacency
                must be destroyed.  The neighbor state transitions
                to 2-Way.  The Link state retransmission list,
                Database summary list and Link state request list
                are cleared of LSAs.

状态:Exchange或更高
事件:SeqNumberMismatch
新状态:ExStart
动作:(可能部分形成的)邻接被拆除,然后尝试重建。邻居状态首先转换为ExStart。链路状态重传列表、数据库摘要列表和链路状态请求列表将清除LSA。然后,路由器递增邻居数据结构中的DD序列号,声明自己为主(将主/从位设置为主),并开始发送DBD包,并设置初始化(I)、更多(M)和主(MS)位。否则,该DBD包应为空(见第10.8节)。

     State(s):  Exchange or greater
        Event:  SeqNumberMismatch
    New state:  ExStart
       Action:  The (possibly partially formed) adjacency is torn
                down, and then an attempt is made at
                reestablishment.  The neighbor state first
                transitions to ExStart.  The Link state
                retransmission list, Database summary list and Link
                state request list are cleared of LSAs.  Then the
                router increments the DD sequence number in the
                neighbor data structure, declares itself master
                (sets the master/slave bit to master), and starts
                sending Database Description Packets, with the
                initialize (I), more (M) and master (MS) bits set.
                This Database Description Packet should be otherwise
                empty (see Section 10.8).

状态:Exchange或更高
事件:BadLSReq
新状态:ExStart
动作:事件BadLSReq的操作与邻居事件SeqNumberMismatch的操作完全相同。(可能部分形成的)邻接被拆除,然后尝试重建。有关详细信息,请参阅在状态Exchange或更高版本中生成事件SeqNumberMismatch时调用的邻居状态机条目。

     State(s):  Exchange or greater
        Event:  BadLSReq
    New state:  ExStart
       Action:  The action for event BadLSReq is exactly the same as
                for the neighbor event SeqNumberMismatch.  The
                (possibly partially formed) adjacency is torn down,
                and then an attempt is made at reestablishment.  For
                more information, see the neighbor state machine
                entry that is invoked when event SeqNumberMismatch
                is generated in state Exchange or greater.

状态:任何状态
事件:KillNbr
新状态:Donw
动作:链路状态重传列表、数据库摘要列表和链路状态请求列表将清除LSA。此外,禁用非活动计时器。

     State(s):  Any state
        Event:  KillNbr
    New state:  Down
       Action:  The Link state retransmission list, Database summary
                list and Link state request list are cleared of
                LSAs.  Also, the Inactivity Timer is disabled.

状态:任何状态
事件:LLDown
新状态:Down
动作:链路状态重传列表、数据库摘要列表和链路状态请求列表将清除LSA。此外,非活动定时器被禁用

     State(s):  Any state
        Event:  LLDown
    New state:  Down
       Action:  The Link state retransmission list, Database summary
                list and Link state request list are cleared of
                LSAs.  Also, the Inactivity Timer is disabled.

状态:任何状态
事件:InactivityTimer
新状态:Down
动作:链路状态重传列表、数据库摘要列表和链路状态请求列表将清除LSA。

     State(s):  Any state
        Event:  InactivityTimer
    New state:  Down
       Action:  The Link state retransmission list, Database summary
                list and Link state request list are cleared of
                LSAs.

--------------------------------------------------------------------[Page 94]

状态:2-Way或更高
事件:1-WayReceived
新状态:Init
动作:链路状态重传列表、数据库摘要列表和链路状态请求列表将清除LSA。

     State(s):  2-Way or greater
        Event:  1-WayReceived
    New state:  Init
       Action:  The Link state retransmission list, Database summary
                list and Link state request list are cleared of
                LSAs.

状态:2-Way或更高
事件:2-WayReceived
新状态:无状态改变
动作:无动作

     State(s):  2-Way or greater
        Event:  2-WayReceived
    New state:  No state change.
       Action:  No action required.

状态:Init
事件:1-WayReceived
新状态:无动作

     State(s):  Init
        Event:  1-WayReceived
    New state:  No state change.
       Action:  No action required.

10.4.是否形成邻接关系

与路由器的邻居的某些子集建立邻接。通过点对点网络、点对多点网络和虚拟链路连接的路由器始终具有邻接。在广播和NBMA网络上,所有路由器都与指定路由器和备份指定路由器形成邻接。

    Adjacencies are established with some subset of the router's
    neighbors.  Routers connected by point-to-point networks,
    Point-to-MultiPoint networks and virtual links always become
    adjacent.  On broadcast and NBMA networks, all routers become
    adjacent to both the Designated Router and the Backup Designated
    Router.

邻接形成决策发生在相邻状态机中的两个位置。首先,当最初与邻居建立双向通信时,其次,当连接网络的(备份)指定路由器的身份发生变化时。如果决定不尝试建立邻接,则邻居通信的状态停止在2-Way。

    The adjacency-forming decision occurs in two places in the
    neighbor state machine.  First, when bidirectional communication
    is initially established with the neighbor, and secondly, when
    the identity of the attached network's (Backup) Designated
    Router changes.  If the decision is made to not attempt an
    adjacency, the state of the neighbor communication stops at 2-
    Way.

当至少满足以下条件之一时,应与双向邻居建立邻接:
o底层网络类型为点对点
o基础网络类型为点对多点
o底层网络类型为虚链路
o路由器本身就是指定路由器
o路由器本身是备份指定路由器
o邻居路由器为指定路由器
o邻居路由器是备份指定路由器

    An adjacency should be established with a bidirectional neighbor
    when at least one of the following conditions holds:

    o   The underlying network type is point-to-point
    o   The underlying network type is Point-to-MultiPoint
    o   The underlying network type is virtual link
    o   The router itself is the Designated Router
    o   The router itself is the Backup Designated Router
    o   The neighboring router is the Designated Router
    o   The neighboring router is the Backup Designated Router

10.5.收到Hello包

本节介绍接收到的Hello数据包的详细处理。(关于Hello数据包的格式,请参见第A.3.2节。)OSPF数据包的通用输入处理将检查IP报头和OSPF包报头的有效性。接下来,必须对照为接收接口配置的值检查接收到的Hello数据包中的Network Mask、HelloInterval和RouterDeadInterval字段的值。任何不匹配都会导致处理停止并丢弃数据包。换句话说,上面的字段实际上描述了连接的网络的配置。然而,上述规则有一个例外:在点对点网络和虚链路上,应忽略收到的Hello数据包中的网络掩码。

    This section explains the detailed processing of a received
    Hello Packet.  (See Section A.3.2 for the format of Hello
    packets.)  The generic input processing of OSPF packets will
    have checked the validity of the IP header and the OSPF packet
    header.  Next, the values of the Network Mask, HelloInterval,
    and RouterDeadInterval fields in the received Hello packet must
    be checked against the values configured for the receiving
    interface.  Any mismatch causes processing to stop and the
    packet to be dropped.  In other words, the above fields are
    really describing the attached network's configuration. However,
    there is one exception to the above rule: on point-to-point
    networks and on virtual links, the Network Mask in the received
    Hello Packet should be ignored.

接收接口连接到单个OSPF区域(这可能是骨干区域)。Hello Packet的Options字段中的E位设置必须与该区域的ExternalRoutingCapability匹配。如果AS-external-LSAs未泛洪/遍及该区域(即该区域为“末节”),则在收到的Hello数据包中必须清除e位,否则必须设置e位。不匹配会导致处理停止并丢弃数据包。应忽略Hello Packet的Options字段中其余位的设置。

    The receiving interface attaches to a single OSPF area (this
    could be the backbone).  The setting of the E-bit found in the
    Hello Packet's Options field must match this area's
    ExternalRoutingCapability.  If AS-external-LSAs are not flooded
    into/throughout the area (i.e, the area is a "stub") the E-bit
    must be clear in received Hello Packets, otherwise the E-bit
    must be set.  A mismatch causes processing to stop and the
    packet to be dropped.  The setting of the rest of the bits in
    the Hello Packet's Options field should be ignored.

此时,尝试将Hello数据包的源与接收接口的邻居之一匹配。如果接收接口连接到广播、点对多点或NBMA网络,则源地址由Hello的IP报头中的IP源地址标识。如果接收接口连接到点对点链路或虚链路,则源地址由Hello的OSPF数据包头中的路由器ID标识。接口的当前邻居列表包含在接口的数据结构中。如果找不到匹配的邻居结构(即,这是第一次检测到邻居),则创建一个邻居结构。新创建的邻居的初始状态设置为Down。

    At this point, an attempt is made to match the source of the
    Hello Packet to one of the receiving interface's neighbors.  If
    the receiving interface connects to a broadcast, Point-to-
    MultiPoint or NBMA network the source is identified by the IP
    source address found in the Hello's IP header.  If the receiving
    interface connects to a point-to-point link or a virtual link,
    the source is identified by the Router ID found in the Hello's
    OSPF packet header.  The interface's current list of neighbors
    is contained in the interface's data structure.  If a matching
    neighbor structure cannot be found, (i.e., this is the first
    time the neighbor has been detected), one is created.  The
    initial state of a newly created neighbor is set to Down.

当在广播、点对多点或NBMA网络上从邻居接收Hello数据包时,将邻居结构的邻居ID设置为数据包的OSPF头中的路由器ID。对于这些网络类型,邻居结构的路由器优先级字段、邻居的指定路由器字段和邻居的备份指定路由器字段也设置为等于在接收到的Hello分组中找到的相应字段;应注意这些字段中的更改,以便在以下步骤中使用。当在点对点网络上(但不是在虚拟链路上)接收到Hello时,将邻居结构的邻居IP地址设置为数据包的IP源地址。

    When receiving an Hello Packet from a neighbor on a broadcast,
    Point-to-MultiPoint or NBMA network, set the neighbor
    structure's Neighbor ID equal to the Router ID found in the
    packet's OSPF header.  For these network types, the neighbor
    structure's Router Priority field, Neighbor's Designated Router
    field, and Neighbor's Backup Designated Router field are also
    set equal to the corresponding fields found in the received
    Hello Packet; changes in these fields should be noted for
    possible use in the steps below.  When receiving an Hello on a
    point-to-point network (but not on a virtual link) set the
    neighbor structure's Neighbor IP address to the packet's IP
    source address.

现在检查Hello数据包的其余部分,生成要提供给邻居和接口状态机的事件。这些状态机被指定为执行或调度(参见第4.4节)。例如,通过在下面指定邻居状态机依次,可以通过单个接收到的Hello来实现几个邻居状态转换:

    Now the rest of the Hello Packet is examined, generating events
    to be given to the neighbor and interface state machines.  These
    state machines are specified either to be executed or scheduled
    (see Section 4.4).  For example, by specifying below that the
    neighbor state machine be executed in line, several neighbor
    state transitions may be effected by a single received Hello:

@每个Hello包造成邻居状态机执行事件HelloReceived

    o   Each Hello Packet causes the neighbor state machine to be
        executed with the event HelloReceived.

@然后检查Hello包中包含的邻居列表。如果路由器本身出现在该列表中,则应使用事件2-WayReceived执行邻居状态机。否则,应该使用事件1-WayReceived来执行邻居状态机,并且包的处理停止。

    o   Then the list of neighbors contained in the Hello Packet is
        examined.  If the router itself appears in this list, the
        neighbor state machine should be executed with the event 2-
        WayReceived.  Otherwise, the neighbor state machine should
        be executed with the event 1-WayReceived, and the processing
        of the packet stops.

@第二,如果注意到邻居的路由器优先级字段中的变化,则使用事件NeighborChange来调度接收接口的状态机。

    o   Next, if a change in the neighbor's Router Priority field
        was noted, the receiving interface's state machine is
        scheduled with the event NeighborChange.

@如果邻居同时声明自己是指定路由器(Hello Packet的指定路由器字段=邻居IP地址),并且数据包中的备份指定路由器字段等于0.0.0.0,并且接收接口处于等待状态,则使用事件BackupSeen调度接收接口的状态机。否则,如果邻居声明自己是指定路由器,而它以前没有,或者邻居没有声明自己是以前指定的路由器,则接收接口的状态机将使用事件NeighborChange进行调度

    o   If the neighbor is both declaring itself to be Designated
        Router (Hello Packet's Designated Router field = Neighbor IP
        address) and the Backup Designated Router field in the
        packet is equal to 0.0.0.0 and the receiving interface is in
        state Waiting, the receiving interface's state machine is
        scheduled with the event BackupSeen.  Otherwise, if the
        neighbor is declaring itself to be Designated Router and it
        had not previously, or the neighbor is not declaring itself
        Designated Router where it had previously, the receiving
        interface's state machine is scheduled with the event
        NeighborChange.

@如果邻居声明自己是备份指定路由器(Hello Packet的备份指定路由器字段=邻居IP地址),并且接收接口处于等待状态,则接收接口的状态机将使用事件BackupSeen进行调度。否则,如果邻居正在声明自己是备份指定路由器,而它以前没有,或者邻居没有在以前声明自己是备用指定路由器,则接收接口的状态机将使用事件NeighborChange进行调度。

    o   If the neighbor is declaring itself to be Backup Designated
        Router (Hello Packet's Backup Designated Router field =
        Neighbor IP address) and the receiving interface is in state
        Waiting, the receiving interface's state machine is
        scheduled with the event BackupSeen.  Otherwise, if the
        neighbor is declaring itself to be Backup Designated Router
        and it had not previously, or the neighbor is not declaring
        itself Backup Designated Router where it had previously, the
        receiving interface's state machine is scheduled with the
        event NeighborChange.

在NBMA网络上,Hello包的接收还会导致Hello包被发送回邻居作为响应。详见第9.5.1节

    On NBMA networks, receipt of an Hello Packet may also cause an
    Hello Packet to be sent back to the neighbor in response. See
    Section 9.5.1 for more details.

--------------------------------------------------------------------[Page 98]

10.6.收到DBD报文

本节解释接收到的数据库描述包的详细处理过程。传入的数据库描述包已经与邻居和接收接口相关联,这一过程已经包含通用输入包处理(第8.2节)。是否应接受数据库描述数据包,如果是,应如何进一步处理它取决于邻居状态。

    This section explains the detailed processing of a received
    Database Description Packet.  The incoming Database Description
    Packet has already been associated with a neighbor and receiving
    interface by the generic input packet processing (Section 8.2).
    Whether the Database Description packet should be accepted, and
    if so, how it should be further processed depends upon the
    neighbor state.

如果数据库描述数据包被接受,则以下数据包字段应保存在“最后接收的数据库描述数据”下的相应邻居数据结构中:数据包的初始化(I)、更多(M)和主(MS)位、Options字段和DD序列号。如果在从邻居接收的两个连续数据库描述包中相同地设置了这些字段,则在之后描述的处理中,第二个数据库描述包被视为“重复”。

    If a Database Description packet is accepted, the following
    packet fields should be saved in the corresponding neighbor data
    structure under "last received Database Description packet":
    the packet's initialize(I), more (M) and master(MS) bits,
    Options field, and DD sequence number. If these fields are set
    identically in two consecutive Database Description packets
    received from the neighbor, the second Database Description
    packet is considered to be a "duplicate" in the processing
    described below.

如果DBD包中的接口MTU字段表明IP数据报大小大于路由器在接收接口上可以接受的不分片的IP数据报,则数据库描述包被拒绝。

    If the Interface MTU field in the Database Description packet
    indicates an IP datagram size that is larger than the router can
    accept on the receiving interface without fragmentation, the
    Database Description packet is rejected.  Otherwise, if the
    neighbor state is:

Down
数据包应当被拒绝

    Down
        The packet should be rejected.

Attempt
数据包应当被拒绝

    Attempt
        The packet should be rejected.

Init
应使用事件2-WayReceived执行邻居状态机。这会导致状态立即更改为“2-Way”或“ExStart”。如果新状态为ExStart,则当前数据包的处理应在通过转到下面的ExStart此新状态下继续进行。

    Init
        The neighbor state machine should be executed with the event
        2-WayReceived.  This causes an immediate state change to
        either state 2-Way or state ExStart. If the new state is
        ExStart, the processing of the current packet should then
        continue in this new state by falling through to case
        ExStart below.

--------------------------------------------------------------------[Page 99]

2-Way
数据包应当被忽略数据库描述包仅用于查找相邻关系。[7]

    2-Way
        The packet should be ignored.  Database Description Packets
        are used only for the purpose of bringing up adjacencies.[7]

ExStart
如果接收到的数据包与以下情况之一匹配,则应使用事件NegotiationDone(使状态转换为Exchange)执行邻居状态机,数据包的选项字段应记录在邻居结构的Neighbor Options字段中,并且数据包应按顺序被接受为下一个状态并进一步处理(见下文)。否则,应忽略数据包。

@数据包的初始化(I)、更多(M)和主(MS)位被置位,数据包的内容为空并且邻居的Router ID大于路由器自己的Router ID。在这种情况下,路由器现在是从属的。将主/从位设置为从位,并将邻居数据结构的DD序列号设置为主数据结构指定的序列号

@数据包的初始化(I)和主(MS)位被关闭,数据包的DD序列号等于邻居数据结构的DD序号(表示确认),并且邻居的Router ID小于路由器自己的。在这种情况下,路由器是主路由器。

    ExStart
        If the received packet matches one of the following cases,
        then the neighbor state machine should be executed with the
        event NegotiationDone (causing the state to transition to
        Exchange), the packet's Options field should be recorded in
        the neighbor structure's Neighbor Options field and the
        packet should be accepted as next in sequence and processed
        further (see below).  Otherwise, the packet should be
        ignored.

        o   The initialize(I), more (M) and master(MS) bits are set,
            the contents of the packet are empty, and the neighbor's
            Router ID is larger than the router's own.  In this case
            the router is now Slave.  Set the master/slave bit to
            slave, and set the neighbor data structure's DD sequence
            number to that specified by the master.

        o   The initialize(I) and master(MS) bits are off, the
            packet's DD sequence number equals the neighbor data
            structure's DD sequence number (indicating
            acknowledgment) and the neighbor's Router ID is smaller
            than the router's own.  In this case the router is
            Master.

Exchange
重复的DBD包被主设备丢弃,并导致从设备重新发送它发送的最后一个数据库描述数据。否则(数据包非重复发送):
@如果MS位的状态与连接的主/从状态不一致,则生成邻居事件SeqNumberMismatch并停止处理数据包

@如果初始化(I)位被置位,则生成邻居事件SeqNumberMismatch并停止处理数据包。

@如果数据包的Options字段指示与先前从邻居接收到的(记录在邻居结构的Neighbor Options字段中)不同的可选OSPF能力集,则生成邻居事件SeqNumberMismatch并停止处理该数据包。

@DBD包必须按顺序处理,如数据包的DD序列号所表明那样。如果路由器是主路由器,则接收到的下一个包的DD序列号应等于邻居数据结构中的DD序号。如果路由器是从属的,则接收到的下一个分组的DD序列号应该比存储在邻居数据结构中的DD序号多一个。在任何一种情况下,如果数据包是顺序中的下一个,则应接受该数据包,并按以下规定处理其内容

@否则,生成邻居事件SeqNumberMismatch并停止处理数据包。

    Exchange
        Duplicate Database Description packets are discarded by the
        master, and cause the slave to retransmit the last Database
        Description packet that it had sent. Otherwise (the packet
        is not a duplicate):

        o   If the state of the MS-bit is inconsistent with the
            master/slave state of the connection, generate the
            neighbor event SeqNumberMismatch and stop processing the
            packet.

        o   If the initialize(I) bit is set, generate the neighbor
            event SeqNumberMismatch and stop processing the packet.

--------------------------------------------------------------------[Page 100]

        o   If the packet's Options field indicates a different set
            of optional OSPF capabilities than were previously
            received from the neighbor (recorded in the Neighbor
            Options field of the neighbor structure), generate the
            neighbor event SeqNumberMismatch and stop processing the
            packet.

        o   Database Description packets must be processed in
            sequence, as indicated by the packets' DD sequence
            numbers. If the router is master, the next packet
            received should have DD sequence number equal to the DD
            sequence number in the neighbor data structure. If the
            router is slave, the next packet received should have DD
            sequence number equal to one more than the DD sequence
            number stored in the neighbor data structure. In either
            case, if the packet is the next in sequence it should be
            accepted and its contents processed as specified below.

        o   Else, generate the neighbor event SeqNumberMismatch and
            stop processing the packet.

Loading or Full
在这种状态下,路由器已经发送和接收了整个DBD包序列。接收到的唯一数据包应该是重复的(见上文)。特别地,包的Options字段应该匹配邻居先前指示的可选OSPF能力集(存储在邻居结构的Neighbor Options字段中)。接收到的任何其他数据包,包括接收到设置了初始化(I)位的数据包,都应生成邻居事件SeqNumberMismatch。[8]主设备应丢弃重复数据包。从属设备必须通过重复其发送的最后一个DBD包来响应重复数据。

    Loading or Full
        In this state, the router has sent and received an entire
        sequence of Database Description Packets.  The only packets
        received should be duplicates (see above).  In particular,
        the packet's Options field should match the set of optional
        OSPF capabilities previously indicated by the neighbor
        (stored in the neighbor structure's Neighbor Options field).
        Any other packets received, including the reception of a
        packet with the Initialize(I) bit set, should generate the
        neighbor event SeqNumberMismatch.[8] Duplicates should be
        discarded by the master.  The slave must respond to
        duplicates by repeating the last Database Description packet
        that it had sent.

当路由器接受接收到的DBD包作为序列中的下一个时,包内容被如下处理。对于列出的每个LSA,将检查LSA的LS类型的有效性。如果LS类型未知(例如,不是本规范定义的LS类型1-5之一),或者如果这是AS-external-LSA(LS类型=5),并且邻居与末节区域相关联,则生成邻居事件SeqNumberMismatch并停止处理分组。否则,路由器在其数据库中查找LSA,以查看它是否也有LSA的实例。如果没有,或者数据库副本不太新(参见第13.1节),则将LSA放入LSR列表,以便可以LSR包中(立即或稍后)请求LSA。

    When the router accepts a received Database Description Packet
    as the next in sequence the packet contents are processed as
    follows.  For each LSA listed, the LSA's LS type is checked for
    validity.  If the LS type is unknown (e.g., not one of the LS
    types 1-5 defined by this specification), or if this is an AS-
    external-LSA (LS type = 5) and the neighbor is associated with a
    stub area, generate the neighbor event SeqNumberMismatch and
    stop processing the packet.  Otherwise, the router looks up the
    LSA in its database to see whether it also has an instance of
    the LSA.  If it does not, or if the database copy is less recent
    (see Section 13.1), the LSA is put on the Link state request
    list so that it can be requested (immediately or at some later
    time) in Link State Request Packets.

当路由器接受接收到的DBD包作为序列中的下一个时,取决于它是主设备还是从设备:

主设备
增加邻居数据结构中的DD序列号。如果路由器已经发送了其整个数据库描述数据包序列,并且刚刚接受的数据包的更多位(M)设置为0,则生成邻居事件ExchangeDone。否则,它应该向从属设备发送一个新的数据库描述。

从设备
将邻居数据结构中的DD序列号设置为接收到的数据包中出现的DD序号。从设备必须发送DBD包作为答复。如果接收到的数据包的更多比特(M)设置为0,并且从设备发送的数据包也将M比特设置为0时,将生成邻居事件ExchangeDone。请注意,从设备总是在主设备之前生成此事件。

    When the router accepts a received Database Description Packet
    as the next in sequence, it also performs the following actions,
    depending on whether it is master or slave:

    Master
        Increments the DD sequence number in the neighbor data
        structure.  If the router has already sent its entire
        sequence of Database Description Packets, and the just
        accepted packet has the more bit (M) set to 0, the neighbor
        event ExchangeDone is generated.  Otherwise, it should send
        a new Database Description to the slave.

    Slave
        Sets the DD sequence number in the neighbor data structure
        to the DD sequence number appearing in the received packet.
        The slave must send a Database Description Packet in reply.
        If the received packet has the more bit (M) set to 0, and
        the packet to be sent by the slave will also have the M-bit
        set to 0, the neighbor event ExchangeDone is generated.
        Note that the slave always generates this event before the
        master.

10.7.收到LSR包

本节解释了接收到的LSR包的详细处理。接收的LSR指定邻居希望接收的LSA列表。当邻居处于Exchange、Loading或Full状态时,应接LSR包。在所有其他状态下,应忽略LSR包。

    This section explains the detailed processing of received Link
    State Request packets.  Received Link State Request Packets
    specify a list of LSAs that the neighbor wishes to receive.
    Link State Request Packets should be accepted when the neighbor
    is in states Exchange, Loading, or Full.  In all other states
    Link State Request Packets should be ignored.

--------------------------------------------------------------------[Page 100]

LSR包中指定的每个LSA应位于路由器的数据库中,并复制LSU包中,以便传输到邻居。这些LSA不应放在邻居的链路状态重传列表上。如果在数据库中找不到LSA,则说明数据库交换过程出了问题,应该生成邻居事件BadLSReq。

    Each LSA specified in the Link State Request packet should be
    located in the router's database, and copied into Link State
    Update packets for transmission to the neighbor.  These LSAs
    should NOT be placed on the Link state retransmission list for
    the neighbor.  If an LSA cannot be found in the database,
    something has gone wrong with the Database Exchange process, and
    neighbor event BadLSReq should be generated.

10.8.发送DBD包

本节描述如何将DBD包发送到邻居。DBD包的接口MTU字段被设置为可以通过发送接口发送的最大IP数据报的大小,而不会出现分片。互联网中使用的常见MTU见[参考文献22]的表7-1。在通过虚链路发送的数据库描述数据包中,接口MTU应设置为0。

    This section describes how Database Description Packets are sent
    to a neighbor. The Database Description packet's Interface MTU
    field is set to the size of the largest IP datagram that can be
    sent out the sending interface, without fragmentation.  Common
    MTUs in use in the Internet can be found in Table 7-1 of
    [Ref22]. Interface MTU should be set to 0 in Database
    Description packets sent over virtual links.

路由器的可选OSPF功能(参见第4.5节)在DBD包的Options字段中传输给邻居。路由器应在整个数据库交换和洪泛过程中保持相同的包可选功能。如果由于某种原因,路由器的可选功能发生变化,则应通过恢复到邻居状态ExStart来重新启动数据库Exchange过程。本规范中定义了一种可选能力(见第4.5节和第A.2节)。当且仅当所连接的网络属于非末节区域时,应设置E位。Options字段中无法识别的位应设置为零。

    The router's optional OSPF capabilities (see Section 4.5) are
    transmitted to the neighbor in the Options field of the Database
    Description packet.  The router should maintain the same set of
    optional capabilities throughout the Database Exchange and
    flooding procedures.  If for some reason the router's optional
    capabilities change, the Database Exchange procedure should be
    restarted by reverting to neighbor state ExStart.  One optional
    capability is defined in this specification (see Sections 4.5
    and A.2). The E-bit should be set if and only if the attached
    network belongs to a non-stub area. Unrecognized bits in the
    Options field should be set to zero.

DBD包的发送取决于邻居的状态。在ExStart状态下,路由器发送空的DBD包,并设置了初始化(I)、更多(M)和主(MS)位。这些数据包每RxmtInterval秒重传一次。

    The sending of Database Description packets depends on the
    neighbor's state.  In state ExStart the router sends empty
    Database Description packets, with the initialize (I), more (M)
    and master (MS) bits set.  These packets are retransmitted every
    RxmtInterval seconds.

在状态Exchange中,DBD包实际上包含路由器数据库中包含的链路状态信息的摘要。该区域链路状态数据库中的每个LSA(在邻居转换到Exchange状态时)都列在邻居数据库摘要列表中。每个新的DBD包从邻居数据结构复制其DD序列号,然后描述数据库摘要列表的当前顶部。确认上一个数据包后,将从数据库摘要列表中删除项目。

    In state Exchange the Database Description Packets actually
    contain summaries of the link state information contained in the
    router's database.  Each LSA in the area's link-state database
    (at the time the neighbor transitions into Exchange state) is
    listed in the neighbor Database summary list.  Each new Database
    Description Packet copies its DD sequence number from the
    neighbor data structure and then describes the current top of
    the Database summary list.  Items are removed from the Database
    summary list when the previous packet is acknowledged.

在状态交换中,何时发送数据库描述数据包取决于路由器是主路由器还是从路由器:

主设备
当a)从设备通过回显DD序列号确认前一个DBD包,或b)每Rxmt间隔秒过去而没有确认时,发送DBD包。

从设备
DBD包仅响应发送于从主设备接收的DBD包。如果从主设备接收的DBD是新的,则发送新的DBD包,否则重新发送先前的数DBD包。

    In state Exchange, the determination of when to send a Database
    Description packet depends on whether the router is master or
    slave:

    Master
        Database Description packets are sent when either a) the
        slave acknowledges the previous Database Description packet
        by echoing the DD sequence number or b) RxmtInterval seconds
        elapse without an acknowledgment, in which case the previous
        Database Description packet is retransmitted.

    Slave
        Database Description packets are sent only in response to
        Database Description packets received from the master.  If
        the Database Description packet received from the master is
        new, a new Database Description packet is sent, otherwise
        the previous Database Description packet is resent.

在Loading和 Full状态下,从设备必须重新发送其最后一个DBD包,以响应从主设备接收到的重复数据库描述包。因此,从设备必须等待RouterDeadInterval秒,然后才能释放最后一个DBD包。在此间隔之后主设备接收DBD包将生成SeqNumberMismatch邻居事件。

    In states Loading and Full the slave must resend its last
    Database Description packet in response to duplicate Database
    Description packets received from the master.  For this reason
    the slave must wait RouterDeadInterval seconds before freeing
    the last Database Description packet.  Reception of a Database
    Description packet from the master after this interval will
    generate a SeqNumberMismatch neighbor event.

10.9.发送LSR包

在邻居状态Exchange或Loading中,LSR列表包含一系列需要从邻居获得的那些LSA的列表。为了请求这些LSA,路由器向邻居发送LSR列表的开头,该列表封装在LSR包中。

    In neighbor states Exchange or Loading, the Link state request
    list contains a list of those LSAs that need to be obtained from
    the neighbor.  To request these LSAs, a router sends the
    neighbor the beginning of the Link state request list, packaged
    in a Link State Request packet.

--------------------------------------------------------------------[Page 104]

当邻居用正确的LSU包响应这些请求时,LSR列表被截断,并发送新的LSR包。此过程将继续,直到LSR列表变为空。LSR列表上已被请求但尚未接收的LSA被打包成LSR分组,以便以RxmtInterval的间隔进行重传。在任何时候,最多应该有一个LSR数据包未完成。

    When the neighbor responds to these requests with the proper
    Link State Update packet(s), the Link state request list is
    truncated and a new Link State Request packet is sent.  This
    process continues until the Link state request list becomes
    empty. LSAs on the Link state request list that have been
    requested, but not yet received, are packaged into Link State
    Request packets for retransmission at intervals of RxmtInterval.
    There should be at most one Link State Request packet
    outstanding at any one time.

当LSR列表变空,并且邻居状态为Loading(即,已向邻居发送和从邻居接收到完整的DBD包序列)时,将生成Loading Done邻居事件。
When the Link state request list becomes empty, and the neighbor
state is Loading (i.e., a complete sequence of Database
description packets has been sent to and received from the
neighbor), the Loading Done neighbor event is generated.

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值