home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / rfc / rfc2178 < prev    next >
Text File  |  1997-07-24  |  496KB  |  11,820 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                             J. Moy
  8. Request for Comments: 2178                  Cascade Communications Corp.
  9. Obsoletes: 1583                                                July 1997
  10. Category: Standards Track
  11.  
  12.  
  13.                              OSPF Version 2
  14.  
  15. Status of this Memo
  16.  
  17.    This document specifies an Internet standards track protocol for the
  18.    Internet community, and requests discussion and suggestions for
  19.    improvements.  Please refer to the current edition of the "Internet
  20.    Official Protocol Standards" (STD 1) for the standardization state
  21.    and status of this protocol.  Distribution of this memo is unlimited.
  22.  
  23. Abstract
  24.  
  25.    This memo documents version 2 of the OSPF protocol. OSPF is a link-
  26.    state routing protocol.  It is designed to be run internal to a
  27.    single Autonomous System.  Each OSPF router maintains an identical
  28.    database describing the Autonomous System's topology.  From this
  29.    database, a routing table is calculated by constructing a shortest-
  30.    path tree.
  31.  
  32.    OSPF recalculates routes quickly in the face of topological changes,
  33.    utilizing a minimum of routing protocol traffic.  OSPF provides
  34.    support for equal-cost multipath.  An area routing capability is
  35.    provided, enabling an additional level of routing protection and a
  36.    reduction in routing protocol traffic.  In addition, all OSPF routing
  37.    protocol exchanges are authenticated.
  38.  
  39.    The differences between this memo and RFC 1583 are explained in
  40.    Appendix G. All differences are backward-compatible in nature.
  41.    Implementations of this memo and of RFC 1583 will interoperate.
  42.  
  43.    Please send comments to ospf@gated.cornell.edu.
  44.  
  45. Table of Contents
  46.  
  47.     1        Introduction ........................................... 5
  48.     1.1      Protocol Overview ...................................... 5
  49.     1.2      Definitions of commonly used terms ..................... 6
  50.     1.3      Brief history of link-state routing technology ........  9
  51.     1.4      Organization of this document ......................... 10
  52.     1.5      Acknowledgments ....................................... 11
  53.     2        The link-state database: organization and calculations  11
  54.     2.1      Representation of routers and networks ................ 11
  55.  
  56.  
  57.  
  58. Moy                         Standards Track                     [Page 1]
  59.  
  60. RFC 2178                     OSPF Version 2                    July 1997
  61.  
  62.  
  63.     2.1.1    Representation of non-broadcast networks .............. 13
  64.     2.1.2    An example link-state database ........................ 14
  65.     2.2      The shortest-path tree ................................ 18
  66.     2.3      Use of external routing information ................... 20
  67.     2.4      Equal-cost multipath .................................. 22
  68.     3        Splitting the AS into Areas ........................... 22
  69.     3.1      The backbone of the Autonomous System ................. 23
  70.     3.2      Inter-area routing .................................... 23
  71.     3.3      Classification of routers ............................. 24
  72.     3.4      A sample area configuration ........................... 25
  73.     3.5      IP subnetting support ................................. 31
  74.     3.6      Supporting stub areas ................................. 32
  75.     3.7      Partitions of areas ................................... 33
  76.     4        Functional Summary .................................... 34
  77.     4.1      Inter-area routing .................................... 35
  78.     4.2      AS external routes .................................... 35
  79.     4.3      Routing protocol packets .............................. 35
  80.     4.4      Basic implementation requirements ..................... 38
  81.     4.5      Optional OSPF capabilities ............................ 39
  82.     5        Protocol data structures .............................. 40
  83.     6        The Area Data Structure ............................... 42
  84.     7        Bringing Up Adjacencies ............................... 44
  85.     7.1      The Hello Protocol .................................... 44
  86.     7.2      The Synchronization of Databases ...................... 45
  87.     7.3      The Designated Router ................................. 46
  88.     7.4      The Backup Designated Router .......................... 47
  89.     7.5      The graph of adjacencies .............................. 48
  90.     8        Protocol Packet Processing ............................ 49
  91.     8.1      Sending protocol packets .............................. 49
  92.     8.2      Receiving protocol packets ............................ 51
  93.     9        The Interface Data Structure .......................... 54
  94.     9.1      Interface states ...................................... 57
  95.     9.2      Events causing interface state changes ................ 59
  96.     9.3      The Interface state machine ........................... 61
  97.     9.4      Electing the Designated Router ........................ 64
  98.     9.5      Sending Hello packets ................................. 66
  99.     9.5.1    Sending Hello packets on NBMA networks ................ 67
  100.     10       The Neighbor Data Structure ........................... 68
  101.     10.1     Neighbor states ....................................... 70
  102.     10.2     Events causing neighbor state changes ................. 75
  103.     10.3     The Neighbor state machine ............................ 76
  104.     10.4     Whether tocome adjacent    ............................ 82
  105.     10.5     Receiving Hello Packets ............................... 83
  106.     10.6     Receiving Database Description Packets ................ 85
  107.     10.7     Receiving Link State Request Packets .................. 88
  108.     10.8     Sending Database Description Packets .................. 89
  109.     10.9     Sending Link State Request Packets .................... 90
  110.     10.10    An Example ............................................ 91
  111.  
  112.  
  113.  
  114. Moy                         Standards Track                     [Page 2]
  115.  
  116. RFC 2178                     OSPF Version 2                    July 1997
  117.  
  118.  
  119.     11       The Routing Table Structure ........................... 93
  120.     11.1     Routing table lookup .................................. 96
  121.     11.2     Sample routing table, without areas ................... 97
  122.     11.3     Sample routing table, with areas ...................... 97
  123.     12       Link State Advertisements (LSAs) ......................100
  124.     12.1     The LSA Header ........................................100
  125.     12.1.1   LS age ............................................... 101
  126.     12.1.2   Options .............................................. 101
  127.     12.1.3   LS type .............................................. 102
  128.     12.1.4   Link State ID ........................................ 102
  129.     12.1.5   Advertising Router ................................... 104
  130.     12.1.6   LS sequence number ................................... 104
  131.     12.1.7   LS checksum .......................................... 105
  132.     12.2     The link state database .............................. 105
  133.     12.3     Representation of TOS ................................ 106
  134.     12.4     Originating LSAs ..................................... 107
  135.     12.4.1   Router-LSAs .......................................... 110
  136.     12.4.1.1 Describing point-to-point interfaces ................. 112
  137.     12.4.1.2 Describing broadcast and NBMA interfaces ............. 113
  138.     12.4.1.3 Describing virtual links ............................. 113
  139.     12.4.1.4 Describing Point-to-MultiPoint interfaces ............ 114
  140.     12.4.1.5 Examples of router-LSAs .............................. 114
  141.     12.4.2   Network-LSAs ......................................... 116
  142.     12.4.2.1 Examples of network-LSAs ............................. 116
  143.     12.4.3   Summary-LSAs ......................................... 117
  144.     12.4.3.1 Originating summary-LSAs into stub areas ............. 119
  145.     12.4.3.2 Examples of summary-LSAs ............................. 119
  146.     12.4.4   AS-external-LSAs ..................................... 120
  147.     12.4.4.1 Examples of AS-external-LSAs ......................... 121
  148.     13       The Flooding Procedure ............................... 122
  149.     13.1     Determining which LSA is newer ....................... 126
  150.     13.2     Installing LSAs in the database ...................... 127
  151.     13.3     Next step in the flooding procedure .................. 128
  152.     13.4     Receiving self-originated LSAs ....................... 130
  153.     13.5     Sending Link State Acknowledgment packets ............ 131
  154.     13.6     Retransmitting LSAs .................................. 133
  155.     13.7     Receiving link state acknowledgments ................. 134
  156.     14       Aging The Link State Database ........................ 134
  157.     14.1     Premature aging of LSAs .............................. 135
  158.     15       Virtual Links ........................................ 135
  159.     16       Calculation of the routing table ..................... 137
  160.     16.1     Calculating the shortest-path tree for an area ....... 138
  161.     16.1.1   The next hop calculation ............................. 144
  162.     16.2     Calculating the inter-area routes .................... 145
  163.     16.3     Examining transit areas' summary-LSAs ................ 146
  164.     16.4     Calculating AS external routes ....................... 149
  165.     16.4.1   External path preferences ............................ 151
  166.     16.5     Incremental updates -- summary-LSAs .................. 151
  167.  
  168.  
  169.  
  170. Moy                         Standards Track                     [Page 3]
  171.  
  172. RFC 2178                     OSPF Version 2                    July 1997
  173.  
  174.  
  175.     16.6     Incremental updates -- AS-external-LSAs .............. 152
  176.     16.7     Events generated as a result of routing table changes  153
  177.     16.8     Equal-cost multipath ................................. 154
  178.              Footnotes ............................................ 155
  179.              References ........................................... 158
  180.     A        OSPF data formats .................................... 160
  181.     A.1      Encapsulation of OSPF packets ........................ 160
  182.     A.2      The Options field .................................... 162
  183.     A.3      OSPF Packet Formats .................................. 163
  184.     A.3.1    The OSPF packet header ............................... 164
  185.     A.3.2    The Hello packet ..................................... 166
  186.     A.3.3    The Database Description packet ...................... 168
  187.     A.3.4    The Link State Request packet ........................ 170
  188.     A.3.5    The Link State Update packet ......................... 171
  189.     A.3.6    The Link State Acknowledgment packet ................. 172
  190.     A.4      LSA formats .......................................... 173
  191.     A.4.1    The LSA header ....................................... 174
  192.     A.4.2    Router-LSAs .......................................... 176
  193.     A.4.3    Network-LSAs ......................................... 179
  194.     A.4.4    Summary-LSAs ......................................... 180
  195.     A.4.5    AS-external-LSAs ..................................... 182
  196.     B        Architectural Constants .............................. 184
  197.     C        Configurable Constants ............................... 186
  198.     C.1      Global parameters .................................... 186
  199.     C.2      Area parameters ...................................... 187
  200.     C.3      Router interface parameters .......................... 188
  201.     C.4      Virtual link parameters .............................. 190
  202.     C.5      NBMA network parameters .............................. 191
  203.     C.6      Point-to-MultiPoint network parameters ............... 191
  204.     C.7      Host route parameters ................................ 192
  205.     D        Authentication ....................................... 193
  206.     D.1      Null authentication .................................. 193
  207.     D.2      Simple password authentication ....................... 193
  208.     D.3      Cryptographic authentication ......................... 194
  209.     D.4      Message generation ................................... 196
  210.     D.4.1    Generating Null authentication ....................... 196
  211.     D.4.2    Generating Simple password authentication ............ 197
  212.     D.4.3    Generating Cryptographic authentication .............. 197
  213.     D.5      Message verification ................................. 198
  214.     D.5.1    Verifying Null authentication ........................ 199
  215.     D.5.2    Verifying Simple password authentication ............. 199
  216.     D.5.3    Verifying Cryptographic authentication ............... 199
  217.     E        An algorithm for assigning Link State IDs ............ 201
  218.     F        Multiple interfaces to the same network/subnet ....... 203
  219.     G        Differences from RFC 1583 ............................ 204
  220.     G.1      Enhancements to OSPF authentication .................. 204
  221.     G.2      Addition of Point-to-MultiPoint interface ............ 204
  222.     G.3      Support for overlapping area ranges .................. 205
  223.  
  224.  
  225.  
  226. Moy                         Standards Track                     [Page 4]
  227.  
  228. RFC 2178                     OSPF Version 2                    July 1997
  229.  
  230.  
  231.     G.4      A modification to the flooding algorithm ............. 206
  232.     G.5      Introduction of the MinLSArrival constant ............ 206
  233.     G.6      Optionally advertising point-to-point links as subnets 207
  234.     G.7      Advertising same external route from multiple areas .. 207
  235.     G.8      Retransmission of initial Database Description packets 209
  236.     G.9      Detecting interface MTU mismatches ................... 209
  237.     G.10     Deleting the TOS routing option ...................... 209
  238.              Security Considerations .............................. 210
  239.              Author's Address ..................................... 211
  240.  
  241. 1.  Introduction
  242.  
  243.    This document is a specification of the Open Shortest Path First
  244.    (OSPF) TCP/IP internet routing protocol.  OSPF is classified as an
  245.    Interior Gateway Protocol (IGP).  This means that it distributes
  246.    routing information between routers belonging to a single Autonomous
  247.    System.  The OSPF protocol is based on link-state or SPF technology.
  248.    This is a departure from the Bellman-Ford base used by traditional
  249.    TCP/IP internet routing protocols.
  250.  
  251.    The OSPF protocol was developed by the OSPF working group of the
  252.    Internet Engineering Task Force.  It has been designed expressly for
  253.    the TCP/IP internet environment, including explicit support for CIDR
  254.    and the tagging of externally-derived routing information. OSPF also
  255.    provides for the authentication of routing updates, and utilizes IP
  256.    multicast when sending/receiving the updates.  In addition, much work
  257.    has been done to produce a protocol that responds quickly to topology
  258.    changes, yet involves small amounts of routing protocol traffic.
  259.  
  260. 1.1.  Protocol overview
  261.  
  262.    OSPF routes IP packets based solely on the destination IP address
  263.    found in the IP packet header. IP packets are routed "as is" -- they
  264.    are not encapsulated in any further protocol headers as they transit
  265.    the Autonomous System. OSPF is a dynamic routing protocol.  It
  266.    quickly detects topological changes in the AS (such as router
  267.    interface failures) and calculates new loop-free routes after a
  268.    period of convergence.  This period of convergence is short and
  269.    involves a minimum of routing traffic.
  270.  
  271.    In a link-state routing protocol, each router maintains a database
  272.    describing the Autonomous System's topology.  This database is
  273.    referred to as the link-state database. Each participating router has
  274.    an identical database.  Each individual piece of this database is a
  275.    particular router's local state (e.g., the router's usable interfaces
  276.    and reachable neighbors).  The router distributes its local state
  277.    throughout the Autonomous System by flooding.
  278.  
  279.  
  280.  
  281.  
  282. Moy                         Standards Track                     [Page 5]
  283.  
  284. RFC 2178                     OSPF Version 2                    July 1997
  285.  
  286.  
  287.    All routers run the exact same algorithm, in parallel. From the
  288.    link-state database, each router constructs a tree of shortest paths
  289.    with itself as root.  This shortest-path tree gives the route to each
  290.    destination in the Autonomous System.  Externally derived routing
  291.    information appears on the tree as leaves.
  292.  
  293.    When several equal-cost routes to a destination exist, traffic is
  294.    distributed equally among them.  The cost of a route is described by
  295.    a single dimensionless metric.
  296.  
  297.    OSPF allows sets of networks to be grouped together.  Such a grouping
  298.    is called an area.  The topology of an area is hidden from the rest
  299.    of the Autonomous System.  This information hiding enables a
  300.    significant reduction in routing traffic.  Also, routing within the
  301.    area is determined only by the area's own topology, lending the area
  302.    protection from bad routing data.  An area is a generalization of an
  303.    IP subnetted network.
  304.  
  305.    OSPF enables the flexible configuration of IP subnets.  Each route
  306.    distributed by OSPF has a destination and mask.  Two different
  307.    subnets of the same IP network number may have different sizes (i.e.,
  308.    different masks).  This is commonly referred to as variable length
  309.    subnetting.  A packet is routed to the best (i.e., longest or most
  310.    specific) match.  Host routes are considered to be subnets whose
  311.    masks are "all ones" (0xffffffff).
  312.  
  313.    All OSPF protocol exchanges are authenticated.  This means that only
  314.    trusted routers can participate in the Autonomous System's routing.
  315.    A variety of authentication schemes can be used; in fact, separate
  316.    authentication schemes can be configured for each IP subnet.
  317.  
  318.    Externally derived routing data (e.g., routes learned from an
  319.    Exterior Gateway Protocol such as BGP; see [Ref23]) is advertised
  320.    throughout the Autonomous System.  This externally derived data is
  321.    kept separate from the OSPF protocol's link state data.  Each
  322.    external route can also be tagged by the advertising router, enabling
  323.    the passing of additional information between routers on the boundary
  324.    of the Autonomous System.
  325.  
  326. 1.2.  Definitions of commonly used terms
  327.  
  328.    This section provides definitions for terms that have a specific
  329.    meaning to the OSPF protocol and that are used throughout the text.
  330.    The reader unfamiliar with the Internet Protocol Suite is referred to
  331.    [Ref13] for an introduction to IP.
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Moy                         Standards Track                     [Page 6]
  339.  
  340. RFC 2178                     OSPF Version 2                    July 1997
  341.  
  342.  
  343.    Router
  344.       A level three Internet Protocol packet switch.  Formerly called a
  345.       gateway in much of the IP literature.
  346.  
  347.    Autonomous System
  348.       A group of routers exchanging routing information via a common
  349.       routing protocol.  Abbreviated as AS.
  350.  
  351.    Interior Gateway Protocol
  352.       The routing protocol spoken by the routers belonging to an
  353.       Autonomous system. Abbreviated as IGP.  Each Autonomous System has
  354.       a single IGP.  Separate Autonomous Systems may be running
  355.       different IGPs.
  356.  
  357.    Router ID
  358.       A 32-bit number assigned to each router running the OSPF protocol.
  359.       This number uniquely identifies the router within an Autonomous
  360.       System.
  361.  
  362.    Network
  363.       In this memo, an IP network/subnet/supernet.  It is possible for
  364.       one physical network to be assigned multiple IP network/subnet
  365.       numbers.  We consider these to be separate networks.  Point-to-
  366.       point physical networks are an exception - they are considered a
  367.       single network no matter how many (if any at all) IP
  368.       network/subnet numbers are assigned to them.
  369.  
  370.    Network mask
  371.       A 32-bit number indicating the range of IP addresses residing on a
  372.       single IP network/subnet/supernet.  This specification displays
  373.       network masks as hexadecimal numbers.  For example, the network
  374.       mask for a class C IP network is displayed as 0xffffff00.  Such a
  375.       mask is often displayed elsewhere in the literature as
  376.       255.255.255.0.
  377.  
  378.    Point-to-point networks
  379.       A network that joins a single pair of routers.  A 56Kb serial line
  380.       is an example of a point-to-point network.
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Moy                         Standards Track                     [Page 7]
  395.  
  396. RFC 2178                     OSPF Version 2                    July 1997
  397.  
  398.  
  399.    Broadcast networks
  400.       Networks supporting many (more than two) attached routers,
  401.       together with the capability to address a single physical message
  402.       to all of the attached routers (broadcast).  Neighboring routers
  403.       are discovered dynamically on these nets using OSPF's Hello
  404.       Protocol.  The Hello Protocol itself takes advantage of the
  405.       broadcast capability.  The OSPF protocol makes further use of
  406.       multicast capabilities, if they exist.  Each pair of routers on a
  407.       broadcast network is assumed to be able to communicate directly.
  408.       An ethernet is an example of a broadcast network.
  409.  
  410.    Non-broadcast networks
  411.       Networks supporting many (more than two) routers, but having no
  412.       broadcast capability.  Neighboring routers are maintained on these
  413.       nets using OSPF's Hello Protocol. However, due to the lack of
  414.       broadcast capability, some configuration information may be
  415.       necessary to aid in the discovery of neighbors. On non-broadcast
  416.       networks, OSPF protocol packets that are normally multicast need
  417.       to be sent to each neighboring router, in turn. An X.25 Public
  418.       Data Network (PDN) is an example of a non-broadcast network.
  419.  
  420.       OSPF runs in one of two modes over non-broadcast networks.  The
  421.       first mode, called non-broadcast multi-access or NBMA, simulates
  422.       the operation of OSPF on a broadcast network. The second mode,
  423.       called Point-to-MultiPoint, treats the non-broadcast network as a
  424.       collection of point-to-point links.  Non-broadcast networks are
  425.       referred to as NBMA networks or Point-to-MultiPoint networks,
  426.       depending on OSPF's mode of operation over the network.
  427.  
  428.    Interface
  429.       The connection between a router and one of its attached networks.
  430.       An interface has state information associated with it, which is
  431.       obtained from the underlying lower level protocols and the routing
  432.       protocol itself.  An interface to a network has associated with it
  433.       a single IP address and mask (unless the network is an unnumbered
  434.       point-to-point network).  An interface is sometimes also referred
  435.       to as a link.
  436.  
  437.    Neighboring routers
  438.       Two routers that have interfaces to a common network.  Neighbor
  439.       relationships are maintained by, and usually dynamically
  440.       discovered by, OSPF's Hello Protocol.
  441.  
  442.    Adjacency
  443.       A relationship formed between selected neighboring routers for the
  444.       purpose of exchanging routing information.  Not every pair of
  445.       neighboring routers become adjacent.
  446.  
  447.  
  448.  
  449.  
  450. Moy                         Standards Track                     [Page 8]
  451.  
  452. RFC 2178                     OSPF Version 2                    July 1997
  453.  
  454.  
  455.    Link state advertisement
  456.       Unit of data describing the local state of a router or network.
  457.       For a router, this includes the state of the router's interfaces
  458.       and adjacencies.  Each link state advertisement is flooded
  459.       throughout the routing domain. The collected link state
  460.       advertisements of all routers and networks forms the protocol's
  461.       link state database.  Throughout this memo, link state
  462.       advertisement is abbreviated as LSA.
  463.  
  464.    Hello Protocol
  465.       The part of the OSPF protocol used to establish and maintain
  466.       neighbor relationships.  On broadcast networks the Hello Protocol
  467.       can also dynamically discover neighboring routers.
  468.  
  469.    Flooding
  470.       The part of the OSPF protocol that distributes and synchronizes
  471.       the link-state database between OSPF routers.
  472.  
  473.    Designated Router
  474.       Each broadcast and NBMA network that has at least two attached
  475.       routers has a Designated Router.  The Designated Router generates
  476.       an LSA for the network and has other special responsibilities in
  477.       the running of the protocol.  The Designated Router is elected by
  478.       the Hello Protocol.
  479.  
  480.       The Designated Router concept enables a reduction in the number of
  481.       adjacencies required on a broadcast or NBMA network.  This in turn
  482.       reduces the amount of routing protocol traffic and the size of the
  483.       link-state database.
  484.  
  485.    Lower-level protocols
  486.       The underlying network access protocols that provide services to
  487.       the Internet Protocol and in turn the OSPF protocol.  Examples of
  488.       these are the X.25 packet and frame levels for X.25 PDNs, and the
  489.       ethernet data link layer for ethernets.
  490.  
  491. 1.3.  Brief history of link-state routing technology
  492.  
  493.    OSPF is a link state routing protocol.  Such protocols are also
  494.    referred to in the literature as SPF-based or distributed-database
  495.    protocols.  This section gives a brief description of the
  496.    developments in link-state technology that have influenced the OSPF
  497.    protocol.
  498.  
  499.    The first link-state routing protocol was developed for use in the
  500.    ARPANET packet switching network.  This protocol is described in
  501.    [Ref3].  It has formed the starting point for all other link-state
  502.    protocols.  The homogeneous ARPANET environment, i.e., single-vendor
  503.  
  504.  
  505.  
  506. Moy                         Standards Track                     [Page 9]
  507.  
  508. RFC 2178                     OSPF Version 2                    July 1997
  509.  
  510.  
  511.    packet switches connected by synchronous serial lines, simplified the
  512.    design and implementation of the original protocol.
  513.  
  514.    Modifications to this protocol were proposed in [Ref4].  These
  515.    modifications dealt with increasing the fault tolerance of the
  516.    routing protocol through, among other things, adding a checksum to
  517.    the LSAs (thereby detecting database corruption).  The paper also
  518.    included means for reducing the routing traffic overhead in a link-
  519.    state protocol.  This was accomplished by introducing mechanisms
  520.    which enabled the interval between LSA originations to be increased
  521.    by an order of magnitude.
  522.  
  523.    A link-state algorithm has also been proposed for use as an ISO IS-IS
  524.    routing protocol.  This protocol is described in [Ref2].  The
  525.    protocol includes methods for data and routing traffic reduction when
  526.    operating over broadcast networks.  This is accomplished by election
  527.    of a Designated Router for each broadcast network, which then
  528.    originates an LSA for the network.
  529.  
  530.    The OSPF Working Group of the IETF has extended this work in
  531.    developing the OSPF protocol.  The Designated Router concept has been
  532.    greatly enhanced to further reduce the amount of routing traffic
  533.    required.  Multicast capabilities are utilized for additional routing
  534.    bandwidth reduction.  An area routing scheme has been developed
  535.    enabling information hiding/protection/reduction.  Finally, the
  536.    algorithms have been tailored for efficient operation in TCP/IP
  537.    internets.
  538.  
  539. 1.4.  Organization of this document
  540.  
  541.    The first three sections of this specification give a general
  542.    overview of the protocol's capabilities and functions.  Sections 4-16
  543.    explain the protocol's mechanisms in detail.  Packet formats,
  544.    protocol constants and configuration items are specified in the
  545.    appendices.
  546.  
  547.    Labels such as HelloInterval encountered in the text refer to
  548.    protocol constants.  They may or may not be configurable.
  549.    Architectural constants are summarized in Appendix B.  Configurable
  550.    constants are summarized in Appendix C.
  551.  
  552.    The detailed specification of the protocol is presented in terms of
  553.    data structures.  This is done in order to make the explanation more
  554.    precise.  Implementations of the protocol are required to support the
  555.    functionality described, but need not use the precise data structures
  556.    that appear in this memo.
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Moy                         Standards Track                    [Page 10]
  563.  
  564. RFC 2178                     OSPF Version 2                    July 1997
  565.  
  566.  
  567. 1.5.  Acknowledgments
  568.  
  569.    The author would like to thank Ran Atkinson, Fred Baker, Jeffrey
  570.    Burgan, Rob Coltun, Dino Farinacci, Vince Fuller, Phanindra
  571.    Jujjavarapu, Milo Medin, Tom Pusateri, Kannan Varadhan, Zhaohui Zhang
  572.    and the rest of the OSPF Working Group for the ideas and support they
  573.    have given to this project.
  574.  
  575.    The OSPF Point-to-MultiPoint interface is based on work done by Fred
  576.    Baker.
  577.  
  578.    The OSPF Cryptographic Authentication option was developed by Fred
  579.    Baker and Ran Atkinson.
  580.  
  581. 2.  The Link-state Database: organization and calculations
  582.  
  583.    The following subsections describe the organization of OSPF's link-
  584.    state database, and the routing calculations that are performed on
  585.    the database in order to produce a router's routing table.
  586.  
  587. 2.1.  Representation of routers and networks
  588.  
  589.    The Autonomous System's link-state database describes a directed
  590.    graph.  The vertices of the graph consist of routers and networks.  A
  591.    graph edge connects two routers when they are attached via a physical
  592.    point-to-point network.  An edge connecting a router to a network
  593.    indicates that the router has an interface on the network. Networks
  594.    can be either transit or stub networks. Transit networks are those
  595.    capable of carrying data traffic that is neither locally originated
  596.    nor locally destined. A transit network is represented by a graph
  597.    vertex having both incoming and outgoing edges. A stub network's
  598.    vertex has only incoming edges.
  599.  
  600.    The neighborhood of each network node in the graph depends on the
  601.    network's type (point-to-point, broadcast, NBMA or Point-to-
  602.    MultiPoint) and the number of routers having an interface to the
  603.    network.  Three cases are depicted in Figure 1a.  Rectangles indicate
  604.    routers.  Circles and oblongs indicate networks.  Router names are
  605.    prefixed with the letters RT and network names with the letter N.
  606.    Router interface names are prefixed by the letter I.  Lines between
  607.    routers indicate point-to-point networks.  The left side of the
  608.    figure shows networks with their connected routers, with the
  609.    resulting graphs shown on the right.
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618. Moy                         Standards Track                    [Page 11]
  619.  
  620. RFC 2178                     OSPF Version 2                    July 1997
  621.  
  622.  
  623.                                                   **FROM**
  624.  
  625.                                            *      |RT1|RT2|
  626.                 +---+Ia    +---+           *   ------------
  627.                 |RT1|------|RT2|           T   RT1|   | X |
  628.                 +---+    Ib+---+           O   RT2| X |   |
  629.                                            *    Ia|   | X |
  630.                                            *    Ib| X |   |
  631.  
  632.                     Physical point-to-point networks
  633.  
  634.                                                   **FROM**
  635.                       +---+                *
  636.                       |RT7|                *      |RT7| N3|
  637.                       +---+                T   ------------
  638.                         |                  O   RT7|   |   |
  639.             +----------------------+       *    N3| X |   |
  640.                        N3                  *
  641.  
  642.                              Stub networks
  643.  
  644.                 +---+      +---+
  645.                 |RT3|      |RT4|              |RT3|RT4|RT5|RT6|N2 |
  646.                 +---+      +---+        *  ------------------------
  647.                   |    N2    |          *  RT3|   |   |   |   | X |
  648.             +----------------------+    T  RT4|   |   |   |   | X |
  649.                   |          |          O  RT5|   |   |   |   | X |
  650.                 +---+      +---+        *  RT6|   |   |   |   | X |
  651.                 |RT5|      |RT6|        *   N2| X | X | X | X |   |
  652.                 +---+      +---+
  653.  
  654.                        Broadcast or NBMA networks
  655.  
  656.                    Figure 1a: Network map components
  657.  
  658.    Networks and routers are represented by vertices.  An edge connects
  659.    Vertex A to Vertex B iff the intersection of Column A and Row B is
  660.    marked with an X.
  661.  
  662.    The top of Figure 1a shows two routers connected by a point-to-point
  663.    link. In the resulting link-state database graph, the two router
  664.    vertices are directly connected by a pair of edges, one in each
  665.    direction. Interfaces to point-to-point networks need not be assigned
  666.    IP addresses.  When interface addresses are assigned, they are
  667.    modelled as stub links, with each router advertising a stub
  668.    connection to the other router's interface address. Optionally, an IP
  669.  
  670.  
  671.  
  672.  
  673.  
  674. Moy                         Standards Track                    [Page 12]
  675.  
  676. RFC 2178                     OSPF Version 2                    July 1997
  677.  
  678.  
  679.    subnet can be assigned to the point-to-point network. In this case,
  680.    both routers advertise a stub link to the IP subnet, instead of
  681.    advertising each others' IP interface addresses.
  682.  
  683.    The middle of Figure 1a shows a network with only one attached router
  684.    (i.e., a stub network). In this case, the network appears on the end
  685.    of a stub connection in the link-state database's graph.
  686.  
  687.    When multiple routers are attached to a broadcast network, the link-
  688.    state database graph shows all routers bidirectionally connected to
  689.    the network vertex. This is pictured at the bottom of Figure 1a.
  690.  
  691.    Each network (stub or transit) in the graph has an IP address and
  692.    associated network mask.  The mask indicates the number of nodes on
  693.    the network.  Hosts attached directly to routers (referred to as host
  694.    routes) appear on the graph as stub networks.  The network mask for a
  695.    host route is always 0xffffffff, which indicates the presence of a
  696.    single node.
  697.  
  698. 2.1.1. Representation of non-broadcast networks
  699.  
  700.    As mentioned previously, OSPF can run over non-broadcast networks in
  701.    one of two modes: NBMA or Point-to-MultiPoint.  The choice of mode
  702.    determines the way that the Hello protocol and flooding work over the
  703.    non-broadcast network, and the way that the network is represented in
  704.    the link-state database.
  705.  
  706.    In NBMA mode, OSPF emulates operation over a broadcast network: a
  707.    Designated Router is elected for the NBMA network, and the Designated
  708.    Router originates an LSA for the network. The graph representation
  709.    for broadcast networks and NBMA networks is identical. This
  710.    representation is pictured in the middle of Figure 1a.
  711.  
  712.    NBMA mode is the most efficient way to run OSPF over non-broadcast
  713.    networks, both in terms of link-state database size and in terms of
  714.    the amount of routing protocol traffic.  However, it has one
  715.    significant restriction: it requires all routers attached to the NBMA
  716.    network to be able to communicate directly. This restriction may be
  717.    met on some non-broadcast networks, such as an ATM subnet utilizing
  718.    SVCs. But it is often not met on other non-broadcast networks, such
  719.    as PVC-only Frame Relay networks. On non-broadcast networks where not
  720.    all routers can communicate directly you can break the non-broadcast
  721.    network into logical subnets, with the routers on each subnet being
  722.    able to communicate directly, and then run each separate subnet as an
  723.    NBMA network (see [Ref15]). This however requires quite a bit of
  724.    administrative overhead, and is prone to misconfiguration. It is
  725.    probably better to run such a non-broadcast network in Point-to-
  726.    Multipoint mode.
  727.  
  728.  
  729.  
  730. Moy                         Standards Track                    [Page 13]
  731.  
  732. RFC 2178                     OSPF Version 2                    July 1997
  733.  
  734.  
  735.    In Point-to-MultiPoint mode, OSPF treats all router-to-router
  736.    connections over the non-broadcast network as if they were point-to-
  737.    point links. No Designated Router is elected for the network, nor is
  738.    there an LSA generated for the network. In fact, a vertex for the
  739.    Point-to-MultiPoint network does not appear in the graph of the
  740.    link-state database.
  741.  
  742.    Figure 1b illustrates the link-state database representation of a
  743.    Point-to-MultiPoint network. On the left side of the figure, a
  744.    Point-to-MultiPoint network is pictured. It is assumed that all
  745.    routers can communicate directly, except for routers RT4 and RT5. I3
  746.    though I6 indicate the routers' IP interface addresses on the Point-
  747.    to-MultiPoint network.  In the graphical representation of the link-
  748.    state database, routers that can communicate directly over the
  749.    Point-to-MultiPoint network are joined by bidirectional edges, and
  750.    each router also has a stub connection to its own IP interface
  751.    address (which is in contrast to the representation of real point-
  752.    to-point links; see Figure 1a).
  753.  
  754.    On some non-broadcast networks, use of Point-to-MultiPoint mode and
  755.    data-link protocols such as Inverse ARP (see [Ref14]) will allow
  756.    autodiscovery of OSPF neighbors even though broadcast support is not
  757.    available.
  758.  
  759. 2.1.2.  An example link-state database
  760.  
  761.    Figure 2 shows a sample map of an Autonomous System.  The rectangle
  762.    labelled H1 indicates a host, which has a SLIP connection to Router
  763.    RT12. Router RT12 is therefore advertising a host route.  Lines
  764.    between routers indicate physical point-to-point networks.  The only
  765.    point-to-point network that has been assigned interface addresses is
  766.    the one joining Routers RT6 and RT10.  Routers RT5 and RT7 have BGP
  767.    connections to other Autonomous Systems.  A set of BGP-learned routes
  768.    have been displayed for both of these routers.
  769.  
  770.    A cost is associated with the output side of each router interface.
  771.    This cost is configurable by the system administrator.  The lower the
  772.    cost,the more likely the interface is to be used to forward data
  773.    traffic.  Costs are also associated with the externally derived
  774.    routing data (e.g., the BGP-learned routes).
  775.  
  776.    The directed graph resulting from the map in Figure 2 is depicted in
  777.    Figure 3.  Arcs are labelled with the cost of the corresponding
  778.    router output interface. Arcs having no labelled cost have a cost of
  779.    0.  Note that arcs leading from networks to routers always have cost
  780.    0; they are significant nonetheless.  Note also that the externally
  781.    derived routing data appears on the graph as stubs.
  782.  
  783.  
  784.  
  785.  
  786. Moy                         Standards Track                    [Page 14]
  787.  
  788. RFC 2178                     OSPF Version 2                    July 1997
  789.  
  790.  
  791.                                                   **FROM**
  792.                 +---+      +---+
  793.                 |RT3|      |RT4|              |RT3|RT4|RT5|RT6|
  794.                 +---+      +---+        *  --------------------
  795.                 I3|    N2    |I4        *  RT3|   | X | X | X |
  796.             +----------------------+    T  RT4| X |   |   | X |
  797.                 I5|          |I6        O  RT5| X |   |   | X |
  798.                 +---+      +---+        *  RT6| X | X | X |   |
  799.                 |RT5|      |RT6|        *   I3| X |   |   |   |
  800.                 +---+      +---+            I4|   | X |   |   |
  801.                                             I5|   |   | X |   |
  802.                                             I6|   |   |   | X |
  803.  
  804.  
  805.                    Figure 1b: Network map components
  806.                       Point-to-MultiPoint networks
  807.  
  808.           All routers can communicate directly over N2, except
  809.              routers RT4 and RT5. I3 through I6 indicate IP
  810.                           interface addresses
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Moy                         Standards Track                    [Page 15]
  843.  
  844. RFC 2178                     OSPF Version 2                    July 1997
  845.  
  846.  
  847.                  +
  848.                  | 3+---+                     N12      N14
  849.                N1|--|RT1|\ 1                    \ N13 /
  850.                  |  +---+ \                     8\ |8/8
  851.                  +         \ ____                 \|/
  852.                             /    \   1+---+8    8+---+6
  853.                            *  N3  *---|RT4|------|RT5|--------+
  854.                             \____/    +---+      +---+        |
  855.                   +         /   |                  |7         |
  856.                   | 3+---+ /    |                  |          |
  857.                 N2|--|RT2|/1    |1                 |6         |
  858.                   |  +---+    +---+8            6+---+        |
  859.                   +           |RT3|--------------|RT6|        |
  860.                               +---+              +---+        |
  861.                                 |2               Ia|7         |
  862.                                 |                  |          |
  863.                            +---------+             |          |
  864.                                N4                  |          |
  865.                                                    |          |
  866.                                                    |          |
  867.                        N11                         |          |
  868.                    +---------+                     |          |
  869.                         |                          |          |    N12
  870.                         |3                         |          |6 2/
  871.                       +---+                        |        +---+/
  872.                       |RT9|                        |        |RT7|---N15
  873.                       +---+                        |        +---+ 9
  874.                         |1                   +     |          |1
  875.                        _|__                  |   Ib|5       __|_
  876.                       /    \      1+----+2   |  3+----+1   /    \
  877.                      *  N9  *------|RT11|----|---|RT10|---*  N6  *
  878.                       \____/       +----+    |   +----+    \____/
  879.                         |                    |                |
  880.                         |1                   +                |1
  881.              +--+   10+----+                N8              +---+
  882.              |H1|-----|RT12|                                |RT8|
  883.              +--+SLIP +----+                                +---+
  884.                         |2                                    |4
  885.                         |                                     |
  886.                    +---------+                            +--------+
  887.                        N10                                    N7
  888.  
  889.                   Figure 2: A sample Autonomous System
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Moy                         Standards Track                    [Page 16]
  899.  
  900. RFC 2178                     OSPF Version 2                    July 1997
  901.  
  902.  
  903.                                 **FROM**
  904.  
  905.                  |RT|RT|RT|RT|RT|RT|RT|RT|RT|RT|RT|RT|
  906.                  |1 |2 |3 |4 |5 |6 |7 |8 |9 |10|11|12|N3|N6|N8|N9|
  907.               ----- ---------------------------------------------
  908.               RT1|  |  |  |  |  |  |  |  |  |  |  |  |0 |  |  |  |
  909.               RT2|  |  |  |  |  |  |  |  |  |  |  |  |0 |  |  |  |
  910.               RT3|  |  |  |  |  |6 |  |  |  |  |  |  |0 |  |  |  |
  911.               RT4|  |  |  |  |8 |  |  |  |  |  |  |  |0 |  |  |  |
  912.               RT5|  |  |  |8 |  |6 |6 |  |  |  |  |  |  |  |  |  |
  913.               RT6|  |  |8 |  |7 |  |  |  |  |5 |  |  |  |  |  |  |
  914.               RT7|  |  |  |  |6 |  |  |  |  |  |  |  |  |0 |  |  |
  915.           *   RT8|  |  |  |  |  |  |  |  |  |  |  |  |  |0 |  |  |
  916.           *   RT9|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |0 |
  917.           T  RT10|  |  |  |  |  |7 |  |  |  |  |  |  |  |0 |0 |  |
  918.           O  RT11|  |  |  |  |  |  |  |  |  |  |  |  |  |  |0 |0 |
  919.           *  RT12|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |0 |
  920.           *    N1|3 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
  921.                N2|  |3 |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
  922.                N3|1 |1 |1 |1 |  |  |  |  |  |  |  |  |  |  |  |  |
  923.                N4|  |  |2 |  |  |  |  |  |  |  |  |  |  |  |  |  |
  924.                N6|  |  |  |  |  |  |1 |1 |  |1 |  |  |  |  |  |  |
  925.                N7|  |  |  |  |  |  |  |4 |  |  |  |  |  |  |  |  |
  926.                N8|  |  |  |  |  |  |  |  |  |3 |2 |  |  |  |  |  |
  927.                N9|  |  |  |  |  |  |  |  |1 |  |1 |1 |  |  |  |  |
  928.               N10|  |  |  |  |  |  |  |  |  |  |  |2 |  |  |  |  |
  929.               N11|  |  |  |  |  |  |  |  |3 |  |  |  |  |  |  |  |
  930.               N12|  |  |  |  |8 |  |2 |  |  |  |  |  |  |  |  |  |
  931.               N13|  |  |  |  |8 |  |  |  |  |  |  |  |  |  |  |  |
  932.               N14|  |  |  |  |8 |  |  |  |  |  |  |  |  |  |  |  |
  933.               N15|  |  |  |  |  |  |9 |  |  |  |  |  |  |  |  |  |
  934.                H1|  |  |  |  |  |  |  |  |  |  |  |10|  |  |  |  |
  935.  
  936.  
  937.                  Figure 3: The resulting directed graph
  938.  
  939.            Networks and routers are represented by vertices.
  940.           An edge of cost X connects Vertex A to Vertex B iff
  941.             the intersection of Column A and Row B is marked
  942.                                with an X.
  943.  
  944.    The link-state database is pieced together from LSAs generated by the
  945.    routers.  In the associated graphical representation, the
  946.    neighborhood of each router or transit network is represented in a
  947.    single, separate LSA.  Figure 4 shows these LSAs graphically. Router
  948.    RT12 has an interface to two broadcast networks and a SLIP line to a
  949.    host.  Network N6 is a broadcast network with three attached routers.
  950.    The cost of all links from Network N6 to its attached routers is 0.
  951.  
  952.  
  953.  
  954. Moy                         Standards Track                    [Page 17]
  955.  
  956. RFC 2178                     OSPF Version 2                    July 1997
  957.  
  958.  
  959.    Note that the LSA for Network N6 is actually generated by one of the
  960.    network's attached routers: the router that has been elected
  961.    Designated Router for the network.
  962.  
  963. 2.2.  The shortest-path tree
  964.  
  965.    When no OSPF areas are configured, each router in the Autonomous
  966.    System has an identical link-state database, leading to an identical
  967.    graphical representation.  A router generates its routing table from
  968.    this graph by calculating a tree of shortest paths with the router
  969.    itself as root.  Obviously, the shortest- path tree depends on the
  970.    router doing the calculation.  The shortest-path tree for Router RT6
  971.    in our example is depicted in Figure 5.
  972.  
  973.    The tree gives the entire path to any destination network or host.
  974.    However, only the next hop to the destination is used in the
  975.    forwarding process.   Note also that the best route to any router has
  976.    also been calculated.  For the processing of external data, we note
  977.    the next hop and distance to any router advertising external routes.
  978.    The resulting routing table for Router RT6 is pictured in Table 2.
  979.    Note that there is a separate route for each end of a numbered
  980.    point-to-point network (in this case, the serial line between Routers
  981.    RT6 and RT10).
  982.  
  983.  
  984.                      **FROM**                       **FROM**
  985.  
  986.                   |RT12|N9|N10|H1|                 |RT9|RT11|RT12|N9|
  987.            *  --------------------          *  ----------------------
  988.            *  RT12|    |  |   |  |          *   RT9|   |    |    |0 |
  989.            T    N9|1   |  |   |  |          T  RT11|   |    |    |0 |
  990.            O   N10|2   |  |   |  |          O  RT12|   |    |    |0 |
  991.            *    H1|10  |  |   |  |          *    N9|   |    |    |  |
  992.            *                                *
  993.                 RT12's router-LSA              N9's network-LSA
  994.  
  995.                Figure 4: Individual link state components
  996.  
  997.            Networks and routers are represented by vertices.
  998.           An edge of cost X connects Vertex A to Vertex B iff
  999.             the intersection of Column A and Row B is marked
  1000.                                with an X.
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Moy                         Standards Track                    [Page 18]
  1011.  
  1012. RFC 2178                     OSPF Version 2                    July 1997
  1013.  
  1014.  
  1015.                                 RT6(origin)
  1016.                     RT5 o------------o-----------o Ib
  1017.                        /|\    6      |\     7
  1018.                      8/8|8\          | \
  1019.                      /  |  \        6|  \
  1020.                     o   |   o        |   \7
  1021.                    N12  o  N14       |    \
  1022.                        N13        2  |     \
  1023.                             N4 o-----o RT3  \
  1024.                                     /        \    5
  1025.                                   1/     RT10 o-------o Ia
  1026.                                   /           |\
  1027.                        RT4 o-----o N3        3| \1
  1028.                                 /|            |  \ N6     RT7
  1029.                                / |         N8 o   o---------o
  1030.                               /  |            |   |        /|
  1031.                          RT2 o   o RT1        |   |      2/ |9
  1032.                             /    |            |   |RT8   /  |
  1033.                            /3    |3      RT11 o   o     o   o
  1034.                           /      |            |   |    N12 N15
  1035.                       N2 o       o N1        1|   |4
  1036.                                               |   |
  1037.                                            N9 o   o N7
  1038.                                              /|
  1039.                                             / |
  1040.                         N11      RT9       /  |RT12
  1041.                          o--------o-------o   o--------o H1
  1042.                              3                |   10
  1043.                                               |2
  1044.                                               |
  1045.                                               o N10
  1046.  
  1047.  
  1048.                  Figure 5: The SPF tree for Router RT6
  1049.  
  1050.   Edges that are not marked with a cost have a cost of of zero (these
  1051.  are network-to-router links). Routes to networks N12-N15 are external
  1052.              information that is considered in Section 2.3
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Moy                         Standards Track                    [Page 19]
  1067.  
  1068. RFC 2178                     OSPF Version 2                    July 1997
  1069.  
  1070.  
  1071.            Destination   Next  Hop   Distance
  1072.            __________________________________
  1073.            N1            RT3         10
  1074.            N2            RT3         10
  1075.            N3            RT3         7
  1076.            N4            RT3         8
  1077.            Ib            *           7
  1078.            Ia            RT10        12
  1079.            N6            RT10        8
  1080.            N7            RT10        12
  1081.            N8            RT10        10
  1082.            N9            RT10        11
  1083.            N10           RT10        13
  1084.            N11           RT10        14
  1085.            H1            RT10        21
  1086.            __________________________________
  1087.            RT5           RT5         6
  1088.            RT7           RT10        8
  1089.  
  1090.     Table 2: The portion of Router RT6's routing table listing local
  1091.                              destinations.
  1092.  
  1093.    Routes to networks belonging to other AS'es (such as N12) appear as
  1094.    dashed lines on the shortest path tree in Figure 5.  Use of this
  1095.    externally derived routing information is considered in the next
  1096.    section.
  1097.  
  1098. 2.3.  Use of external routing information
  1099.  
  1100.    After the tree is created the external routing information is
  1101.    examined.  This external routing information may originate from
  1102.    another routing protocol such as BGP, or be statically configured
  1103.    (static routes).  Default routes can also be included as part of the
  1104.    Autonomous System's external routing information.
  1105.  
  1106.    External routing information is flooded unaltered throughout the AS.
  1107.    In our example, all the routers in the Autonomous System know that
  1108.    Router RT7 has two external routes, with metrics 2 and 9.
  1109.  
  1110.    OSPF supports two types of external metrics.  Type 1 external metrics
  1111.    are expressed in the same units as OSPF interface cost (i.e., in
  1112.    terms of the link state metric).  Type 2 external metrics are an
  1113.    order of magnitude larger; any Type 2 metric is considered greater
  1114.    than the cost of any path internal to the AS.  Use of Type 2 external
  1115.    metrics assumes that routing between AS'es is the major cost of
  1116.    routing a packet, and eliminates the need for conversion of external
  1117.    costs to internal link state metrics.
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Moy                         Standards Track                    [Page 20]
  1123.  
  1124. RFC 2178                     OSPF Version 2                    July 1997
  1125.  
  1126.  
  1127.    As an example of Type 1 external metric processing, suppose that the
  1128.    Routers RT7 and RT5 in Figure 2 are advertising Type 1 external
  1129.    metrics.  For each advertised external route, the total cost from
  1130.    Router RT6 is calculated as the sum of the external route's
  1131.    advertised cost and the distance from Router RT6 to the advertising
  1132.    router.  When two routers are advertising the same external
  1133.    destination, RT6 picks the advertising router providing the minimum
  1134.    total cost. RT6 then sets the next hop to the external destination
  1135.    equal to the next hop that would be used when routing packets to the
  1136.    chosen advertising router.
  1137.  
  1138.    In Figure 2, both Router RT5 and RT7 are advertising an external
  1139.    route to destination Network N12.  Router RT7 is preferred since it
  1140.    is advertising N12 at a distance of 10 (8+2) to Router RT6, which is
  1141.    better than Router RT5's 14 (6+8).  Table 3 shows the entries that
  1142.    are added to the routing table when external routes are examined:
  1143.  
  1144.  
  1145.  
  1146.                  Destination   Next  Hop   Distance
  1147.                  __________________________________
  1148.                  N12           RT10        10
  1149.                  N13           RT5         14
  1150.                  N14           RT5         14
  1151.                  N15           RT10        17
  1152.  
  1153.  
  1154.           Table 3: The portion of Router RT6's routing table
  1155.                      listing external destinations.
  1156.  
  1157.    Processing of Type 2 external metrics is simpler.  The AS boundary
  1158.    router advertising the smallest external metric is chosen, regardless
  1159.    of the internal distance to the AS boundary router.  Suppose in our
  1160.    example both Router RT5 and Router RT7 were advertising Type 2
  1161.    external routes.  Then all traffic destined for Network N12 would be
  1162.    forwarded to Router RT7, since 2 < 8. When several equal-cost Type 2
  1163.    routes exist, the internal distance to the advertising routers is
  1164.    used to break the tie.
  1165.  
  1166.    Both Type 1 and Type 2 external metrics can be present in the AS at
  1167.    the same time.  In that event, Type 1 external metrics always take
  1168.    precedence.
  1169.  
  1170.    This section has assumed that packets destined for external
  1171.    destinations are always routed through the advertising AS boundary
  1172.    router.  This is not always desirable.  For example, suppose in
  1173.    Figure 2 there is an additional router attached to Network N6, called
  1174.    Router RTX. Suppose further that RTX does not participate in OSPF
  1175.  
  1176.  
  1177.  
  1178. Moy                         Standards Track                    [Page 21]
  1179.  
  1180. RFC 2178                     OSPF Version 2                    July 1997
  1181.  
  1182.  
  1183.    routing, but does exchange BGP information with the AS boundary
  1184.    router RT7.  Then, Router RT7 would end up advertising OSPF external
  1185.    routes for all destinations that should be routed to RTX.  An extra
  1186.    hop will sometimes be introduced if packets for these destinations
  1187.    need always be routed first to Router RT7 (the advertising router).
  1188.  
  1189.    To deal with this situation, the OSPF protocol allows an AS boundary
  1190.    router to specify a "forwarding address" in its AS- external-LSAs. In
  1191.    the above example, Router RT7 would specify RTX's IP address as the
  1192.    "forwarding address" for all those destinations whose packets should
  1193.    be routed directly to RTX.
  1194.  
  1195.    The "forwarding address" has one other application.  It enables
  1196.    routers in the Autonomous System's interior to function as "route
  1197.    servers".  For example, in Figure 2 the router RT6 could become a
  1198.    route server, gaining external routing information through a
  1199.    combination of static configuration and external routing protocols.
  1200.    RT6 would then start advertising itself as an AS boundary router, and
  1201.    would originate a collection of OSPF AS-external-LSAs.  In each AS-
  1202.    external-LSA, Router RT6 would specify the correct Autonomous System
  1203.    exit point to use for the destination through appropriate setting of
  1204.    the LSA's "forwarding address" field.
  1205.  
  1206. 2.4.  Equal-cost multipath
  1207.  
  1208.    The above discussion has been simplified by considering only a single
  1209.    route to any destination.  In reality, if multiple equal-cost routes
  1210.    to a destination exist, they are all discovered and used.  This
  1211.    requires no conceptual changes to the algorithm, and its discussion
  1212.    is postponed until we consider the tree-building process in more
  1213.    detail.
  1214.  
  1215.    With equal cost multipath, a router potentially has several available
  1216.    next hops towards any given destination.
  1217.  
  1218. 3.  Splitting the AS into Areas
  1219.  
  1220.    OSPF allows collections of contiguous networks and hosts to be
  1221.    grouped together.  Such a group, together with the routers having
  1222.    interfaces to any one of the included networks, is called an area.
  1223.    Each area runs a separate copy of the basic link-state routing
  1224.    algorithm. This means that each area has its own link-state database
  1225.    and corresponding graph, as explained in the previous section.
  1226.  
  1227.    The topology of an area is invisible from the outside of the area.
  1228.    Conversely, routers internal to a given area know nothing of the
  1229.    detailed topology external to the area.  This isolation of knowledge
  1230.    enables the protocol to effect a marked reduction in routing traffic
  1231.  
  1232.  
  1233.  
  1234. Moy                         Standards Track                    [Page 22]
  1235.  
  1236. RFC 2178                     OSPF Version 2                    July 1997
  1237.  
  1238.  
  1239.    as compared to treating the entire Autonomous System as a single
  1240.    link-state domain.
  1241.  
  1242.    With the introduction of areas, it is no longer true that all routers
  1243.    in the AS have an identical link-state database.  A router actually
  1244.    has a separate link-state database for each area it is connected to.
  1245.    (Routers connected to multiple areas are called area border routers).
  1246.    Two routers belonging to the same area have, for that area, identical
  1247.    area link-state databases.
  1248.  
  1249.    Routing in the Autonomous System takes place on two levels, depending
  1250.    on whether the source and destination of a packet reside in the same
  1251.    area (intra-area routing is used) or different areas (inter-area
  1252.    routing is used).  In intra-area routing, the packet is routed solely
  1253.    on information obtained within the area; no routing information
  1254.    obtained from outside the area can be used.  This protects intra-area
  1255.    routing from the injection of bad routing information.  We discuss
  1256.    inter-area routing in Section 3.2.
  1257.  
  1258. 3.1.  The backbone of the Autonomous System
  1259.  
  1260.    The OSPF backbone is the special OSPF Area 0 (often written as Area
  1261.    0.0.0.0, since OSPF Area ID's are typically formatted as IP
  1262.    addresses). The OSPF backbone always contains all area border
  1263.    routers. The backbone is responsible for distributing routing
  1264.    information between non-backbone areas. The backbone must be
  1265.    contiguous. However, it need not be physically contiguous; backbone
  1266.    connectivity can be established/maintained through the configuration
  1267.    of virtual links.
  1268.  
  1269.    Virtual links can be configured between any two backbone routers that
  1270.    have an interface to a common non-backbone area.  Virtual links
  1271.    belong to the backbone.  The protocol treats two routers joined by a
  1272.    virtual link as if they were connected by an unnumbered point-to-
  1273.    point backbone network.  On the graph of the backbone, two such
  1274.    routers are joined by arcs whose costs are the intra-area distances
  1275.    between the two routers.  The routing protocol traffic that flows
  1276.    along the virtual link uses intra-area routing only.
  1277.  
  1278. 3.2.  Inter-area routing
  1279.  
  1280.    When routing a packet between two non-backbone areas the backbone is
  1281.    used.  The path that the packet will travel can be broken up into
  1282.    three contiguous pieces: an intra-area path from the source to an
  1283.    area border router, a backbone path between the source and
  1284.    destination areas, and then another intra-area path to the
  1285.    destination.  The algorithm finds the set of such paths that have the
  1286.    smallest cost.
  1287.  
  1288.  
  1289.  
  1290. Moy                         Standards Track                    [Page 23]
  1291.  
  1292. RFC 2178                     OSPF Version 2                    July 1997
  1293.  
  1294.  
  1295.    Looking at this another way, inter-area routing can be pictured as 
  1296.    forcing a star configuration on the Autonomous System, with the
  1297.    backbone as hub and each of the non-backbone areas as spokes.
  1298.  
  1299.    The topology of the backbone dictates the backbone paths used between
  1300.    areas.  The topology of the backbone can be enhanced by adding
  1301.    virtual links.  This gives the system administrator some control over
  1302.    the routes taken by inter-area traffic.
  1303.  
  1304.    The correct area border router to use as the packet exits the source
  1305.    area is chosen in exactly the same way routers advertising external
  1306.    routes are chosen.  Each area border router in an area summarizes for
  1307.    the area its cost to all networks external to the area.  After the
  1308.    SPF tree is calculated for the area, routes to all inter-area
  1309.    destinations are calculated by examining the summaries of the area
  1310.    border routers.
  1311.  
  1312. 3.3.  Classification of routers
  1313.  
  1314.    Before the introduction of areas, the only OSPF routers having a
  1315.    specialized function were those advertising external routing
  1316.    information, such as Router RT5 in Figure 2.  When the AS is split
  1317.    into OSPF areas, the routers are further divided according to
  1318.    function into the following four overlapping categories:
  1319.  
  1320.  
  1321.    Internal routers
  1322.       A router with all directly connected networks belonging to the
  1323.       same area. These routers run a single copy of the basic routing
  1324.       algorithm.
  1325.  
  1326.    Area border routers
  1327.       A router that attaches to multiple areas.  Area border routers run
  1328.       multiple copies of the basic algorithm, one copy for each attached
  1329.       area. Area border routers condense the topological information of
  1330.       their attached areas for distribution to the backbone.  The
  1331.       backbone in turn distributes the information to the other areas.
  1332.  
  1333.    Backbone routers
  1334.       A router that has an interface to the backbone area.  This
  1335.       includes all routers that interface to more than one area (i.e.,
  1336.       area border routers).  However, backbone routers do not have to be
  1337.       area border routers.  Routers with all interfaces connecting to
  1338.       the backbone area are supported.
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Moy                         Standards Track                    [Page 24]
  1347.  
  1348. RFC 2178                     OSPF Version 2                    July 1997
  1349.  
  1350.  
  1351.    AS boundary routers
  1352.       A router that exchanges routing information with routers belonging
  1353.       to other Autonomous Systems.  Such a router advertises AS external
  1354.       routing information throughout the Autonomous System.  The paths
  1355.       to each AS boundary router are known by every router in the AS.
  1356.       This classification is completely independent of the previous
  1357.       classifications: AS boundary routers may be internal or area
  1358.       border routers, and may or may not participate in the backbone.
  1359.  
  1360. 3.4.  A sample area configuration
  1361.  
  1362.    Figure 6 shows a sample area configuration.  The first area consists
  1363.    of networks N1-N4, along with their attached routers RT1-RT4.  The
  1364.    second area consists of networks N6-N8, along with their attached
  1365.    routers RT7, RT8, RT10 and RT11.  The third area consists of networks
  1366.    N9-N11 and Host H1, along with their attached routers RT9, RT11 and
  1367.    RT12.  The third area has been configured so that networks N9-N11 and
  1368.    Host H1 will all be grouped into a single route, when advertised
  1369.    external to the area (see Section 3.5 for more details).
  1370.  
  1371.    In Figure 6, Routers RT1, RT2, RT5, RT6, RT8, RT9 and RT12 are
  1372.    internal routers.  Routers RT3, RT4, RT7, RT10 and RT11 are area
  1373.    border routers.  Finally, as before, Routers RT5 and RT7 are AS
  1374.    boundary routers.
  1375.  
  1376.    Figure 7 shows the resulting link-state database for the Area 1.  The
  1377.    figure completely describes that area's intra-area routing.
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Moy                         Standards Track                    [Page 25]
  1403.  
  1404. RFC 2178                     OSPF Version 2                    July 1997
  1405.  
  1406.  
  1407.              ...........................
  1408.              .   +                     .
  1409.              .   | 3+---+              .      N12      N14
  1410.              . N1|--|RT1|\ 1           .        \ N13 /
  1411.              .   |  +---+ \            .        8\ |8/8
  1412.              .   +         \ ____      .          \|/
  1413.              .              /    \   1+---+8    8+---+6
  1414.              .             *  N3  *---|RT4|------|RT5|--------+
  1415.              .              \____/    +---+      +---+        |
  1416.              .    +         /      \   .           |7         |
  1417.              .    | 3+---+ /        \  .           |          |
  1418.              .  N2|--|RT2|/1        1\ .           |6         |
  1419.              .    |  +---+            +---+8    6+---+        |
  1420.              .    +                   |RT3|------|RT6|        |
  1421.              .                        +---+      +---+        |
  1422.              .                      2/ .         Ia|7         |
  1423.              .                      /  .           |          |
  1424.              .             +---------+ .           |          |
  1425.              .Area 1           N4      .           |          |
  1426.              ...........................           |          |
  1427.           ..........................               |          |
  1428.           .            N11         .               |          |
  1429.           .        +---------+     .               |          |
  1430.           .             |          .               |          |    N12
  1431.           .             |3         .             Ib|5         |6 2/
  1432.           .           +---+        .             +----+     +---+/
  1433.           .           |RT9|        .    .........|RT10|.....|RT7|---N15.
  1434.           .           +---+        .    .        +----+     +---+ 9    .
  1435.           .             |1         .    .    +  /3    1\      |1       .
  1436.           .            _|__        .    .    | /        \   __|_       .
  1437.           .           /    \      1+----+2   |/          \ /    \      .
  1438.           .          *  N9  *------|RT11|----|            *  N6  *     .
  1439.           .           \____/       +----+    |             \____/      .
  1440.           .             |          .    .    |                |        .
  1441.           .             |1         .    .    +                |1       .
  1442.           .  +--+   10+----+       .    .   N8              +---+      .
  1443.           .  |H1|-----|RT12|       .    .                   |RT8|      .
  1444.           .  +--+SLIP +----+       .    .                   +---+      .
  1445.           .             |2         .    .                     |4       .
  1446.           .             |          .    .                     |        .
  1447.           .        +---------+     .    .                 +--------+   .
  1448.           .            N10         .    .                     N7       .
  1449.           .                        .    .Area 2                        .
  1450.           .Area 3                  .    ................................
  1451.           ..........................
  1452.  
  1453.                Figure 6: A sample OSPF area configuration
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Moy                         Standards Track                    [Page 26]
  1459.  
  1460. RFC 2178                     OSPF Version 2                    July 1997
  1461.  
  1462.  
  1463.    It also shows the complete view of the internet for the two internal
  1464.    routers RT1 and RT2.  It is the job of the area border routers, RT3
  1465.    and RT4, to advertise into Area 1 the distances to all destinations
  1466.    external to the area.  These are indicated in Figure 7 by the dashed
  1467.    stub routes.  Also, RT3 and RT4 must advertise into Area 1 the
  1468.    location of the AS boundary routers RT5 and RT7.  Finally, AS-
  1469.    external-LSAs from RT5 and RT7 are flooded throughout the entire AS,
  1470.    and in particular throughout Area 1.  These LSAs are included in Area
  1471.    1's database, and yield routes to Networks N12-N15.
  1472.  
  1473.    Routers RT3 and RT4 must also summarize Area 1's topology for
  1474.    distribution to the backbone.  Their backbone LSAs are shown in Table
  1475.    4.  These summaries show which networks are contained in Area 1
  1476.    (i.e., Networks N1-N4), and the distance to these networks from the
  1477.    routers RT3 and RT4 respectively.
  1478.  
  1479.    The link-state database for the backbone is shown in Figure 8.  The
  1480.    set of routers pictured are the backbone routers.  Router RT11 is a
  1481.    backbone router because it belongs to two areas.  In order to make
  1482.    the backbone connected, a virtual link has been configured between
  1483.    Routers R10 and R11.
  1484.  
  1485.    The area border routers RT3, RT4, RT7, RT10 and RT11 condense the
  1486.    routing information of their attached non-backbone areas for
  1487.    distribution via the backbone; these are the dashed stubs that appear
  1488.    in Figure 8.  Remember that the third area has been configured to
  1489.    condense Networks N9-N11 and Host H1 into a single route.  This
  1490.    yields a single dashed line for networks N9-N11 and Host H1 in Figure
  1491.    8.  Routers RT5 and RT7 are AS boundary routers; their externally
  1492.    derived information also appears on the graph in Figure 8 as stubs.
  1493.  
  1494.  
  1495.                      Network   RT3 adv.   RT4 adv.
  1496.                      _____________________________
  1497.                      N1        4          4
  1498.                      N2        4          4
  1499.                      N3        1          1
  1500.                      N4        2          3
  1501.  
  1502.               Table 4: Networks advertised to the backbone
  1503.                         by Routers RT3 and RT4.
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Moy                         Standards Track                    [Page 27]
  1515.  
  1516. RFC 2178                     OSPF Version 2                    July 1997
  1517.  
  1518.  
  1519.                           |RT|RT|RT|RT|RT|RT|
  1520.                           |1 |2 |3 |4 |5 |7 |N3|
  1521.                        ----- -------------------
  1522.                        RT1|  |  |  |  |  |  |0 |
  1523.                        RT2|  |  |  |  |  |  |0 |
  1524.                        RT3|  |  |  |  |  |  |0 |
  1525.                    *   RT4|  |  |  |  |  |  |0 |
  1526.                    *   RT5|  |  |14|8 |  |  |  |
  1527.                    T   RT7|  |  |20|14|  |  |  |
  1528.                    O    N1|3 |  |  |  |  |  |  |
  1529.                    *    N2|  |3 |  |  |  |  |  |
  1530.                    *    N3|1 |1 |1 |1 |  |  |  |
  1531.                         N4|  |  |2 |  |  |  |  |
  1532.                      Ia,Ib|  |  |20|27|  |  |  |
  1533.                         N6|  |  |16|15|  |  |  |
  1534.                         N7|  |  |20|19|  |  |  |
  1535.                         N8|  |  |18|18|  |  |  |
  1536.                  N9-N11,H1|  |  |29|36|  |  |  |
  1537.                        N12|  |  |  |  |8 |2 |  |
  1538.                        N13|  |  |  |  |8 |  |  |
  1539.                        N14|  |  |  |  |8 |  |  |
  1540.                        N15|  |  |  |  |  |9 |  |
  1541.  
  1542.                       Figure 7: Area 1's Database.
  1543.  
  1544.            Networks and routers are represented by vertices.
  1545.           An edge of cost X connects Vertex A to Vertex B iff
  1546.             the intersection of Column A and Row B is marked
  1547.                                with an X.
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Moy                         Standards Track                    [Page 28]
  1571.  
  1572. RFC 2178                     OSPF Version 2                    July 1997
  1573.  
  1574.  
  1575.                                                   **FROM**
  1576.  
  1577.                             |RT|RT|RT|RT|RT|RT|RT
  1578.                             |3 |4 |5 |6 |7 |10|11|
  1579.                          ------------------------
  1580.                          RT3|  |  |  |6 |  |  |  |
  1581.                          RT4|  |  |8 |  |  |  |  |
  1582.                          RT5|  |8 |  |6 |6 |  |  |
  1583.                          RT6|8 |  |7 |  |  |5 |  |
  1584.                          RT7|  |  |6 |  |  |  |  |
  1585.                      *  RT10|  |  |  |7 |  |  |2 |
  1586.                      *  RT11|  |  |  |  |  |3 |  |
  1587.                      T    N1|4 |4 |  |  |  |  |  |
  1588.                      O    N2|4 |4 |  |  |  |  |  |
  1589.                      *    N3|1 |1 |  |  |  |  |  |
  1590.                      *    N4|2 |3 |  |  |  |  |  |
  1591.                           Ia|  |  |  |  |  |5 |  |
  1592.                           Ib|  |  |  |7 |  |  |  |
  1593.                           N6|  |  |  |  |1 |1 |3 |
  1594.                           N7|  |  |  |  |5 |5 |7 |
  1595.                           N8|  |  |  |  |4 |3 |2 |
  1596.                    N9-N11,H1|  |  |  |  |  |  |11|
  1597.                          N12|  |  |8 |  |2 |  |  |
  1598.                          N13|  |  |8 |  |  |  |  |
  1599.                          N14|  |  |8 |  |  |  |  |
  1600.                          N15|  |  |  |  |9 |  |  |
  1601.  
  1602.                    Figure 8: The backbone's database.
  1603.  
  1604.            Networks and routers are represented by vertices.
  1605.           An edge of cost X connects Vertex A to Vertex B iff
  1606.             the intersection of Column A and Row B is marked
  1607.                                with an X.
  1608.  
  1609.    The backbone enables the exchange of summary information between area
  1610.    border routers.  Every area border router hears the area summaries
  1611.    from all other area border routers.  It then forms a picture of the
  1612.    distance to all networks outside of its area by examining the
  1613.    collected LSAs, and adding in the backbone distance to each
  1614.    advertising router.
  1615.  
  1616.    Again using Routers RT3 and RT4 as an example, the procedure goes as
  1617.    follows: They first calculate the SPF tree for the backbone.  This
  1618.    gives the distances to all other area border routers.  Also noted are
  1619.    the distances to networks (Ia and Ib) and AS boundary routers (RT5
  1620.    and RT7) that belong to the backbone.  This calculation is shown in
  1621.    Table 5.
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Moy                         Standards Track                    [Page 29]
  1627.  
  1628. RFC 2178                     OSPF Version 2                    July 1997
  1629.  
  1630.  
  1631.    Next, by looking at the area summaries from these area border
  1632.    routers, RT3 and RT4 can determine the distance to all networks
  1633.    outside their area.  These distances are then advertised internally
  1634.    to the area by RT3 and RT4.  The advertisements that Router RT3 and
  1635.    RT4 will make into Area 1 are shown in Table 6.  Note that Table 6
  1636.    assumes that an area range has been configured for the backbone which
  1637.    groups Ia and Ib into a single LSA.
  1638.  
  1639.    The information imported into Area 1 by Routers RT3 and RT4 enables
  1640.    an internal router, such as RT1, to choose an area border router
  1641.    intelligently.  Router RT1 would use RT4 for traffic to Network N6,
  1642.    RT3 for traffic to Network N10, and would load share between the two
  1643.    for traffic to Network N8.
  1644.  
  1645.                               dist  from   dist  from
  1646.                               RT3          RT4
  1647.                    __________________________________
  1648.                    to  RT3    *            21
  1649.                    to  RT4    22           *
  1650.                    to  RT7    20           14
  1651.                    to  RT10   15           22
  1652.                    to  RT11   18           25
  1653.                    __________________________________
  1654.                    to  Ia     20           27
  1655.                    to  Ib     15           22
  1656.                    __________________________________
  1657.                    to  RT5    14           8
  1658.                    to  RT7    20           14
  1659.  
  1660.                  Table 5: Backbone distances calculated
  1661.                         by Routers RT3 and RT4.
  1662.  
  1663.  
  1664.                    Destination   RT3 adv.   RT4 adv.
  1665.                    _________________________________
  1666.                    Ia,Ib         20         27
  1667.                    N6            16         15
  1668.                    N7            20         19
  1669.                    N8            18         18
  1670.                    N9-N11,H1     29         36
  1671.                    _________________________________
  1672.                    RT5           14         8
  1673.                    RT7           20         14
  1674.  
  1675.               Table 6: Destinations advertised into Area 1
  1676.                         by Routers RT3 and RT4.
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Moy                         Standards Track                    [Page 30]
  1683.  
  1684. RFC 2178                     OSPF Version 2                    July 1997
  1685.  
  1686.  
  1687.    Router RT1 can also determine in this manner the shortest path to the
  1688.    AS boundary routers RT5 and RT7.  Then, by looking at RT5 and RT7's
  1689.    AS-external-LSAs, Router RT1 can decide between RT5 or RT7 when
  1690.    sending to a destination in another Autonomous System (one of the
  1691.    networks N12-N15).
  1692.  
  1693.    Note that a failure of the line between Routers RT6 and RT10 will
  1694.    cause the backbone to become disconnected.  Configuring a virtual
  1695.    link between Routers RT7 and RT10 will give the backbone more
  1696.    connectivity and more resistance to such failures.
  1697.  
  1698. 3.5.  IP subnetting support
  1699.  
  1700.    OSPF attaches an IP address mask to each advertised route.  The mask
  1701.    indicates the range of addresses being described by the particular
  1702.    route.  For example, a summary-LSA for the destination 128.185.0.0
  1703.    with a mask of 0xffff0000 actually is describing a single route to
  1704.    the collection of destinations 128.185.0.0 - 128.185.255.255.
  1705.    Similarly, host routes are always advertised with a mask of
  1706.    0xffffffff, indicating the presence of only a single destination.
  1707.  
  1708.    Including the mask with each advertised destination enables the
  1709.    implementation of what is commonly referred to as variable-length
  1710.    subnetting.  This means that a single IP class A, B, or C network
  1711.    number can be broken up into many subnets of various sizes. For
  1712.    example, the network 128.185.0.0 could be broken up into 62
  1713.    variable-sized subnets: 15 subnets of size 4K, 15 subnets of size
  1714.    256, and 32 subnets of size 8.  Table 7 shows some of the resulting
  1715.    network addresses together with their masks.
  1716.  
  1717.  
  1718.                   Network address   IP address mask   Subnet size
  1719.                   _______________________________________________
  1720.                   128.185.16.0      0xfffff000        4K
  1721.                   128.185.1.0       0xffffff00        256
  1722.                   128.185.0.8       0xfffffff8        8
  1723.  
  1724.  
  1725.                    Table 7: Some sample subnet sizes.
  1726.  
  1727.  
  1728.    There are many possible ways of dividing up a class A, B, and C
  1729.    network into variable sized subnets.  The precise procedure for doing
  1730.    so is beyond the scope of this specification.  This specification
  1731.    however establishes the following guideline: When an IP packet is
  1732.    forwarded, it is always forwarded to the network that is the best
  1733.    match for the packet's destination.  Here best match is synonymous
  1734.    with the longest or most specific match.  For example, the default
  1735.  
  1736.  
  1737.  
  1738. Moy                         Standards Track                    [Page 31]
  1739.  
  1740. RFC 2178                     OSPF Version 2                    July 1997
  1741.  
  1742.  
  1743.    route with destination of 0.0.0.0 and mask 0x00000000 is always a
  1744.    match for every IP destination.  Yet it is always less specific than
  1745.    any other match.  Subnet masks must be assigned so that the best
  1746.    match for any IP destination is unambiguous.
  1747.  
  1748.    Attaching an address mask to each route also enables the support of
  1749.    IP supernetting. For example, a single physical network segment could
  1750.    be assigned the [address,mask] pair [192.9.4.0,0xfffffc00]. The
  1751.    segment would then be single IP network, containing addresses from
  1752.    the four consecutive class C network numbers 192.9.4.0 through
  1753.    192.9.7.0. Such addressing is now becoming commonplace with the
  1754.    advent of CIDR (see [Ref10]).
  1755.  
  1756.    In order to get better aggregation at area boundaries, area address
  1757.    ranges can be employed (see Section C.2 for more details).  Each
  1758.    address range is defined as an [address,mask] pair.  Many separate
  1759.    networks may then be contained in a single address range, just as a
  1760.    subnetted network is composed of many separate subnets.  Area border
  1761.    routers then summarize the area contents (for distribution to the
  1762.    backbone) by advertising a single route for each address range.  The
  1763.    cost of the route is the maximum cost to any of the networks falling
  1764.    in the specified range.
  1765.  
  1766.    For example, an IP subnetted network might be configured as a single
  1767.    OSPF area.  In that case, a single address range could be configured:
  1768.    a class A, B, or C network number along with its natural IP mask.
  1769.    Inside the area, any number of variable sized subnets could be
  1770.    defined.  However, external to the area a single route for the entire
  1771.    subnetted network would be distributed, hiding even the fact that the
  1772.    network is subnetted at all.  The cost of this route is the maximum
  1773.    of the set of costs to the component subnets.
  1774.  
  1775. 3.6.  Supporting stub areas
  1776.  
  1777.    In some Autonomous Systems, the majority of the link-state database
  1778.    may consist of AS-external-LSAs.  An OSPF AS-external-LSA is usually
  1779.    flooded throughout the entire AS.  However, OSPF allows certain areas
  1780.    to be configured as "stub areas".  AS-external-LSAs are not flooded
  1781.    into/throughout stub areas; routing to AS external destinations in
  1782.    these areas is based on a (per-area) default only.  This reduces the
  1783.    link-state database size, and therefore the memory requirements, for
  1784.    a stub area's internal routers.
  1785.  
  1786.    In order to take advantage of the OSPF stub area support, default
  1787.    routing must be used in the stub area.  This is accomplished as
  1788.    follows.  One or more of the stub area's area border routers must
  1789.    advertise a default route into the stub area via summary-LSAs.  These
  1790.    summary defaults are flooded throughout the stub area, but no
  1791.  
  1792.  
  1793.  
  1794. Moy                         Standards Track                    [Page 32]
  1795.  
  1796. RFC 2178                     OSPF Version 2                    July 1997
  1797.  
  1798.  
  1799.    further.  (For this reason these defaults pertain only to the
  1800.    particular stub area).  These summary default routes will be used for
  1801.    any destination that is not explicitly reachable by an intra-area or
  1802.    inter-area path (i.e., AS external destinations).
  1803.  
  1804.    An area can be configured as a stub when there is a single exit point
  1805.    from the area, or when the choice of exit point need not be made on a
  1806.    per-external-destination basis.  For example, Area 3 in Figure 6
  1807.    could be configured as a stub area, because all external traffic must
  1808.    travel though its single area border router RT11.  If Area 3 were
  1809.    configured as a stub, Router RT11 would advertise a default route for
  1810.    distribution inside Area 3 (in a summary-LSA), instead of flooding
  1811.    the AS-external-LSAs for Networks N12-N15 into/throughout the area.
  1812.  
  1813.    The OSPF protocol ensures that all routers belonging to an area agree
  1814.    on whether the area has been configured as a stub.  This guarantees
  1815.    that no confusion will arise in the flooding of AS-external-LSAs.
  1816.  
  1817.    There are a couple of restrictions on the use of stub areas.  Virtual
  1818.    links cannot be configured through stub areas.  In addition, AS
  1819.    boundary routers cannot be placed internal to stub areas.
  1820.  
  1821. 3.7.  Partitions of areas
  1822.  
  1823.    OSPF does not actively attempt to repair area partitions.  When an
  1824.    area becomes partitioned, each component simply becomes a separate
  1825.    area.  The backbone then performs routing between the new areas.
  1826.    Some destinations reachable via intra-area routing before the
  1827.    partition will now require inter-area routing.
  1828.  
  1829.    However, in order to maintain full routing after the partition, an
  1830.    address range must not be split across multiple components of the
  1831.    area partition. Also, the backbone itself must not partition.  If it
  1832.    does, parts of the Autonomous System will become unreachable.
  1833.    Backbone partitions can be repaired by configuring virtual links (see
  1834.    Section 15).
  1835.  
  1836.    Another way to think about area partitions is to look at the
  1837.    Autonomous System graph that was introduced in Section 2.  Area IDs
  1838.    can be viewed as colors for the graph's edges.[1] Each edge of the
  1839.    graph connects to a network, or is itself a point-to-point network.
  1840.    In either case, the edge is colored with the network's Area ID.
  1841.  
  1842.    A group of edges, all having the same color, and interconnected by
  1843.    vertices, represents an area.  If the topology of the Autonomous
  1844.    System is intact, the graph will have several regions of color, each
  1845.    color being a distinct Area ID.
  1846.  
  1847.  
  1848.  
  1849.  
  1850. Moy                         Standards Track                    [Page 33]
  1851.  
  1852. RFC 2178                     OSPF Version 2                    July 1997
  1853.  
  1854.  
  1855.    When the AS topology changes, one of the areas may become
  1856.    partitioned.  The graph of the AS will then have multiple regions of
  1857.    the same color (Area ID).  The routing in the Autonomous System will
  1858.    continue to function as long as these regions of same color are
  1859.    connected by the single backbone region.
  1860.  
  1861. 4.  Functional Summary
  1862.  
  1863.    A separate copy of OSPF's basic routing algorithm runs in each area.
  1864.    Routers having interfaces to multiple areas run multiple copies of
  1865.    the algorithm.  A brief summary of the routing algorithm follows.
  1866.  
  1867.    When a router starts, it first initializes the routing protocol data
  1868.    structures.  The router then waits for indications from the lower-
  1869.    level protocols that its interfaces are functional.
  1870.  
  1871.    A router then uses the OSPF's Hello Protocol to acquire neighbors.
  1872.    The router sends Hello packets to its neighbors, and in turn receives
  1873.    their Hello packets.  On broadcast and point-to-point networks, the
  1874.    router dynamically detects its neighboring routers by sending its
  1875.    Hello packets to the multicast address AllSPFRouters.  On non-
  1876.    broadcast networks, some configuration information may be necessary
  1877.    in order to discover neighbors.  On broadcast and NBMA networks the
  1878.    Hello Protocol also elects a Designated router for the network.
  1879.  
  1880.    The router will attempt to form adjacencies with some of its newly
  1881.    acquired neighbors.  Link-state databases are synchronized between
  1882.    pairs of adjacent routers. On broadcast and NBMA networks, the
  1883.    Designated Router determines which routers should become adjacent.
  1884.  
  1885.    Adjacencies control the distribution of routing information.  Routing
  1886.    updates are sent and received only on adjacencies.
  1887.  
  1888.    A router periodically advertises its state, which is also called link
  1889.    state.  Link state is also advertised when a router's state changes.
  1890.    A router's adjacencies are reflected in the contents of its LSAs.
  1891.    This relationship between adjacencies and link state allows the
  1892.    protocol to detect dead routers in a timely fashion.
  1893.  
  1894.    LSAs are flooded throughout the area.  The flooding algorithm is
  1895.    reliable, ensuring that all routers in an area have exactly the same
  1896.    link-state database.  This database consists of the collection of
  1897.    LSAs originated by each router belonging to the area.  From this
  1898.    database each router calculates a shortest-path tree, with itself as
  1899.    root.  This shortest-path tree in turn yields a routing table for the
  1900.    protocol.
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906. Moy                         Standards Track                    [Page 34]
  1907.  
  1908. RFC 2178                     OSPF Version 2                    July 1997
  1909.  
  1910.  
  1911. 4.1.  Inter-area routing
  1912.  
  1913.    The previous section described the operation of the protocol within a
  1914.    single area.  For intra-area routing, no other routing information is
  1915.    pertinent.  In order to be able to route to destinations outside of
  1916.    the area, the area border routers inject additional routing
  1917.    information into the area.  This additional information is a
  1918.    distillation of the rest of the Autonomous System's topology.
  1919.  
  1920.    This distillation is accomplished as follows: Each area border router
  1921.    is by definition connected to the backbone.  Each area border router
  1922.    summarizes the topology of its attached non-backbone areas for
  1923.    transmission on the backbone, and hence to all other area border
  1924.    routers. An area border router then has complete topological
  1925.    information concerning the backbone, and the area summaries from each
  1926.    of the other area border routers.  From this information, the router
  1927.    calculates paths to all inter-area destinations.  The router then
  1928.    advertises these paths into its attached areas.  This enables the
  1929.    area's internal routers to pick the best exit router when forwarding
  1930.    traffic inter-area destinations.
  1931.  
  1932. 4.2.  AS external routes
  1933.  
  1934.    Routers that have information regarding other Autonomous Systems can
  1935.    flood this information throughout the AS.  This external routing
  1936.    information is distributed verbatim to every participating router.
  1937.    There is one exception: external routing information is not flooded
  1938.    into "stub" areas (see Section 3.6).
  1939.  
  1940.    To utilize external routing information, the path to all routers
  1941.    advertising external information must be known throughout the AS
  1942.    (excepting the stub areas).  For that reason, the locations of these
  1943.    AS boundary routers are summarized by the (non-stub) area border
  1944.    routers.
  1945.  
  1946. 4.3.  Routing protocol packets
  1947.  
  1948.    The OSPF protocol runs directly over IP, using IP protocol 89.  OSPF
  1949.    does not provide any explicit fragmentation/reassembly support.  When
  1950.    fragmentation is necessary, IP fragmentation/reassembly is used.
  1951.    OSPF protocol packets have been designed so that large protocol
  1952.    packets can generally be split into several smaller protocol packets.
  1953.    This practice is recommended; IP fragmentation should be avoided
  1954.    whenever possible.
  1955.  
  1956.    Routing protocol packets should always be sent with the IP TOS field
  1957.    set to 0.  If at all possible, routing protocol packets should be
  1958.    given preference over regular IP data traffic, both when being sent
  1959.  
  1960.  
  1961.  
  1962. Moy                         Standards Track                    [Page 35]
  1963.  
  1964. RFC 2178                     OSPF Version 2                    July 1997
  1965.  
  1966.  
  1967.    and received.  As an aid to accomplishing this, OSPF protocol packets
  1968.    should have their IP precedence field set to the value Internetwork
  1969.    Control (see [Ref5]).
  1970.  
  1971.    All OSPF protocol packets share a common protocol header that is
  1972.    described in Appendix A.  The OSPF packet types are listed below in
  1973.    Table 8.  Their formats are also described in Appendix A.
  1974.  
  1975.  
  1976.      Type   Packet  name
  1977.            Protocol  function
  1978.      __________________________________________________________
  1979.      1      Hello                  Discover/maintain  neighbors
  1980.      2      Database Description   Summarize database contents
  1981.      3      Link State Request     Database download
  1982.      4      Link State Update      Database update
  1983.      5      Link State Ack         Flooding acknowledgment
  1984.  
  1985.  
  1986.                       Table 8: OSPF packet types.
  1987.  
  1988.    OSPF's Hello protocol uses Hello packets to discover and maintain
  1989.    neighbor relationships.  The Database Description and Link State
  1990.    Request packets are used in the forming of adjacencies.  OSPF's
  1991.    reliable update mechanism is implemented by the Link State Update and
  1992.    Link State Acknowledgment packets.
  1993.  
  1994.    Each Link State Update packet carries a set of new link state
  1995.    advertisements (LSAs) one hop further away from their point of
  1996.    origination.  A single Link State Update packet may contain the LSAs
  1997.    of several routers.  Each LSA is tagged with the ID of the
  1998.    originating router and a checksum of its link state contents.  Each
  1999.    LSA also has a type field; the different types of OSPF LSAs are
  2000.    listed below in Table 9.
  2001.  
  2002.    OSPF routing packets (with the exception of Hellos) are sent only
  2003.    over adjacencies.  This means that all OSPF protocol packets travel a
  2004.    single IP hop, except those that are sent over virtual adjacencies.
  2005.    The IP source address of an OSPF protocol packet is one end of a
  2006.    router adjacency, and the IP destination address is either the other
  2007.    end of the adjacency or an IP multicast address.
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Moy                         Standards Track                    [Page 36]
  2019.  
  2020. RFC 2178                     OSPF Version 2                    July 1997
  2021.  
  2022.  
  2023.         LS     LSA                LSA description
  2024.         type   name
  2025.         ________________________________________________________
  2026.         1      Router-LSAs        Originated by all routers.
  2027.                                   This LSA describes
  2028.                                   the collected states of the
  2029.                                   router's interfaces to an
  2030.                                   area. Flooded throughout a
  2031.                                   single area only.
  2032.         ________________________________________________________
  2033.         2      Network-LSAs       Originated for broadcast
  2034.                                   and NBMA networks by
  2035.                                   the Designated Router. This
  2036.                                   LSA contains the
  2037.                                   list of routers connected
  2038.                                   to the network. Flooded
  2039.                                   throughout a single area only.
  2040.         ________________________________________________________
  2041.         3,4    Summary-LSAs       Originated by area border
  2042.                                   routers, and flooded through-
  2043.                                   out the LSA's associated
  2044.                                   area. Each summary-LSA
  2045.                                   describes a route to a
  2046.                                   destination outside the area,
  2047.                                   yet still inside the AS
  2048.                                   (i.e., an inter-area route).
  2049.                                   Type 3 summary-LSAs describe
  2050.                                   routes to networks. Type 4
  2051.                                   summary-LSAs describe
  2052.                                   routes to AS boundary routers.
  2053.         ________________________________________________________
  2054.         5      AS-external-LSAs   Originated by AS boundary
  2055.                                   routers, and flooded through-
  2056.                                   out the AS. Each
  2057.                                   AS-external-LSA describes
  2058.                                   a route to a destination in
  2059.                                   another Autonomous System.
  2060.                                   Default routes for the AS can
  2061.                                   also be described by
  2062.                                   AS-external-LSAs.
  2063.  
  2064.             Table 9: OSPF link state advertisements (LSAs).
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Moy                         Standards Track                    [Page 37]
  2075.  
  2076. RFC 2178                     OSPF Version 2                    July 1997
  2077.  
  2078.  
  2079. 4.4.  Basic implementation requirements
  2080.  
  2081.    An implementation of OSPF requires the following pieces of system
  2082.    support:
  2083.  
  2084.    Timers
  2085.       Two different kind of timers are required. The first kind, called
  2086.       "single shot timers", fire once and cause a protocol event to be
  2087.       processed.  The second kind, called "interval timers", fire at
  2088.       continuous intervals.  These are used for the sending of packets
  2089.       at regular intervals.  A good example of this is the regular
  2090.       broadcast of Hello packets. The granularity of both kinds of
  2091.       timers is one second.
  2092.  
  2093.       Interval timers should be implemented to avoid drift.  In some
  2094.       router implementations, packet processing can affect timer
  2095.       execution.  When multiple routers are attached to a single
  2096.       network, all doing broadcasts, this can lead to the
  2097.       synchronization of routing packets (which should be avoided).  If
  2098.       timers cannot be implemented to avoid drift, small random amounts
  2099.       should be added to/subtracted from the interval timer at each
  2100.       firing.
  2101.  
  2102.    IP multicast
  2103.       Certain OSPF packets take the form of IP multicast datagrams.
  2104.       Support for receiving and sending IP multicast datagrams, along
  2105.       with the appropriate lower-level protocol support, is required.
  2106.       The IP multicast datagrams used by OSPF never travel more than one
  2107.       hop. For this reason, the ability to forward IP multicast
  2108.       datagrams is not required.  For information on IP multicast, see
  2109.       [Ref7].
  2110.  
  2111.    Variable-length subnet support
  2112.       The router's IP protocol support must include the ability to
  2113.       divide a single IP class A, B, or C network number into many
  2114.       subnets of various sizes.  This is commonly called variable-length
  2115.       subnetting; see Section 3.5 for details.
  2116.  
  2117.    IP supernetting support
  2118.       The router's IP protocol support must include the ability to
  2119.       aggregate contiguous collections of IP class A, B, and C networks
  2120.       into larger quantities called supernets.  Supernetting has been
  2121.       proposed as one way to improve the scaling of IP routing in the
  2122.       worldwide Internet. For more information on IP supernetting, see
  2123.       [Ref10].
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Moy                         Standards Track                    [Page 38]
  2131.  
  2132. RFC 2178                     OSPF Version 2                    July 1997
  2133.  
  2134.  
  2135.    Lower-level protocol support
  2136.       The lower level protocols referred to here are the network access
  2137.       protocols, such as the Ethernet data link layer.  Indications must
  2138.       be passed from these protocols to OSPF as the network interface
  2139.       goes up and down.  For example, on an ethernet it would be
  2140.       valuable to know when the ethernet transceiver cable becomes
  2141.       unplugged.
  2142.  
  2143.    Non-broadcast lower-level protocol support
  2144.       On non-broadcast networks, the OSPF Hello Protocol can be aided by
  2145.       providing an indication when an attempt is made to send a packet
  2146.       to a dead or non-existent router.  For example, on an X.25 PDN a
  2147.       dead neighboring router may be indicated by the reception of a
  2148.       X.25 clear with an appropriate cause and diagnostic, and this
  2149.       information would be passed to OSPF.
  2150.  
  2151.    List manipulation primitives
  2152.       Much of the OSPF functionality is described in terms of its
  2153.       operation on lists of LSAs.  For example, the collection of LSAs
  2154.       that will be retransmitted to an adjacent router until
  2155.       acknowledged are described as a list.  Any particular LSA may be
  2156.       on many such lists.  An OSPF implementation needs to be able to
  2157.       manipulate these lists, adding and deleting constituent LSAs as
  2158.       necessary.
  2159.  
  2160.    Tasking support
  2161.       Certain procedures described in this specification invoke other
  2162.       procedures.  At times, these other procedures should be executed
  2163.       in-line, that is, before the current procedure is finished.  This
  2164.       is indicated in the text by instructions to execute a procedure.
  2165.       At other times, the other procedures are to be executed only when
  2166.       the current procedure has finished.  This is indicated by
  2167.       instructions to schedule a task.
  2168.  
  2169. 4.5.  Optional OSPF capabilities
  2170.  
  2171.    The OSPF protocol defines several optional capabilities.  A router
  2172.    indicates the optional capabilities that it supports in its OSPF
  2173.    Hello packets, Database Description packets and in its LSAs.  This
  2174.    enables routers supporting a mix of optional capabilities to coexist
  2175.    in a single Autonomous System.
  2176.  
  2177.    Some capabilities must be supported by all routers attached to a
  2178.    specific area.  In this case, a router will not accept a neighbor's
  2179.    Hello Packet unless there is a match in reported capabilities (i.e.,
  2180.    a capability mismatch prevents a neighbor relationship from forming).
  2181.    An example of this is the ExternalRoutingCapability (see below).
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Moy                         Standards Track                    [Page 39]
  2187.  
  2188. RFC 2178                     OSPF Version 2                    July 1997
  2189.  
  2190.  
  2191.    Other capabilities can be negotiated during the Database Exchange
  2192.    process.  This is accomplished by specifying the optional
  2193.    capabilities in Database Description packets.  A capability mismatch
  2194.    with a neighbor in this case will result in only a subset of the link
  2195.    state database being exchanged between the two neighbors.
  2196.  
  2197.    The routing table build process can also be affected by the
  2198.    presence/absence of optional capabilities.  For example, since the
  2199.    optional capabilities are reported in LSAs, routers incapable of
  2200.    certain functions can be avoided when building the shortest path
  2201.    tree.
  2202.  
  2203.    The OSPF optional capabilities defined in this memo are listed below.
  2204.    See Section A.2 for more information.
  2205.  
  2206.    ExternalRoutingCapability
  2207.       Entire OSPF areas can be configured as "stubs" (see Section 3.6).
  2208.       AS-external-LSAs will not be flooded into stub areas.  This
  2209.       capability is represented by the E-bit in the OSPF Options field
  2210.       (see Section A.2).  In order to ensure consistent configuration of
  2211.       stub areas, all routers interfacing to such an area must have the
  2212.       E-bit clear in their Hello packets (see Sections 9.5 and 10.5).
  2213.  
  2214. 5.  Protocol Data Structures
  2215.  
  2216.    The OSPF protocol is described herein in terms of its operation on
  2217.    various protocol data structures.  The following list comprises the
  2218.    top-level OSPF data structures.  Any initialization that needs to be
  2219.    done is noted.  OSPF areas, interfaces and neighbors also have
  2220.    associated data structures that are described later in this
  2221.    specification.
  2222.  
  2223.    Router ID
  2224.       A 32-bit number that uniquely identifies this router in the AS.
  2225.       One possible implementation strategy would be to use the smallest
  2226.       IP interface address belonging to the router. If a router's OSPF
  2227.       Router ID is changed, the router's OSPF software should be
  2228.       restarted before the new Router ID takes effect.  In this case the
  2229.       router should flush its self-originated LSAs from the routing
  2230.       domain (see Section 14.1) before restarting, or they will persist
  2231.       for up to MaxAge minutes.
  2232.  
  2233.    Area structures
  2234.       Each one of the areas to which the router is connected has its own
  2235.       data structure.  This data structure describes the working of the
  2236.       basic OSPF algorithm.  Remember that each area runs a separate
  2237.       copy of the basic OSPF algorithm.
  2238.  
  2239.  
  2240.  
  2241.  
  2242. Moy                         Standards Track                    [Page 40]
  2243.  
  2244. RFC 2178                     OSPF Version 2                    July 1997
  2245.  
  2246.  
  2247.    Backbone (area) structure
  2248.       The OSPF backbone area is responsible for the dissemination of
  2249.       inter-area routing information.
  2250.  
  2251.    Virtual links configured
  2252.       The virtual links configured with this router as one endpoint.  In
  2253.       order to have configured virtual links, the router itself must be
  2254.       an area border router.  Virtual links are identified by the Router
  2255.       ID of the other endpoint -- which is another area border router.
  2256.       These two endpoint routers must be attached to a common area,
  2257.       called the virtual link's Transit area.  Virtual links are part of
  2258.       the backbone, and behave as if they were unnumbered point-to-point
  2259.       networks between the two routers.  A virtual link uses the intra-
  2260.       area routing of its Transit area to forward packets.  Virtual
  2261.       links are brought up and down through the building of the
  2262.       shortest-path trees for the Transit area.
  2263.  
  2264.    List of external routes
  2265.       These are routes to destinations external to the Autonomous
  2266.       System, that have been gained either through direct experience
  2267.       with another routing protocol (such as BGP), or through
  2268.       configuration information, or through a combination of the two
  2269.       (e.g., dynamic external information to be advertised by OSPF with
  2270.       configured metric). Any router having these external routes is
  2271.       called an AS boundary router.  These routes are advertised by the
  2272.       router into the OSPF routing domain via AS-external-LSAs.
  2273.  
  2274.    List of AS-external-LSAs
  2275.       Part of the link-state database.  These have originated from the
  2276.       AS boundary routers.  They comprise routes to destinations
  2277.       external to the Autonomous System.  Note that, if the router is
  2278.       itself an AS boundary router, some of these AS-external-LSAs have
  2279.       been self-originated.
  2280.  
  2281.    The routing table
  2282.       Derived from the link-state database.  Each entry in the routing
  2283.       table is indexed by a destination, and contains the destination's
  2284.       cost and a set of paths to use in forwarding packets to the
  2285.       destination. A path is described by its type and next hop.  For
  2286.       more information, see Section 11.
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. Moy                         Standards Track                    [Page 41]
  2299.  
  2300. RFC 2178                     OSPF Version 2                    July 1997
  2301.  
  2302.  
  2303.    Figure 9 shows the collection of data structures present in a typical
  2304.    router.  The router pictured is RT10, from the map in Figure 6.  Note
  2305.    that Router RT10 has a virtual link configured to Router RT11, with
  2306.    Area 2 as the link's Transit area.  This is indicated by the dashed
  2307.    line in Figure 9.  When the virtual link becomes active, through the
  2308.    building of the shortest path tree for Area 2, it becomes an
  2309.    interface to the backbone (see the two backbone interfaces depicted
  2310.    in Figure 9).
  2311.  
  2312.  
  2313.                               +----+
  2314.                               |RT10|------+
  2315.                               +----+       \+-------------+
  2316.                              /      \       |Routing Table|
  2317.                             /        \      +-------------+
  2318.                            /          \
  2319.               +------+    /            \    +--------+
  2320.               |Area 2|---+              +---|Backbone|
  2321.               +------+***********+          +--------+
  2322.              /        \           *        /          \
  2323.             /          \           *      /            \
  2324.        +---------+  +---------+    +------------+       +------------+
  2325.        |Interface|  |Interface|    |Virtual Link|       |Interface Ib|
  2326.        |  to N6  |  |  to N8  |    |   to RT11  |       +------------+
  2327.        +---------+  +---------+    +------------+             |
  2328.            /  \           |               |                   |
  2329.           /    \          |               |                   |
  2330.    +--------+ +--------+  |        +-------------+      +------------+
  2331.    |Neighbor| |Neighbor|  |        |Neighbor RT11|      |Neighbor RT6|
  2332.    |  RT8   | |  RT7   |  |        +-------------+      +------------+
  2333.    +--------+ +--------+  |
  2334.                           |
  2335.                      +-------------+
  2336.                      |Neighbor RT11|
  2337.                      +-------------+
  2338.  
  2339.  
  2340.                 Figure 9: Router RT10's Data structures
  2341.  
  2342. 6.  The Area Data Structure
  2343.  
  2344.    The area data structure contains all the information used to run the
  2345.    basic OSPF routing algorithm. Each area maintains its own link-state
  2346.    database. A network belongs to a single area, and a router interface
  2347.    connects to a single area. Each router adjacency also belongs to a
  2348.    single area.
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Moy                         Standards Track                    [Page 42]
  2355.  
  2356. RFC 2178                     OSPF Version 2                    July 1997
  2357.  
  2358.  
  2359.    The OSPF backbone is the special OSPF area responsible for
  2360.    disseminating inter-area routing information.
  2361.  
  2362.    The area link-state database consists of the collection of router-
  2363.    LSAs, network-LSAs and summary-LSAs that have originated from the
  2364.    area's routers.  This information is flooded throughout a single area
  2365.    only. The list of AS-external-LSAs (see Section 5) is also considered
  2366.    to be part of each area's link-state database.
  2367.  
  2368.    Area ID
  2369.       A 32-bit number identifying the area. The Area ID of 0.0.0.0 is
  2370.       reserved for the backbone.
  2371.  
  2372.    List of area address ranges
  2373.       In order to aggregate routing information at area boundaries, area
  2374.       address ranges can be employed. Each address range is specified by
  2375.       an [address,mask] pair and a status indication of either Advertise
  2376.       or DoNotAdvertise (see Section 12.4.3).
  2377.  
  2378.    Associated router interfaces
  2379.       This router's interfaces connecting to the area.  A router
  2380.       interface belongs to one and only one area (or the backbone).  For
  2381.       the backbone area this list includes all the virtual links.  A
  2382.       virtual link is identified by the Router ID of its other endpoint;
  2383.       its cost is the cost of the shortest intra-area path through the
  2384.       Transit area that exists between the two routers.
  2385.  
  2386.    List of router-LSAs
  2387.       A router-LSA is generated by each router in the area.  It
  2388.       describes the state of the router's interfaces to the area.
  2389.  
  2390.    List of network-LSAs
  2391.       One network-LSA is generated for each transit broadcast and NBMA
  2392.       network in the area.  A network-LSA describes the set of routers
  2393.       currently connected to the network.
  2394.  
  2395.    List of summary-LSAs
  2396.       Summary-LSAs originate from the area's area border routers.  They
  2397.       describe routes to destinations internal to the Autonomous System,
  2398.       yet external to the area (i.e., inter-area destinations).
  2399.  
  2400.    Shortest-path tree
  2401.       The shortest-path tree for the area, with this router itself as
  2402.       root.  Derived from the collected router-LSAs and network-LSAs by
  2403.       the Dijkstra algorithm (see Section 16.1).
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410. Moy                         Standards Track                    [Page 43]
  2411.  
  2412. RFC 2178                     OSPF Version 2                    July 1997
  2413.  
  2414.  
  2415.    TransitCapability
  2416.       This parameter indicates whether the area can carry data traffic
  2417.       that neither originates nor terminates in the area itself. This
  2418.       parameter is calculated when the area's shortest-path tree is
  2419.       built (see Section 16.1, where TransitCapability is set to TRUE if
  2420.       and only if there are one or more fully adjacent virtual links
  2421.       using the area as Transit area), and is used as an input to a
  2422.       subsequent step of the routing table build process (see Section
  2423.       16.3). When an area's TransitCapability is set to TRUE, the area
  2424.       is said to be a "transit area".
  2425.  
  2426.    ExternalRoutingCapability
  2427.       Whether AS-external-LSAs will be flooded into/throughout the area.
  2428.       This is a configurable parameter.  If AS-external-LSAs are
  2429.       excluded from the area, the area is called a "stub". Within stub
  2430.       areas, routing to AS external destinations will be based solely on
  2431.       a default summary route.  The backbone cannot be configured as a
  2432.       stub area.  Also, virtual links cannot be configured through stub
  2433.       areas.  For more information, see Section 3.6.
  2434.  
  2435.    StubDefaultCost
  2436.       If the area has been configured as a stub area, and the router
  2437.       itself is an area border router, then the StubDefaultCost
  2438.       indicates the cost of the default summary-LSA that the router
  2439.       should advertise into the area. See Section 12.4.3 for more
  2440.       information.
  2441.  
  2442.    Unless otherwise specified, the remaining sections of this document
  2443.    refer to the operation of the OSPF protocol within a single area.
  2444.  
  2445. 7.  Bringing Up Adjacencies
  2446.  
  2447.    OSPF creates adjacencies between neighboring routers for the purpose
  2448.    of exchanging routing information. Not every two neighboring routers
  2449.    will become adjacent.  This section covers the generalities involved
  2450.    in creating adjacencies.  For further details consult Section 10.
  2451.  
  2452. 7.1.  The Hello Protocol
  2453.  
  2454.    The Hello Protocol is responsible for establishing and maintaining
  2455.    neighbor relationships.  It also ensures that communication between
  2456.    neighbors is bidirectional.  Hello packets are sent periodically out
  2457.    all router interfaces.  Bidirectional communication is indicated when
  2458.    the router sees itself listed in the neighbor's Hello Packet.  On
  2459.    broadcast and NBMA networks, the Hello Protocol elects a Designated
  2460.    Router for the network.
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466. Moy                         Standards Track                    [Page 44]
  2467.  
  2468. RFC 2178                     OSPF Version 2                    July 1997
  2469.  
  2470.  
  2471.    The Hello Protocol works differently on broadcast networks, NBMA
  2472.    networks and Point-to-MultiPoint networks.  On broadcast networks,
  2473.    each router advertises itself by periodically multicasting Hello
  2474.    Packets.  This allows neighbors to be discovered dynamically.  These
  2475.    Hello Packets contain the router's view of the Designated Router's
  2476.    identity, and the list of routers whose Hello Packets have been seen
  2477.    recently.
  2478.  
  2479.    On NBMA networks some configuration information may be necessary for
  2480.    the operation of the Hello Protocol.  Each router that may
  2481.    potentially become Designated Router has a list of all other routers
  2482.    attached to the network.  A router, having Designated Router
  2483.    potential, sends Hello Packets to all other potential Designated
  2484.    Routers when its interface to the NBMA network first becomes
  2485.    operational.  This is an attempt to find the Designated Router for
  2486.    the network.  If the router itself is elected Designated Router, it
  2487.    begins sending Hello Packets to all other routers attached to the
  2488.    network.
  2489.  
  2490.    On Point-to-MultiPoint networks, a router sends Hello Packets to all
  2491.    neighbors with which it can communicate directly. These neighbors may
  2492.    be discovered dynamically through a protocol such as Inverse ARP (see
  2493.    [Ref14]), or they may be configured.
  2494.  
  2495.    After a neighbor has been discovered, bidirectional communication
  2496.    ensured, and (if on a broadcast or NBMA network) a Designated Router
  2497.    elected, a decision is made regarding whether or not an adjacency
  2498.    should be formed with the neighbor (see Section 10.4). If an
  2499.    adjacency is to be formed, the first step is to synchronize the
  2500.    neighbors' link-state databases.  This is covered in the next
  2501.    section.
  2502.  
  2503. 7.2.  The Synchronization of Databases
  2504.  
  2505.    In a link-state routing algorithm, it is very important for all
  2506.    routers' link-state databases to stay synchronized.  OSPF simplifies
  2507.    this by requiring only adjacent routers to remain synchronized.  The
  2508.    synchronization process begins as soon as the routers attempt to
  2509.    bring up the adjacency.  Each router describes its database by
  2510.    sending a sequence of Database Description packets to its neighbor.
  2511.    Each Database Description Packet describes a set of LSAs belonging to
  2512.    the router's database.  When the neighbor sees an LSA that is more
  2513.    recent than its own database copy, it makes a note that this newer
  2514.    LSA should be requested.
  2515.  
  2516.    This sending and receiving of Database Description packets is called
  2517.    the "Database Exchange Process".  During this process, the two
  2518.    routers form a master/slave relationship.  Each Database Description
  2519.  
  2520.  
  2521.  
  2522. Moy                         Standards Track                    [Page 45]
  2523.  
  2524. RFC 2178                     OSPF Version 2                    July 1997
  2525.  
  2526.  
  2527.    Packet has a sequence number.  Database Description Packets sent by
  2528.    the master (polls) are acknowledged by the slave through echoing of
  2529.    the sequence number.  Both polls and their responses contain
  2530.    summaries of link state data.  The master is the only one allowed to
  2531.    retransmit Database Description Packets.  It does so only at fixed
  2532.    intervals, the length of which is the configured per-interface
  2533.    constant RxmtInterval.
  2534.  
  2535.    Each Database Description contains an indication that there are more
  2536.    packets to follow --- the M-bit.  The Database Exchange Process is
  2537.    over when a router has received and sent Database Description Packets
  2538.    with the M-bit off.
  2539.  
  2540.    During and after the Database Exchange Process, each router has a
  2541.    list of those LSAs for which the neighbor has more up-to-date
  2542.    instances.  These LSAs are requested in Link State Request Packets.
  2543.    Link State Request packets that are not satisfied are retransmitted
  2544.    at fixed intervals of time RxmtInterval.  When the Database
  2545.    Description Process has completed and all Link State Requests have
  2546.    been satisfied, the databases are deemed synchronized and the routers
  2547.    are marked fully adjacent.  At this time the adjacency is fully
  2548.    functional and is advertised in the two routers' router-LSAs.
  2549.  
  2550.    The adjacency is used by the flooding procedure as soon as the
  2551.    Database Exchange Process begins.  This simplifies database
  2552.    synchronization, and guarantees that it finishes in a predictable
  2553.    period of time.
  2554.  
  2555. 7.3.  The Designated Router
  2556.  
  2557.    Every broadcast and NBMA network has a Designated Router.  The
  2558.    Designated Router performs two main functions for the routing
  2559.    protocol:
  2560.  
  2561.    o   The Designated Router originates a network-LSA on behalf of
  2562.        the network.  This LSA lists the set of routers (including
  2563.        the Designated Router itself) currently attached to the
  2564.        network.  The Link State ID for this LSA (see Section
  2565.        12.1.4) is the IP interface address of the Designated
  2566.        Router.  The IP network number can then be obtained by using
  2567.        the network's subnet/network mask.
  2568.  
  2569.    o   The Designated Router becomes adjacent to all other routers
  2570.        on the network.  Since the link state databases are
  2571.        synchronized across adjacencies (through adjacency bring-up
  2572.        and then the flooding procedure), the Designated Router
  2573.        plays a central part in the synchronization process.
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Moy                         Standards Track                    [Page 46]
  2579.  
  2580. RFC 2178                     OSPF Version 2                    July 1997
  2581.  
  2582.  
  2583.    The Designated Router is elected by the Hello Protocol.  A router's
  2584.    Hello Packet contains its Router Priority, which is configurable on a
  2585.    per-interface basis.  In general, when a router's interface to a
  2586.    network first becomes functional, it checks to see whether there is
  2587.    currently a Designated Router for the network.  If there is, it
  2588.    accepts that Designated Router, regardless of its Router Priority.
  2589.    (This makes it harder to predict the identity of the Designated
  2590.    Router, but ensures that the Designated Router changes less often.
  2591.    See below.)  Otherwise, the router itself becomes Designated Router
  2592.    if it has the highest Router Priority on the network.  A more
  2593.    detailed (and more accurate) description of Designated Router
  2594.    election is presented in Section 9.4.
  2595.  
  2596.    The Designated Router is the endpoint of many adjacencies.  In order
  2597.    to optimize the flooding procedure on broadcast networks, the
  2598.    Designated Router multicasts its Link State Update Packets to the
  2599.    address AllSPFRouters, rather than sending separate packets over each
  2600.    adjacency.
  2601.  
  2602.    Section 2 of this document discusses the directed graph
  2603.    representation of an area.  Router nodes are labelled with their
  2604.    Router ID.  Transit network nodes are actually labelled with the IP
  2605.    address of their Designated Router.  It follows that when the
  2606.    Designated Router changes, it appears as if the network node on the
  2607.    graph is replaced by an entirely new node.  This will cause the
  2608.    network and all its attached routers to originate new LSAs.  Until
  2609.    the link-state databases again converge, some temporary loss of
  2610.    connectivity may result.  This may result in ICMP unreachable
  2611.    messages being sent in response to data traffic.  For that reason,
  2612.    the Designated Router should change only infrequently.  Router
  2613.    Priorities should be configured so that the most dependable router on
  2614.    a network eventually becomes Designated Router.
  2615.  
  2616. 7.4.  The Backup Designated Router
  2617.  
  2618.    In order to make the transition to a new Designated Router smoother,
  2619.    there is a Backup Designated Router for each broadcast and NBMA
  2620.    network.  The Backup Designated Router is also adjacent to all
  2621.    routers on the network, and becomes Designated Router when the
  2622.    previous Designated Router fails.  If there were no Backup Designated
  2623.    Router, when a new Designated Router became necessary, new
  2624.    adjacencies would have to be formed between the new Designated Router
  2625.    and all other routers attached to the network.  Part of the adjacency
  2626.    forming process is the synchronizing of link-state databases, which
  2627.    can potentially take quite a long time.  During this time, the
  2628.    network would not be available for transit data traffic.  The Backup
  2629.    Designated obviates the need to form these adjacencies, since they
  2630.    already exist.  This means the period of disruption in transit
  2631.  
  2632.  
  2633.  
  2634. Moy                         Standards Track                    [Page 47]
  2635.  
  2636. RFC 2178                     OSPF Version 2                    July 1997
  2637.  
  2638.  
  2639.    traffic lasts only as long as it takes to flood the new LSAs (which
  2640.    announce the new Designated Router).
  2641.  
  2642.    The Backup Designated Router does not generate a network-LSA for the
  2643.    network.  (If it did, the transition to a new Designated Router would
  2644.    be even faster.  However, this is a tradeoff between database size
  2645.    and speed of convergence when the Designated Router disappears.)
  2646.  
  2647.    The Backup Designated Router is also elected by the Hello Protocol.
  2648.    Each Hello Packet has a field that specifies the Backup Designated
  2649.    Router for the network.
  2650.  
  2651.    In some steps of the flooding procedure, the Backup Designated Router
  2652.    plays a passive role, letting the Designated Router do more of the
  2653.    work.  This cuts down on the amount of local routing traffic.  See
  2654.    Section 13.3 for more information.
  2655.  
  2656. 7.5.  The graph of adjacencies
  2657.  
  2658.    An adjacency is bound to the network that the two routers have in
  2659.    common.  If two routers have multiple networks in common, they may
  2660.    have multiple adjacencies between them.
  2661.  
  2662.    One can picture the collection of adjacencies on a network as forming
  2663.    an undirected graph.  The vertices consist of routers, with an edge
  2664.    joining two routers if they are adjacent.  The graph of adjacencies
  2665.    describes the flow of routing protocol packets, and in particular
  2666.    Link State Update Packets, through the Autonomous System.
  2667.  
  2668.    Two graphs are possible, depending on whether a Designated Router is
  2669.    elected for the network.  On physical point-to-point networks,
  2670.    Point-to-MultiPoint networks and virtual links, neighboring routers
  2671.    become adjacent whenever they can communicate directly.  In contrast,
  2672.    on broadcast and NBMA networks only the Designated Router and the
  2673.    Backup Designated Router become adjacent to all other routers
  2674.    attached to the network.
  2675.  
  2676.    These graphs are shown in Figure 10.  It is assumed that Router RT7
  2677.    has become the Designated Router, and Router RT3 the Backup
  2678.    Designated Router, for the Network N2.  The Backup Designated Router
  2679.    performs a lesser function during the flooding procedure than the
  2680.    Designated Router (see Section 13.3).  This is the reason for the
  2681.    dashed lines connecting the Backup Designated Router RT3.
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690. Moy                         Standards Track                    [Page 48]
  2691.  
  2692. RFC 2178                     OSPF Version 2                    July 1997
  2693.  
  2694.  
  2695.           +---+            +---+
  2696.           |RT1|------------|RT2|            o---------------o
  2697.           +---+    N1      +---+           RT1             RT2
  2698.  
  2699.  
  2700.  
  2701.                                                  RT7
  2702.                                                   o---------+
  2703.             +---+   +---+   +---+                /|\        |
  2704.             |RT7|   |RT3|   |RT4|               / | \       |
  2705.             +---+   +---+   +---+              /  |  \      |
  2706.               |       |       |               /   |   \     |
  2707.          +-----------------------+        RT5o RT6o    oRT4 |
  2708.                   |       |     N2            *   *   *     |
  2709.                 +---+   +---+                  *  *  *      |
  2710.                 |RT5|   |RT6|                   * * *       |
  2711.                 +---+   +---+                    ***        |
  2712.                                                   o---------+
  2713.                                                  RT3
  2714.  
  2715.  
  2716.                   Figure 10: The graph of adjacencies
  2717.  
  2718. 8.  Protocol Packet Processing
  2719.  
  2720.    This section discusses the general processing of OSPF routing
  2721.    protocol packets.  It is very important that the router link-state
  2722.    databases remain synchronized.  For this reason, routing protocol
  2723.    packets should get preferential treatment over ordinary data packets,
  2724.    both in sending and receiving.
  2725.  
  2726.    Routing protocol packets are sent along adjacencies only (with the
  2727.    exception of Hello packets, which are used to discover the
  2728.    adjacencies).  This means that all routing protocol packets travel a
  2729.    single IP hop, except those sent over virtual links.
  2730.  
  2731.    All routing protocol packets begin with a standard header. The
  2732.    sections below provide details on how to fill in and verify this
  2733.    standard header.  Then, for each packet type, the section giving more
  2734.    details on that particular packet type's processing is listed.
  2735.  
  2736. 8.1.  Sending protocol packets
  2737.  
  2738.    When a router sends a routing protocol packet, it fills in the fields
  2739.    of the standard OSPF packet header as follows.  For more details on
  2740.    the header format consult Section A.3.1:
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746. Moy                         Standards Track                    [Page 49]
  2747.  
  2748. RFC 2178                     OSPF Version 2                    July 1997
  2749.  
  2750.  
  2751.    Version #
  2752.       Set to 2, the version number of the protocol as documented in this
  2753.       specification.
  2754.  
  2755.    Packet type
  2756.       The type of OSPF packet, such as Link state Update or Hello
  2757.       Packet.
  2758.  
  2759.    Packet length
  2760.       The length of the entire OSPF packet in bytes, including the
  2761.       standard OSPF packet header.
  2762.  
  2763.    Router ID
  2764.       The identity of the router itself (who is originating the packet).
  2765.  
  2766.    Area ID
  2767.       The OSPF area that the packet is being sent into.
  2768.  
  2769.    Checksum
  2770.       The standard IP 16-bit one's complement checksum of the entire
  2771.       OSPF packet, excluding the 64-bit authentication field.  This
  2772.       checksum is calculated as part of the appropriate authentication
  2773.       procedure; for some OSPF authentication types, the checksum
  2774.       calculation is omitted.  See Section D.4 for details.
  2775.  
  2776.    AuType and Authentication
  2777.       Each OSPF packet exchange is authenticated.  Authentication types
  2778.       are assigned by the protocol and are documented in Appendix D.  A
  2779.       different authentication procedure can be used for each IP
  2780.       network/subnet.  Autype indicates the type of authentication
  2781.       procedure in use.  The 64-bit authentication field is then for use
  2782.       by the chosen authentication procedure.  This procedure should be
  2783.       the last called when forming the packet to be sent.  See Section
  2784.       D.4 for details.
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802. Moy                         Standards Track                    [Page 50]
  2803.  
  2804. RFC 2178                     OSPF Version 2                    July 1997
  2805.  
  2806.  
  2807.    The IP destination address for the packet is selected as follows.  On
  2808.    physical point-to-point networks, the IP destination is always set to
  2809.    the address AllSPFRouters.  On all other network types (including
  2810.    virtual links), the majority of OSPF packets are sent as unicasts,
  2811.    i.e., sent directly to the other end of the adjacency.  In this case,
  2812.    the IP destination is just the Neighbor IP address associated with
  2813.    the other end of the adjacency (see Section 10).  The only packets
  2814.    not sent as unicasts are on broadcast networks; on these networks
  2815.    Hello packets are sent to the multicast destination AllSPFRouters,
  2816.    the Designated Router and its Backup send both Link State Update
  2817.    Packets and Link State Acknowledgment Packets to the multicast
  2818.    address AllSPFRouters, while all other routers send both their Link
  2819.    State Update and Link State Acknowledgment Packets to the multicast
  2820.    address AllDRouters.
  2821.  
  2822.    Retransmissions of Link State Update packets are ALWAYS sent as
  2823.    unicasts.
  2824.  
  2825.    The IP source address should be set to the IP address of the sending
  2826.    interface.  Interfaces to unnumbered point-to-point networks have no
  2827.    associated IP address.  On these interfaces, the IP source should be
  2828.    set to any of the other IP addresses belonging to the router.  For
  2829.    this reason, there must be at least one IP address assigned to the
  2830.    router.[2] Note that, for most purposes, virtual links act precisely
  2831.    the same as unnumbered point-to-point networks.  However, each
  2832.    virtual link does have an IP interface address (discovered during the
  2833.    routing table build process) which is used as the IP source when
  2834.    sending packets over the virtual link.
  2835.  
  2836.    For more information on the format of specific OSPF packet types,
  2837.    consult the sections listed in Table 10.
  2838.  
  2839.  
  2840.              Type   Packet name            detailed section (transmit)
  2841.              _________________________________________________________
  2842.              1      Hello                  Section  9.5
  2843.              2      Database description   Section 10.8
  2844.              3      Link state request     Section 10.9
  2845.              4      Link state update      Section 13.3
  2846.              5      Link state ack         Section 13.5
  2847.  
  2848.     Table 10: Sections describing OSPF protocol packet transmission.
  2849.  
  2850. 8.2.  Receiving protocol packets
  2851.  
  2852.    Whenever a protocol packet is received by the router it is marked
  2853.    with the interface it was received on.  For routers that have virtual
  2854.    links configured, it may not be immediately obvious which interface
  2855.  
  2856.  
  2857.  
  2858. Moy                         Standards Track                    [Page 51]
  2859.  
  2860. RFC 2178                     OSPF Version 2                    July 1997
  2861.  
  2862.  
  2863.    to associate the packet with.  For example, consider the Router RT11
  2864.    depicted in Figure 6.  If RT11 receives an OSPF protocol packet on
  2865.    its interface to Network N8, it may want to associate the packet with
  2866.    the interface to Area 2, or with the virtual link to Router RT10
  2867.    (which is part of the backbone).  In the following, we assume that
  2868.    the packet is initially associated with the non-virtual  link.[3]
  2869.  
  2870.    In order for the packet to be accepted at the IP level, it must pass
  2871.    a number of tests, even before the packet is passed to OSPF for
  2872.    processing:
  2873.  
  2874.    o   The IP checksum must be correct.
  2875.  
  2876.    o   The packet's IP destination address must be the IP address
  2877.        of the receiving interface, or one of the IP multicast
  2878.        addresses AllSPFRouters or AllDRouters.
  2879.  
  2880.    o   The IP protocol specified must be OSPF (89).
  2881.  
  2882.    o   Locally originated packets should not be passed on to OSPF.
  2883.        That is, the source IP address should be examined to make
  2884.        sure this is not a multicast packet that the router itself
  2885.        generated.
  2886.  
  2887.    Next, the OSPF packet header is verified.  The fields specified
  2888.    in the header must match those configured for the receiving
  2889.    interface.  If they do not, the packet should be discarded:
  2890.  
  2891.  
  2892.    o   The version number field must specify protocol version 2.
  2893.  
  2894.    o   The Area ID found in the OSPF header must be verified.  If
  2895.        both of the following cases fail, the packet should be
  2896.        discarded.  The Area ID specified in the header must either:
  2897.  
  2898.        (1) Match the Area ID of the receiving interface.  In this
  2899.            case, the packet has been sent over a single hop.
  2900.            Therefore, the packet's IP source address is required to
  2901.            be on the same network as the receiving interface.  This
  2902.            can be verified by comparing the packet's IP source
  2903.            address to the interface's IP address, after masking
  2904.            both addresses with the interface mask.  This comparison
  2905.            should not be performed on point-to-point networks. On
  2906.            point-to-point networks, the interface addresses of each
  2907.            end of the link are assigned independently, if they are
  2908.            assigned at all.
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914. Moy                         Standards Track                    [Page 52]
  2915.  
  2916. RFC 2178                     OSPF Version 2                    July 1997
  2917.  
  2918.  
  2919.        (2) Indicate the backbone.  In this case, the packet has
  2920.            been sent over a virtual link.  The receiving router
  2921.            must be an area border router, and the Router ID
  2922.            specified in the packet (the source router) must be the
  2923.            other end of a configured virtual link.  The receiving
  2924.            interface must also attach to the virtual link's
  2925.            configured Transit area.  If all of these checks
  2926.            succeed, the packet is accepted and is from now on
  2927.            associated with the virtual link (and the backbone
  2928.            area).
  2929.  
  2930.    o   Packets whose IP destination is AllDRouters should only be
  2931.        accepted if the state of the receiving interface is DR or
  2932.        Backup (see Section 9.1).
  2933.  
  2934.    o   The AuType specified in the packet must match the AuType
  2935.        specified for the associated area.
  2936.  
  2937.    o   The packet must be authenticated.  The authentication
  2938.        procedure is indicated by the setting of AuType (see
  2939.        Appendix D).  The authentication procedure may use one or
  2940.        more Authentication keys, which can be configured on a per-
  2941.        interface basis.  The authentication procedure may also
  2942.        verify the checksum field in the OSPF packet header (which,
  2943.        when used, is set to the standard IP 16-bit one's complement
  2944.        checksum of the OSPF packet's contents after excluding the
  2945.        64-bit authentication field).  If the authentication
  2946.        procedure fails, the packet should be discarded.
  2947.  
  2948.    If the packet type is Hello, it should then be further processed by
  2949.    the Hello Protocol (see Section 10.5).  All other packet types are
  2950.    sent/received only on adjacencies.  This means that the packet must
  2951.    have been sent by one of the router's active neighbors.  If the
  2952.    receiving interface connects to a broadcast network, Point-to-
  2953.    MultiPoint network or NBMA network the sender is identified by the IP
  2954.    source address found in the packet's IP header.  If the receiving
  2955.    interface connects to a point-to-point network or a virtual link, the
  2956.    sender is identified by the Router ID (source router) found in the
  2957.    packet's OSPF header.  The data structure associated with the
  2958.    receiving interface contains the list of active neighbors.  Packets
  2959.    not matching any active neighbor are discarded.
  2960.  
  2961.    At this point all received protocol packets are associated with an
  2962.    active neighbor.  For the further input processing of specific packet
  2963.    types, consult the sections listed in Table 11.
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970. Moy                         Standards Track                    [Page 53]
  2971.  
  2972. RFC 2178                     OSPF Version 2                    July 1997
  2973.  
  2974.  
  2975.       Type   Packet name            detailed section (receive)
  2976.       ________________________________________________________
  2977.       1      Hello                  Section 10.5
  2978.       2      Database description   Section 10.6
  2979.       3      Link state request     Section 10.7
  2980.       4      Link state update      Section 13
  2981.       5      Link state ack         Section 13.7
  2982.  
  2983.      Table 11: Sections describing OSPF protocol packet reception.
  2984.  
  2985. 9.  The Interface Data Structure
  2986.  
  2987.    An OSPF interface is the connection between a router and a network.
  2988.    We assume a single OSPF interface to each attached network/subnet,
  2989.    although supporting multiple interfaces on a single network is
  2990.    considered in Appendix F. Each interface structure has at most one IP
  2991.    interface address.
  2992.  
  2993.    An OSPF interface can be considered to belong to the area that
  2994.    contains the attached network.  All routing protocol packets
  2995.    originated by the router over this interface are labelled with the
  2996.    interface's Area ID.  One or more router adjacencies may develop over
  2997.    an interface. A router's LSAs reflect the state of its interfaces and
  2998.    their associated adjacencies.
  2999.  
  3000.    The following data items are associated with an interface. Note that
  3001.    a number of these items are actually configuration for the attached
  3002.    network; such items must be the same for all routers connected to the
  3003.    network.
  3004.  
  3005.    Type
  3006.       The OSPF interface type is either point-to-point, broadcast, NBMA,
  3007.       Point-to-MultiPoint or virtual link.
  3008.  
  3009.    State
  3010.       The functional level of an interface.  State determines whether or
  3011.       not full adjacencies are allowed to form over the interface.
  3012.       State is also reflected in the router's LSAs.
  3013.  
  3014.    IP interface address
  3015.       The IP address associated with the interface.  This appears as the
  3016.       IP source address in all routing protocol packets originated over
  3017.       this interface.  Interfaces to unnumbered point-to-point networks
  3018.       do not have an associated IP address.
  3019.  
  3020.    IP interface mask
  3021.       Also referred to as the subnet mask, this indicates the portion of
  3022.       the IP interface address that identifies the attached network.
  3023.  
  3024.  
  3025.  
  3026. Moy                         Standards Track                    [Page 54]
  3027.  
  3028. RFC 2178                     OSPF Version 2                    July 1997
  3029.  
  3030.  
  3031.       Masking the IP interface address with the IP interface mask yields
  3032.       the IP network number of the attached network.  On point-to-point
  3033.       networks and virtual links, the IP interface mask is not defined.
  3034.       On these networks, the link itself is not assigned an IP network
  3035.       number, and so the addresses of each side of the link are assigned
  3036.       independently, if they are assigned at all.
  3037.  
  3038.    Area ID
  3039.       The Area ID of the area to which the attached network belongs.
  3040.       All routing protocol packets originating from the interface are
  3041.       labelled with this Area ID.
  3042.  
  3043.    HelloInterval
  3044.       The length of time, in seconds, between the Hello packets that the
  3045.       router sends on the interface.  Advertised in Hello packets sent
  3046.       out this interface.
  3047.  
  3048.    RouterDeadInterval
  3049.       The number of seconds before the router's neighbors will declare
  3050.       it down, when they stop hearing the router's Hello Packets.
  3051.       Advertised in Hello packets sent out this interface.
  3052.  
  3053.    InfTransDelay
  3054.       The estimated number of seconds it takes to transmit a Link State
  3055.       Update Packet over this interface.  LSAs contained in the Link
  3056.       State Update packet will have their age incremented by this amount
  3057.       before transmission.  This value should take into account
  3058.       transmission and propagation delays; it must be greater than zero.
  3059.  
  3060.    Router Priority
  3061.       An 8-bit unsigned integer.  When two routers attached to a network
  3062.       both attempt to become Designated Router, the one with the highest
  3063.       Router Priority takes precedence.  A router whose Router Priority
  3064.       is set to 0 is ineligible to become Designated Router on the
  3065.       attached network.  Advertised in Hello packets sent out this
  3066.       interface.
  3067.  
  3068.    Hello Timer
  3069.       An interval timer that causes the interface to send a Hello
  3070.       packet.  This timer fires every HelloInterval seconds.  Note that
  3071.       on non-broadcast networks a separate Hello packet is sent to each
  3072.       qualified neighbor.
  3073.  
  3074.    Wait Timer
  3075.       A single shot timer that causes the interface to exit the Waiting
  3076.       state, and as a consequence select a Designated Router on the
  3077.       network.  The length of the timer is RouterDeadInterval seconds.
  3078.  
  3079.  
  3080.  
  3081.  
  3082. Moy                         Standards Track                    [Page 55]
  3083.  
  3084. RFC 2178                     OSPF Version 2                    July 1997
  3085.  
  3086.  
  3087.    List of neighboring routers
  3088.       The other routers attached to this network.  This list is formed
  3089.       by the Hello Protocol.  Adjacencies will be formed to some of
  3090.       these neighbors.  The set of adjacent neighbors can be determined
  3091.       by an examination of all of the neighbors' states.
  3092.  
  3093.    Designated Router
  3094.       The Designated Router selected for the attached network.  The
  3095.       Designated Router is selected on all broadcast and NBMA networks
  3096.       by the Hello Protocol.  Two pieces of identification are kept for
  3097.       the Designated Router: its Router ID and its IP interface address
  3098.       on the network.  The Designated Router advertises link state for
  3099.       the network; this network-LSA is labelled with the Designated
  3100.       Router's IP address.  The Designated Router is initialized to
  3101.       0.0.0.0, which indicates the lack of a Designated Router.
  3102.  
  3103.    Backup Designated Router
  3104.       The Backup Designated Router is also selected on all broadcast and
  3105.       NBMA networks by the Hello Protocol.  All routers on the attached
  3106.       network become adjacent to both the Designated Router and the
  3107.       Backup Designated Router.  The Backup Designated Router becomes
  3108.       Designated Router when the current Designated Router fails. The
  3109.       Backup Designated Router is initialized to 0.0.0.0, indicating the
  3110.       lack of a Backup Designated Router.
  3111.  
  3112.    Interface output cost(s)
  3113.       The cost of sending a data packet on the interface, expressed in
  3114.       the link state metric.  This is advertised as the link cost for
  3115.       this interface in the router-LSA. The cost of an interface must be
  3116.       greater than zero.
  3117.  
  3118.    RxmtInterval
  3119.       The number of seconds between LSA retransmissions, for adjacencies
  3120.       belonging to this interface.  Also used when retransmitting
  3121.       Database Description and Link State Request Packets.
  3122.  
  3123.    AuType
  3124.       The type of authentication used on the attached network/subnet.
  3125.       Authentication types are defined in Appendix D.  All OSPF packet
  3126.       exchanges are authenticated.  Different authentication schemes may
  3127.       be used on different networks/subnets.
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138. Moy                         Standards Track                    [Page 56]
  3139.  
  3140. RFC 2178                     OSPF Version 2                    July 1997
  3141.  
  3142.  
  3143.    Authentication key
  3144.       This configured data allows the authentication procedure to
  3145.       generate and/or verify OSPF protocol packets.  The Authentication
  3146.       key can be configured on a per-interface basis.  For example, if
  3147.       the AuType indicates simple password, the Authentication key would
  3148.       be a 64-bit clear password which is inserted into the OSPF packet
  3149.       header. If instead Autype indicates Cryptographic authentication,
  3150.       then the Authentication key is a shared secret which enables the
  3151.       generation/verification of message digests which are appended to
  3152.       the OSPF protocol packets. When Cryptographic authentication is
  3153.       used, multiple simultaneous keys are supported in order to achieve
  3154.       smooth key transition (see Section D.3).
  3155.  
  3156. 9.1.  Interface states
  3157.  
  3158.    The various states that router interfaces may attain is documented in
  3159.    this section.  The states are listed in order of progressing
  3160.    functionality.  For example, the inoperative state is listed first,
  3161.    followed by a list of intermediate states before the final, fully
  3162.    functional state is achieved.  The specification makes use of this
  3163.    ordering by sometimes making references such as "those interfaces in
  3164.    state greater than X".  Figure 11 shows the graph of interface state
  3165.    changes.  The arcs of the graph are labelled with the event causing
  3166.    the state change.  These events are documented in Section 9.2.  The
  3167.    interface state machine is described in more detail in Section 9.3.
  3168.  
  3169.    Down
  3170.       This is the initial interface state.  In this state, the lower-
  3171.       level protocols have indicated that the interface is unusable.  No
  3172.       protocol traffic at all will be sent or received on such a
  3173.       interface.  In this state, interface parameters should be set to
  3174.       their initial values.
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194. Moy                         Standards Track                    [Page 57]
  3195.  
  3196. RFC 2178                     OSPF Version 2                    July 1997
  3197.  
  3198.  
  3199.                                   +----+   UnloopInd   +--------+
  3200.                                   |Down|<--------------|Loopback|
  3201.                                   +----+               +--------+
  3202.                                      |
  3203.                                      |InterfaceUp
  3204.                           +-------+  |               +--------------+
  3205.                           |Waiting|<-+-------------->|Point-to-point|
  3206.                           +-------+                  +--------------+
  3207.                               |
  3208.                      WaitTimer|BackupSeen
  3209.                               |
  3210.                               |
  3211.                               |   NeighborChange
  3212.           +------+           +-+<---------------- +-------+
  3213.           |Backup|<----------|?|----------------->|DROther|
  3214.           +------+---------->+-+<-----+           +-------+
  3215.                     Neighbor  |       |
  3216.                     Change    |       |Neighbor
  3217.                               |       |Change
  3218.                               |     +--+
  3219.                               +---->|DR|
  3220.                                     +--+
  3221.  
  3222.                    Figure 11: Interface State changes
  3223.  
  3224.              In addition to the state transitions pictured,
  3225.            Event InterfaceDown always forces Down State, and
  3226.                Event LoopInd always forces Loopback State
  3227.  
  3228.       All interface timers should be disabled, and there should be no
  3229.       adjacencies associated with the interface.
  3230.  
  3231.    Loopback
  3232.       In this state, the router's interface to the network is looped
  3233.       back.  The interface may be looped back in hardware or software.
  3234.       The interface will be unavailable for regular data traffic.
  3235.       However, it may still be desirable to gain information on the
  3236.       quality of this interface, either through sending ICMP pings to
  3237.       the interface or through something like a bit error test.  For
  3238.       this reason, IP packets may still be addressed to an interface in
  3239.       Loopback state.  To facilitate this, such interfaces are
  3240.       advertised in router-LSAs as single host routes, whose destination
  3241.       is the IP interface address.[4]
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250. Moy                         Standards Track                    [Page 58]
  3251.  
  3252. RFC 2178                     OSPF Version 2                    July 1997
  3253.  
  3254.  
  3255.    Waiting
  3256.       In this state, the router is trying to determine the identity of
  3257.       the (Backup) Designated Router for the network.  To do this, the
  3258.       router monitors the Hello Packets it receives.  The router is not
  3259.       allowed to elect a Backup Designated Router nor a Designated
  3260.       Router until it transitions out of Waiting state.  This prevents
  3261.       unnecessary changes of (Backup) Designated Router.
  3262.  
  3263.    Point-to-point
  3264.       In this state, the interface is operational, and connects either
  3265.       to a physical point-to-point network or to a virtual link.  Upon
  3266.       entering this state, the router attempts to form an adjacency with
  3267.       the neighboring router.  Hello Packets are sent to the neighbor
  3268.       every HelloInterval seconds.
  3269.  
  3270.    DR Other
  3271.       The interface is to a broadcast or NBMA network on which another
  3272.       router has been selected to be the Designated Router.  In this
  3273.       state, the router itself has not been selected Backup Designated
  3274.       Router either.  The router forms adjacencies to both the
  3275.       Designated Router and the Backup Designated Router (if they
  3276.       exist).
  3277.  
  3278.    Backup
  3279.       In this state, the router itself is the Backup Designated Router
  3280.       on the attached network.  It will be promoted to Designated Router
  3281.       when the present Designated Router fails.  The router establishes
  3282.       adjacencies to all other routers attached to the network.  The
  3283.       Backup Designated Router performs slightly different functions
  3284.       during the Flooding Procedure, as compared to the Designated
  3285.       Router (see Section 13.3).  See Section 7.4 for more details on
  3286.       the functions performed by the Backup Designated Router.
  3287.  
  3288.    DR  In this state, this router itself is the Designated Router
  3289.       on the attached network.  Adjacencies are established to all other
  3290.       routers attached to the network.  The router must also originate a
  3291.       network-LSA for the network node.  The network-LSA will contain
  3292.       links to all routers (including the Designated Router itself)
  3293.       attached to the network.  See Section 7.3 for more details on the
  3294.       functions performed by the Designated Router.
  3295.  
  3296. 9.2.  Events causing interface state changes
  3297.  
  3298.    State changes can be effected by a number of events.  These events
  3299.    are pictured as the labelled arcs in Figure 11.  The label
  3300.    definitions are listed below.  For a detailed explanation of the
  3301.    effect of these events on OSPF protocol operation, consult Section
  3302.    9.3.
  3303.  
  3304.  
  3305.  
  3306. Moy                         Standards Track                    [Page 59]
  3307.  
  3308. RFC 2178                     OSPF Version 2                    July 1997
  3309.  
  3310.  
  3311.    InterfaceUp
  3312.       Lower-level protocols have indicated that the network interface is
  3313.       operational.  This enables the interface to transition out of Down
  3314.       state.  On virtual links, the interface operational indication is
  3315.       actually a result of the shortest path calculation (see Section
  3316.       16.7).
  3317.  
  3318.    WaitTimer
  3319.       The Wait Timer has fired, indicating the end of the waiting period
  3320.       that is required before electing a (Backup) Designated Router.
  3321.  
  3322.    BackupSeen
  3323.       The router has detected the existence or non-existence of a Backup
  3324.       Designated Router for the network.  This is done in one of two
  3325.       ways.  First, an Hello Packet may be received from a neighbor
  3326.       claiming to be itself the Backup Designated Router.
  3327.       Alternatively, an Hello Packet may be received from a neighbor
  3328.       claiming to be itself the Designated Router, and indicating that
  3329.       there is no Backup Designated Router.  In either case there must
  3330.       be bidirectional communication with the neighbor, i.e., the router
  3331.       must also appear in the neighbor's Hello Packet.  This event
  3332.       signals an end to the Waiting state.
  3333.  
  3334.    NeighborChange
  3335.       There has been a change in the set of bidirectional neighbors
  3336.       associated with the interface.  The (Backup) Designated Router
  3337.       needs to be recalculated.  The following neighbor changes lead to
  3338.       the NeighborChange event. For an explanation of neighbor states,
  3339.       see Section 10.1.
  3340.  
  3341.        o   Bidirectional communication has been established to a
  3342.            neighbor.  In other words, the state of the neighbor has
  3343.            transitioned to 2-Way or higher.
  3344.  
  3345.        o   There is no longer bidirectional communication with a
  3346.            neighbor.  In other words, the state of the neighbor has
  3347.            transitioned to Init or lower.
  3348.  
  3349.        o   One of the bidirectional neighbors is newly declaring
  3350.            itself as either Designated Router or Backup Designated
  3351.            Router.  This is detected through examination of that
  3352.            neighbor's Hello Packets.
  3353.  
  3354.        o   One of the bidirectional neighbors is no longer
  3355.            declaring itself as Designated Router, or is no longer
  3356.            declaring itself as Backup Designated Router.  This is
  3357.            again detected through examination of that neighbor's
  3358.            Hello Packets.
  3359.  
  3360.  
  3361.  
  3362. Moy                         Standards Track                    [Page 60]
  3363.  
  3364. RFC 2178                     OSPF Version 2                    July 1997
  3365.  
  3366.  
  3367.        o   The advertised Router Priority for a bidirectional
  3368.            neighbor has changed.  This is again detected through
  3369.            examination of that neighbor's Hello Packets.
  3370.  
  3371.    LoopInd
  3372.       An indication has been received that the interface is now looped
  3373.       back to itself.  This indication can be received either from
  3374.       network management or from the lower level protocols.
  3375.  
  3376.    UnloopInd
  3377.       An indication has been received that the interface is no longer
  3378.       looped back.  As with the LoopInd event, this indication can be
  3379.       received either from network management or from the lower level
  3380.       protocols.
  3381.  
  3382.    InterfaceDown
  3383.       Lower-level protocols indicate that this interface is no longer
  3384.       functional. No matter what the current interface state is, the new
  3385.       interface state will be Down.
  3386.  
  3387. 9.3.  The Interface state machine
  3388.  
  3389.    A detailed description of the interface state changes follows.  Each
  3390.    state change is invoked by an event (Section 9.2).  This event may
  3391.    produce different effects, depending on the current state of the
  3392.    interface.  For this reason, the state machine below is organized by
  3393.    current interface state and received event. Each entry in the state
  3394.    machine describes the resulting new interface state and the required
  3395.    set of additional actions.
  3396.  
  3397.    When an interface's state changes, it may be necessary to originate a
  3398.    new router-LSA.  See Section 12.4 for more details.
  3399.  
  3400.    Some of the required actions below involve generating events for the
  3401.    neighbor state machine.  For example, when an interface becomes
  3402.    inoperative, all neighbor connections associated with the interface
  3403.    must be destroyed.  For more information on the neighbor state
  3404.    machine, see Section 10.3.
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418. Moy                         Standards Track                    [Page 61]
  3419.  
  3420. RFC 2178                     OSPF Version 2                    July 1997
  3421.  
  3422.  
  3423.     State(s):  Down
  3424.  
  3425.        Event:  InterfaceUp
  3426.  
  3427.    New state:  Depends upon action routine
  3428.  
  3429.       Action:  Start the interval Hello Timer, enabling the
  3430.                periodic sending of Hello packets out the interface.
  3431.                If the attached network is a physical point-to-point
  3432.                network, Point-to-MultiPoint network or virtual
  3433.                link, the interface state transitions to Point-to-
  3434.                Point.  Else, if the router is not eligible to
  3435.                become Designated Router the interface state
  3436.                transitions to DR Other.
  3437.  
  3438.                Otherwise, the attached network is a broadcast or
  3439.                NBMA network and the router is eligible to become
  3440.                Designated Router.  In this case, in an attempt to
  3441.                discover the attached network's Designated Router
  3442.                the interface state is set to Waiting and the single
  3443.                shot Wait Timer is started.  Additionally, if the
  3444.                network is an NBMA network examine the configured
  3445.                list of neighbors for this interface and generate
  3446.                the neighbor event Start for each neighbor that is
  3447.                also eligible to become Designated Router.
  3448.  
  3449.     State(s):  Waiting
  3450.  
  3451.        Event:  BackupSeen
  3452.  
  3453.    New state:  Depends upon action routine.
  3454.  
  3455.       Action:  Calculate the attached network's Backup Designated
  3456.                Router and Designated Router, as shown in Section
  3457.                9.4.  As a result of this calculation, the new state
  3458.                of the interface will be either DR Other, Backup or
  3459.                DR.
  3460.  
  3461.  
  3462.     State(s):  Waiting
  3463.  
  3464.        Event:  WaitTimer
  3465.  
  3466.    New state:  Depends upon action routine.
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474. Moy                         Standards Track                    [Page 62]
  3475.  
  3476. RFC 2178                     OSPF Version 2                    July 1997
  3477.  
  3478.  
  3479.       Action:  Calculate the attached network's Backup Designated
  3480.                Router and Designated Router, as shown in Section
  3481.                9.4.  As a result of this calculation, the new state
  3482.                of the interface will be either DR Other, Backup or
  3483.                DR.
  3484.  
  3485.  
  3486.     State(s):  DR Other, Backup or DR
  3487.  
  3488.        Event:  NeighborChange
  3489.  
  3490.    New state:  Depends upon action routine.
  3491.  
  3492.       Action:  Recalculate the attached network's Backup Designated
  3493.                Router and Designated Router, as shown in Section
  3494.                9.4.  As a result of this calculation, the new state
  3495.                of the interface will be either DR Other, Backup or
  3496.                DR.
  3497.  
  3498.  
  3499.     State(s):  Any State
  3500.  
  3501.        Event:  InterfaceDown
  3502.  
  3503.    New state:  Down
  3504.  
  3505.       Action:  All interface variables are reset, and interface
  3506.                timers disabled.  Also, all neighbor connections
  3507.                associated with the interface are destroyed.  This
  3508.                is done by generating the event KillNbr on all
  3509.                associated neighbors (see Section 10.2).
  3510.  
  3511.  
  3512.     State(s):  Any State
  3513.  
  3514.        Event:  LoopInd
  3515.  
  3516.    New state:  Loopback
  3517.  
  3518.       Action:  Since this interface is no longer connected to the
  3519.                attached network the actions associated with the
  3520.                above InterfaceDown event are executed.
  3521.  
  3522.  
  3523.     State(s):  Loopback
  3524.  
  3525.        Event:  UnloopInd
  3526.  
  3527.  
  3528.  
  3529.  
  3530. Moy                         Standards Track                    [Page 63]
  3531.  
  3532. RFC 2178                     OSPF Version 2                    July 1997
  3533.  
  3534.  
  3535.    New state:  Down
  3536.  
  3537.       Action:  No actions are necessary.  For example, the
  3538.                interface variables have already been reset upon
  3539.                entering the Loopback state.  Note that reception of
  3540.                an InterfaceUp event is necessary before the
  3541.                interface again becomes fully functional.
  3542.  
  3543. 9.4.  Electing the Designated Router
  3544.  
  3545.    This section describes the algorithm used for calculating a network's
  3546.    Designated Router and Backup Designated Router.  This algorithm is
  3547.    invoked by the Interface state machine.  The initial time a router
  3548.    runs the election algorithm for a network, the network's Designated
  3549.    Router and Backup Designated Router are initialized to 0.0.0.0.  This
  3550.    indicates the lack of both a Designated Router and a Backup
  3551.    Designated Router.
  3552.  
  3553.    The Designated Router election algorithm proceeds as follows: Call
  3554.    the router doing the calculation Router X.  The list of neighbors
  3555.    attached to the network and having established bidirectional
  3556.    communication with Router X is examined.  This list is precisely the
  3557.    collection of Router X's neighbors (on this network) whose state is
  3558.    greater than or equal to 2-Way (see Section 10.1).  Router X itself
  3559.    is also considered to be on the list.  Discard all routers from the
  3560.    list that are ineligible to become Designated Router.  (Routers
  3561.    having Router Priority of 0 are ineligible to become Designated
  3562.    Router.)  The following steps are then executed, considering only
  3563.    those routers that remain on the list:
  3564.  
  3565.    (1) Note the current values for the network's Designated Router
  3566.        and Backup Designated Router.  This is used later for
  3567.        comparison purposes.
  3568.  
  3569.    (2) Calculate the new Backup Designated Router for the network
  3570.        as follows.  Only those routers on the list that have not
  3571.        declared themselves to be Designated Router are eligible to
  3572.        become Backup Designated Router.  If one or more of these
  3573.        routers have declared themselves Backup Designated Router
  3574.        (i.e., they are currently listing themselves as Backup
  3575.        Designated Router, but not as Designated Router, in their
  3576.        Hello Packets) the one having highest Router Priority is
  3577.        declared to be Backup Designated Router.  In case of a tie,
  3578.        the one having the highest Router ID is chosen.  If no
  3579.        routers have declared themselves Backup Designated Router,
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586. Moy                         Standards Track                    [Page 64]
  3587.  
  3588. RFC 2178                     OSPF Version 2                    July 1997
  3589.  
  3590.  
  3591.        choose the router having highest Router Priority, (again
  3592.        excluding those routers who have declared themselves
  3593.        Designated Router), and again use the Router ID to break
  3594.        ties.
  3595.  
  3596.    (3) Calculate the new Designated Router for the network as
  3597.        follows.  If one or more of the routers have declared
  3598.        themselves Designated Router (i.e., they are currently
  3599.        listing themselves as Designated Router in their Hello
  3600.        Packets) the one having highest Router Priority is declared
  3601.        to be Designated Router.  In case of a tie, the one having
  3602.        the highest Router ID is chosen.  If no routers have
  3603.        declared themselves Designated Router, assign the Designated
  3604.        Router to be the same as the newly elected Backup Designated
  3605.        Router.
  3606.  
  3607.    (4) If Router X is now newly the Designated Router or newly the
  3608.        Backup Designated Router, or is now no longer the Designated
  3609.        Router or no longer the Backup Designated Router, repeat
  3610.        steps 2 and 3, and then proceed to step 5.  For example, if
  3611.        Router X is now the Designated Router, when step 2 is
  3612.        repeated X will no longer be eligible for Backup Designated
  3613.        Router election.  Among other things, this will ensure that
  3614.        no router will declare itself both Backup Designated Router
  3615.        and Designated Router.[5]
  3616.  
  3617.    (5) As a result of these calculations, the router itself may now
  3618.        be Designated Router or Backup Designated Router.  See
  3619.        Sections 7.3 and 7.4 for the additional duties this would
  3620.        entail.  The router's interface state should be set
  3621.        accordingly.  If the router itself is now Designated Router,
  3622.        the new interface state is DR.  If the router itself is now
  3623.        Backup Designated Router, the new interface state is Backup.
  3624.        Otherwise, the new interface state is DR Other.
  3625.  
  3626.    (6) If the attached network is an NBMA network, and the router
  3627.        itself has just become either Designated Router or Backup
  3628.        Designated Router, it must start sending Hello Packets to
  3629.        those neighbors that are not eligible to become Designated
  3630.        Router (see Section 9.5.1).  This is done by invoking the
  3631.        neighbor event Start for each neighbor having a Router
  3632.        Priority of 0.
  3633.  
  3634.    (7) If the above calculations have caused the identity of either
  3635.        the Designated Router or Backup Designated Router to change,
  3636.        the set of adjacencies associated with this interface will
  3637.        need to be modified.  Some adjacencies may need to be
  3638.        formed, and others may need to be broken.  To accomplish
  3639.  
  3640.  
  3641.  
  3642. Moy                         Standards Track                    [Page 65]
  3643.  
  3644. RFC 2178                     OSPF Version 2                    July 1997
  3645.  
  3646.  
  3647.        this, invoke the event AdjOK?  on all neighbors whose state
  3648.        is at least 2-Way.  This will cause their eligibility for
  3649.        adjacency to be reexamined (see Sections 10.3 and 10.4).
  3650.  
  3651.  
  3652.    The reason behind the election algorithm's complexity is the desire
  3653.    for an orderly transition from Backup Designated Router to Designated
  3654.    Router, when the current Designated Router fails.  This orderly
  3655.    transition is ensured through the introduction of hysteresis: no new
  3656.    Backup Designated Router can be chosen until the old Backup accepts
  3657.    its new Designated Router responsibilities.
  3658.  
  3659.    The above procedure may elect the same router to be both Designated
  3660.    Router and Backup Designated Router, although that router will never
  3661.    be the calculating router (Router X) itself.  The elected Designated
  3662.    Router may not be the router having the highest Router Priority, nor
  3663.    will the Backup Designated Router necessarily have the second highest
  3664.    Router Priority.  If Router X is not itself eligible to become
  3665.    Designated Router, it is possible that neither a Backup Designated
  3666.    Router nor a Designated Router will be selected in the above
  3667.    procedure.  Note also that if Router X is the only attached router
  3668.    that is eligible to become Designated Router, it will select itself
  3669.    as Designated Router and there will be no Backup Designated Router
  3670.    for the network.
  3671.  
  3672. 9.5.  Sending Hello packets
  3673.  
  3674.    Hello packets are sent out each functioning router interface.  They
  3675.    are used to discover and maintain neighbor relationships.[6] On
  3676.    broadcast and NBMA networks, Hello Packets are also used to elect the
  3677.    Designated Router and Backup Designated Router.
  3678.  
  3679.    The format of an Hello packet is detailed in Section A.3.2.  The
  3680.    Hello Packet contains the router's Router Priority (used in choosing
  3681.    the Designated Router), and the interval between Hello Packets sent
  3682.    out the interface (HelloInterval).  The Hello Packet also indicates
  3683.    how often a neighbor must be heard from to remain active
  3684.    (RouterDeadInterval).  Both HelloInterval and RouterDeadInterval must
  3685.    be the same for all routers attached to a common network.  The Hello
  3686.    packet also contains the IP address mask of the attached network
  3687.    (Network Mask).  On unnumbered point-to-point networks and on virtual
  3688.    links this field should be set to 0.0.0.0.
  3689.  
  3690.    The Hello packet's Options field describes the router's optional OSPF
  3691.    capabilities.  One optional capability is defined in this
  3692.    specification (see Sections 4.5 and A.2).  The E-bit of the Options
  3693.    field should be set if and only if the attached area is capable of
  3694.    processing AS-external-LSAs (i.e., it is not a stub area). If the E-
  3695.  
  3696.  
  3697.  
  3698. Moy                         Standards Track                    [Page 66]
  3699.  
  3700. RFC 2178                     OSPF Version 2                    July 1997
  3701.  
  3702.  
  3703.    bit is set incorrectly the neighboring routers will refuse to accept
  3704.    the Hello Packet (see Section 10.5).  Unrecognized bits in the Hello
  3705.    Packet's Options field should be set to zero.
  3706.  
  3707.    In order to ensure two-way communication between adjacent routers,
  3708.    the Hello packet contains the list of all routers on the network from
  3709.    which Hello Packets have been seen recently.  The Hello packet also
  3710.    contains the router's current choice for Designated Router and Backup
  3711.    Designated Router.  A value of 0.0.0.0 in these fields means that one
  3712.    has not yet been selected.
  3713.  
  3714.    On broadcast networks and physical point-to-point networks, Hello
  3715.    packets are sent every HelloInterval seconds to the IP multicast
  3716.    address AllSPFRouters.  On virtual links, Hello packets are sent as
  3717.    unicasts (addressed directly to the other end of the virtual link)
  3718.    every HelloInterval seconds. On Point-to-MultiPoint networks,
  3719.    separate Hello packets are sent to each attached neighbor every
  3720.    HelloInterval seconds. Sending of Hello packets on NBMA networks is
  3721.    covered in the next section.
  3722.  
  3723. 9.5.1.  Sending Hello packets on NBMA networks
  3724.  
  3725.    Static configuration information may be necessary in order for the
  3726.    Hello Protocol to function on non-broadcast networks (see Sections
  3727.    C.5 and C.6).  On NBMA networks, every attached router which is
  3728.    eligible to become Designated Router becomes aware of all of its
  3729.    neighbors on the network (either through configuration or by some
  3730.    unspecified mechanism).  Each neighbor is labelled with the
  3731.    neighbor's Designated Router eligibility.
  3732.  
  3733.    The interface state must be at least Waiting for any Hello Packets to
  3734.    be sent out the NBMA interface. Hello Packets are then sent directly
  3735.    (as unicasts) to some subset of a router's neighbors.  Sometimes an
  3736.    Hello Packet is sent periodically on a timer; at other times it is
  3737.    sent as a response to a received Hello Packet.  A router's hello-
  3738.    sending behavior varies depending on whether the router itself is
  3739.    eligible to become Designated Router.
  3740.  
  3741.    If the router is eligible to become Designated Router, it must
  3742.    periodically send Hello Packets to all neighbors that are also
  3743.    eligible. In addition, if the router is itself the Designated Router
  3744.    or Backup Designated Router, it must also send periodic Hello Packets
  3745.    to all other neighbors.  This means that any two eligible routers are
  3746.    always exchanging Hello Packets, which is necessary for the correct
  3747.    operation of the Designated Router election algorithm.  To minimize
  3748.    the number of Hello Packets sent, the number of eligible routers on
  3749.    an NBMA network should be kept small.
  3750.  
  3751.  
  3752.  
  3753.  
  3754. Moy                         Standards Track                    [Page 67]
  3755.  
  3756. RFC 2178                     OSPF Version 2                    July 1997
  3757.  
  3758.  
  3759.    If the router is not eligible to become Designated Router, it must
  3760.    periodically send Hello Packets to both the Designated Router and the
  3761.    Backup Designated Router (if they exist).  It must also send an Hello
  3762.    Packet in reply to an Hello Packet received from any eligible
  3763.    neighbor (other than the current Designated Router and Backup
  3764.    Designated Router).  This is needed to establish an initial
  3765.    bidirectional relationship with any potential Designated Router.
  3766.  
  3767.    When sending Hello packets periodically to any neighbor, the interval
  3768.    between Hello Packets is determined by the neighbor's state.  If the
  3769.    neighbor is in state Down, Hello Packets are sent every PollInterval
  3770.    seconds.  Otherwise, Hello Packets are sent every HelloInterval
  3771.    seconds.
  3772.  
  3773. 10.  The Neighbor Data Structure
  3774.  
  3775.    An OSPF router converses with its neighboring routers.  Each separate
  3776.    conversation is described by a "neighbor data structure".  Each
  3777.    conversation is bound to a particular OSPF router interface, and is
  3778.    identified either by the neighboring router's OSPF Router ID or by
  3779.    its Neighbor IP address (see below). Thus if the OSPF router and
  3780.    another router have multiple attached networks in common, multiple
  3781.    conversations ensue, each described by a unique neighbor data
  3782.    structure.  Each separate conversation is loosely referred to in the
  3783.    text as being a separate "neighbor".
  3784.  
  3785.    The neighbor data structure contains all information pertinent to the
  3786.    forming or formed adjacency between the two neighbors.  (However,
  3787.    remember that not all neighbors become adjacent.)  An adjacency can
  3788.    be viewed as a highly developed conversation between two routers.
  3789.  
  3790.    State
  3791.       The functional level of the neighbor conversation.  This is
  3792.       described in more detail in Section 10.1.
  3793.  
  3794.    Inactivity Timer
  3795.       A single shot timer whose firing indicates that no Hello Packet
  3796.       has been seen from this neighbor recently.  The length of the
  3797.       timer is RouterDeadInterval seconds.
  3798.  
  3799.    Master/Slave
  3800.       When the two neighbors are exchanging databases, they form a
  3801.       master/slave relationship.  The master sends the first Database
  3802.       Description Packet, and is the only part that is allowed to
  3803.       retransmit.  The slave can only respond to the master's Database
  3804.       Description Packets.  The master/slave relationship is negotiated
  3805.       in state ExStart.
  3806.  
  3807.  
  3808.  
  3809.  
  3810. Moy                         Standards Track                    [Page 68]
  3811.  
  3812. RFC 2178                     OSPF Version 2                    July 1997
  3813.  
  3814.  
  3815.    DD Sequence Number
  3816.       The DD Sequence number of the Database Description packet that is
  3817.       currently being sent to the neighbor.
  3818.  
  3819.    Last received Database Description packet
  3820.       The initialize(I), more (M) and master(MS) bits, Options field,
  3821.       and DD sequence number contained in the last Database Description
  3822.       packet received from the neighbor. Used to determine whether the
  3823.       next Database Description packet received from the neighbor is a
  3824.       duplicate.
  3825.  
  3826.    Neighbor ID
  3827.       The OSPF Router ID of the neighboring router.  The Neighbor ID is
  3828.       learned when Hello packets are received from the neighbor, or is
  3829.       configured if this is a virtual adjacency (see Section C.4).
  3830.  
  3831.    Neighbor Priority
  3832.       The Router Priority of the neighboring router. Contained in the
  3833.       neighbor's Hello packets, this item is used when selecting the
  3834.       Designated Router for the attached network.
  3835.  
  3836.    Neighbor IP address
  3837.       The IP address of the neighboring router's interface to the
  3838.       attached network.  Used as the Destination IP address when
  3839.       protocol packets are sent as unicasts along this adjacency.  Also
  3840.       used in router-LSAs as the Link ID for the attached network if the
  3841.       neighboring router is selected to be Designated Router (see
  3842.       Section 12.4.1).  The Neighbor IP address is learned when Hello
  3843.       packets are received from the neighbor.  For virtual links, the
  3844.       Neighbor IP address is learned during the routing table build
  3845.       process (see Section 15).
  3846.  
  3847.    Neighbor Options
  3848.       The optional OSPF capabilities supported by the neighbor.  Learned
  3849.       during the Database Exchange process (see Section 10.6).  The
  3850.       neighbor's optional OSPF capabilities are also listed in its Hello
  3851.       packets. This enables received Hello Packets to be rejected (i.e.,
  3852.       neighbor relationships will not even start to form) if there is a
  3853.       mismatch in certain crucial OSPF capabilities (see Section 10.5).
  3854.       The optional OSPF capabilities are documented in Section 4.5.
  3855.  
  3856.    Neighbor's Designated Router
  3857.       The neighbor's idea of the Designated Router.  If this is the
  3858.       neighbor itself, this is important in the local calculation of the
  3859.       Designated Router. Defined only on broadcast and NBMA networks.
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866. Moy                         Standards Track                    [Page 69]
  3867.  
  3868. RFC 2178                     OSPF Version 2                    July 1997
  3869.  
  3870.  
  3871.    Neighbor's Backup Designated Router
  3872.       The neighbor's idea of the Backup Designated Router.  If this is
  3873.       the neighbor itself, this is important in the local calculation of
  3874.       the Backup Designated Router.  Defined only on broadcast and NBMA
  3875.       networks.
  3876.  
  3877.    The next set of variables are lists of LSAs.  These lists describe
  3878.    subsets of the area link-state database.  This memo defines five
  3879.    distinct types of LSAs, all of which may be present in an area link-
  3880.    state database: router-LSAs, network-LSAs, and Type 3 and 4 summary-
  3881.    LSAs (all stored in the area data structure), and AS- external-LSAs
  3882.    (stored in the global data structure).
  3883.  
  3884.    Link state retransmission list
  3885.       The list of LSAs that have been flooded but not acknowledged on
  3886.       this adjacency.  These will be retransmitted at intervals until
  3887.       they are acknowledged, or until the adjacency is destroyed.
  3888.  
  3889.    Database summary list
  3890.       The complete list of LSAs that make up the area link-state
  3891.       database, at the moment the neighbor goes into Database Exchange
  3892.       state.  This list is sent to the neighbor in Database Description
  3893.       packets.
  3894.  
  3895.    Link state request list
  3896.       The list of LSAs that need to be received from this neighbor in
  3897.       order to synchronize the two neighbors' link-state databases.
  3898.       This list is created as Database Description packets are received,
  3899.       and is then sent to the neighbor in Link State Request packets.
  3900.       The list is depleted as appropriate Link State Update packets are
  3901.       received.
  3902.  
  3903. 10.1.  Neighbor states
  3904.  
  3905.    The state of a neighbor (really, the state of a conversation being
  3906.    held with a neighboring router) is documented in the following
  3907.    sections.  The states are listed in order of progressing
  3908.    functionality.  For example, the inoperative state is listed first,
  3909.    followed by a list of intermediate states before the final, fully
  3910.    functional state is achieved.  The specification makes use of this
  3911.    ordering by sometimes making references such as "those
  3912.    neighbors/adjacencies in state greater than X".  Figures 12 and 13
  3913.    show the graph of neighbor state changes.  The arcs of the graphs are
  3914.    labelled with the event causing the state change.  The neighbor
  3915.    events are documented in Section 10.2.
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922. Moy                         Standards Track                    [Page 70]
  3923.  
  3924. RFC 2178                     OSPF Version 2                    July 1997
  3925.  
  3926.  
  3927.    The graph in Figure 12 shows the state changes effected by the Hello
  3928.    Protocol.  The Hello Protocol is responsible for neighbor acquisition
  3929.    and maintenance, and for ensuring two way communication between
  3930.    neighbors.
  3931.  
  3932.    The graph in Figure 13 shows the forming of an adjacency.  Not every
  3933.    two neighboring routers become adjacent (see Section 10.4).  The
  3934.    adjacency starts to form when the neighbor is in state ExStart.
  3935.    After the two routers discover their master/slave status, the state
  3936.    transitions to Exchange.  At this point the neighbor starts to be
  3937.    used in the flooding procedure, and the two neighboring routers begin
  3938.    synchronizing their databases.  When this synchronization is
  3939.    finished, the neighbor is in state Full and we say that the two
  3940.    routers are fully adjacent.  At this point the adjacency is listed in
  3941.    LSAs.
  3942.  
  3943.    For a more detailed description of neighbor state changes, together
  3944.    with the additional actions involved in each change, see Section
  3945.    10.3.
  3946.  
  3947.    Down
  3948.       This is the initial state of a neighbor conversation.  It
  3949.       indicates that there has been no recent information received from
  3950.       the neighbor. On NBMA networks, Hello packets may still be sent to
  3951.       "Down" neighbors, although at a reduced frequency (see Section
  3952.       9.5.1).
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978. Moy                         Standards Track                    [Page 71]
  3979.  
  3980. RFC 2178                     OSPF Version 2                    July 1997
  3981.  
  3982.  
  3983.                                    +----+
  3984.                                    |Down|
  3985.                                    +----+
  3986.                                      |\
  3987.                                      | \Start
  3988.                                      |  \      +-------+
  3989.                              Hello   |   +---->|Attempt|
  3990.                             Received |         +-------+
  3991.                                      |             |
  3992.                              +----+<-+             |HelloReceived
  3993.                              |Init|<---------------+
  3994.                              +----+<--------+
  3995.                                 |           |
  3996.                                 |2-Way      |1-Way
  3997.                                 |Received   |Received
  3998.                                 |           |
  3999.               +-------+         |        +-----+
  4000.               |ExStart|<--------+------->|2-Way|
  4001.               +-------+                  +-----+
  4002.  
  4003.            Figure 12: Neighbor state changes (Hello Protocol)
  4004.  
  4005.              In addition to the state transitions pictured,
  4006.                 Event KillNbr always forces Down State,
  4007.             Event Inactivity Timer always forces Down State,
  4008.                  Event LLDown always forces Down State
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034. Moy                         Standards Track                    [Page 72]
  4035.  
  4036. RFC 2178                     OSPF Version 2                    July 1997
  4037.  
  4038.  
  4039.                                   +-------+
  4040.                                   |ExStart|
  4041.                                   +-------+
  4042.                                     |
  4043.                      NegotiationDone|
  4044.                                     +->+--------+
  4045.                                        |Exchange|
  4046.                                     +--+--------+
  4047.                                     |
  4048.                             Exchange|
  4049.                               Done  |
  4050.                     +----+          |      +-------+
  4051.                     |Full|<---------+----->|Loading|
  4052.                     +----+<-+              +-------+
  4053.                             |  LoadingDone     |
  4054.                             +------------------+
  4055.  
  4056.          Figure 13: Neighbor state changes (Database Exchange)
  4057.  
  4058.              In addition to the state transitions pictured,
  4059.              Event SeqNumberMismatch forces ExStart state,
  4060.                   Event BadLSReq forces ExStart state,
  4061.                      Event 1-Way forces Init state,
  4062.                 Event KillNbr always forces Down State,
  4063.             Event InactivityTimer always forces Down State,
  4064.                  Event LLDown always forces Down State,
  4065.             Event AdjOK? leads to adjacency forming/breaking
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090. Moy                         Standards Track                    [Page 73]
  4091.  
  4092. RFC 2178                     OSPF Version 2                    July 1997
  4093.  
  4094.  
  4095.    Attempt
  4096.       This state is only valid for neighbors attached to NBMA networks.
  4097.       It indicates that no recent information has been received from the
  4098.       neighbor, but that a more concerted effort should be made to
  4099.       contact the neighbor.  This is done by sending the neighbor Hello
  4100.       packets at intervals of HelloInterval (see Section 9.5.1).
  4101.  
  4102.    Init
  4103.       In this state, an Hello packet has recently been seen from the
  4104.       neighbor.  However, bidirectional communication has not yet been
  4105.       established with the neighbor (i.e., the router itself did not
  4106.       appear in the neighbor's Hello packet).  All neighbors in this
  4107.       state (or higher) are listed in the Hello packets sent from the
  4108.       associated interface.
  4109.  
  4110.    2-Way
  4111.       In this state, communication between the two routers is
  4112.       bidirectional.  This has been assured by the operation of the
  4113.       Hello Protocol.  This is the most advanced state short of
  4114.       beginning adjacency establishment.  The (Backup) Designated Router
  4115.       is selected from the set of neighbors in state 2-Way or greater.
  4116.  
  4117.    ExStart
  4118.       This is the first step in creating an adjacency between the two
  4119.       neighboring routers.  The goal of this step is to decide which
  4120.       router is the master, and to decide upon the initial DD sequence
  4121.       number.  Neighbor conversations in this state or greater are
  4122.       called adjacencies.
  4123.  
  4124.    Exchange
  4125.       In this state the router is describing its entire link state
  4126.       database by sending Database Description packets to the neighbor.
  4127.       Each Database Description Packet has a DD sequence number, and is
  4128.       explicitly acknowledged.  Only one Database Description Packet is
  4129.       allowed outstanding at any one time.  In this state, Link State
  4130.       Request Packets may also be sent asking for the neighbor's more
  4131.       recent LSAs.  All adjacencies in Exchange state or greater are
  4132.       used by the flooding procedure.  In fact, these adjacencies are
  4133.       fully capable of transmitting and receiving all types of OSPF
  4134.       routing protocol packets.
  4135.  
  4136.    Loading
  4137.       In this state, Link State Request packets are sent to the neighbor
  4138.       asking for the more recent LSAs that have been discovered (but not
  4139.       yet received) in the Exchange state.
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146. Moy                         Standards Track                    [Page 74]
  4147.  
  4148. RFC 2178                     OSPF Version 2                    July 1997
  4149.  
  4150.  
  4151.    Full
  4152.       In this state, the neighboring routers are fully adjacent.  These
  4153.       adjacencies will now appear in router-LSAs and network-LSAs.
  4154.  
  4155. 10.2.  Events causing neighbor state changes
  4156.  
  4157.    State changes can be effected by a number of events.  These events
  4158.    are shown in the labels of the arcs in Figures 12 and 13.  The label
  4159.    definitions are as follows:
  4160.  
  4161.    HelloReceived
  4162.       An Hello packet has been received from the neighbor.
  4163.  
  4164.    Start
  4165.       This is an indication that Hello Packets should now be sent to the
  4166.       neighbor at intervals of HelloInterval seconds.  This event is
  4167.       generated only for neighbors associated with NBMA networks.
  4168.  
  4169.    2-WayReceived
  4170.       Bidirectional communication has been realized between the two
  4171.       neighboring routers.  This is indicated by the router seeing
  4172.       itself in the neighbor's Hello packet.
  4173.  
  4174.    NegotiationDone
  4175.       The Master/Slave relationship has been negotiated, and DD sequence
  4176.       numbers have been exchanged.  This signals the start of the
  4177.       sending/receiving of Database Description packets.  For more
  4178.       information on the generation of this event, consult Section 10.8.
  4179.  
  4180.    ExchangeDone
  4181.       Both routers have successfully transmitted a full sequence of
  4182.       Database Description packets.  Each router now knows what parts of
  4183.       its link state database are out of date.  For more information on
  4184.       the generation of this event, consult Section 10.8.
  4185.  
  4186.    BadLSReq
  4187.       A Link State Request has been received for an LSA not contained in
  4188.       the database. This indicates an error in the Database Exchange
  4189.       process.
  4190.  
  4191.    Loading Done
  4192.       Link State Updates have been received for all out-of-date portions
  4193.       of the database.  This is indicated by the Link state request list
  4194.       becoming empty after the Database Exchange process has completed.
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202. Moy                         Standards Track                    [Page 75]
  4203.  
  4204. RFC 2178                     OSPF Version 2                    July 1997
  4205.  
  4206.  
  4207.    AdjOK?
  4208.       A decision must be made as to whether an adjacency should be
  4209.       established/maintained with the neighbor.  This event will start
  4210.       some adjacencies forming, and destroy others.
  4211.  
  4212.    The following events cause well developed neighbors to revert to
  4213.    lesser states.  Unlike the above events, these events may occur when
  4214.    the neighbor conversation is in any of a number of states.
  4215.  
  4216.    SeqNumberMismatch
  4217.       A Database Description packet has been received that either a) has
  4218.       an unexpected DD sequence number, b) unexpectedly has the Init bit
  4219.       set or c) has an Options field differing from the last Options
  4220.       field received in a Database Description packet.  Any of these
  4221.       conditions indicate that some error has occurred during adjacency
  4222.       establishment.
  4223.  
  4224.    1-Way
  4225.       An Hello packet has been received from the neighbor, in which the
  4226.       router is not mentioned. This indicates that communication with
  4227.       the neighbor is not bidirectional.
  4228.  
  4229.    KillNbr
  4230.       This is an indication that all communication with the neighbor is
  4231.       now impossible, forcing the neighbor to revert to Down state.
  4232.  
  4233.    InactivityTimer
  4234.       The inactivity Timer has fired.  This means that no Hello packets
  4235.       have been seen recently from the neighbor. The neighbor reverts to
  4236.       Down state.
  4237.  
  4238.    LLDown
  4239.       This is an indication from the lower level protocols that the
  4240.       neighbor is now unreachable.  For example, on an X.25 network this
  4241.       could be indicated by an X.25 clear indication with appropriate
  4242.       cause and diagnostic fields.  This event forces the neighbor into
  4243.       Down state.
  4244.  
  4245. 10.3.  The Neighbor state machine
  4246.  
  4247.    A detailed description of the neighbor state changes follows.  Each
  4248.    state change is invoked by an event (Section 10.2).  This event may
  4249.    produce different effects, depending on the current state of the
  4250.    neighbor.  For this reason, the state machine below is organized by
  4251.    current neighbor state and received event.  Each entry in the state
  4252.    machine describes the resulting new neighbor state and the required
  4253.    set of additional actions.
  4254.  
  4255.  
  4256.  
  4257.  
  4258. Moy                         Standards Track                    [Page 76]
  4259.  
  4260. RFC 2178                     OSPF Version 2                    July 1997
  4261.  
  4262.  
  4263.    When a neighbor's state changes, it may be necessary to rerun the
  4264.    Designated Router election algorithm.  This is determined by whether
  4265.    the interface NeighborChange event is generated (see Section 9.2).
  4266.    Also, if the Interface is in DR state (the router is itself
  4267.    Designated Router), changes in neighbor state may cause a new
  4268.    network-LSA to be originated (see Section 12.4).
  4269.  
  4270.    When the neighbor state machine needs to invoke the interface state
  4271.    machine, it should be done as a scheduled task (see Section 4.4).
  4272.    This simplifies things, by ensuring that neither state machine will
  4273.    be executed recursively.
  4274.  
  4275.  
  4276.     State(s):  Down
  4277.  
  4278.        Event:  Start
  4279.  
  4280.    New state:  Attempt
  4281.  
  4282.       Action:  Send an Hello Packet to the neighbor (this neighbor
  4283.                is always associated with an NBMA network) and start
  4284.                the Inactivity Timer for the neighbor.  The timer's
  4285.                later firing would indicate that communication with
  4286.                the neighbor was not attained.
  4287.  
  4288.  
  4289.     State(s):  Attempt
  4290.  
  4291.        Event:  HelloReceived
  4292.  
  4293.    New state:  Init
  4294.  
  4295.       Action:  Restart the Inactivity Timer for the neighbor, since
  4296.                the neighbor has now been heard from.
  4297.  
  4298.  
  4299.     State(s):  Down
  4300.  
  4301.        Event:  HelloReceived
  4302.  
  4303.    New state:  Init
  4304.  
  4305.       Action:  Start the Inactivity Timer for the neighbor.  The
  4306.                timer's later firing would indicate that the neighbor
  4307.                is dead.
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314. Moy                         Standards Track                    [Page 77]
  4315.  
  4316. RFC 2178                     OSPF Version 2                    July 1997
  4317.  
  4318.  
  4319.     State(s):  Init or greater
  4320.  
  4321.        Event:  HelloReceived
  4322.  
  4323.    New state:  No state change.
  4324.  
  4325.       Action:  Restart the Inactivity Timer for the neighbor, since
  4326.                the neighbor has again been heard from.
  4327.  
  4328.  
  4329.     State(s):  Init
  4330.  
  4331.        Event:  2-WayReceived
  4332.  
  4333.    New state:  Depends upon action routine.
  4334.  
  4335.       Action:  Determine whether an adjacency should be established
  4336.                with the neighbor (see Section 10.4).  If not, the
  4337.                new neighbor state is 2-Way.
  4338.  
  4339.                Otherwise (an adjacency should be established) the
  4340.                neighbor state transitions to ExStart.  Upon
  4341.                entering this state, the router increments the DD
  4342.                sequence number in the neighbor data structure.  If
  4343.                this is the first time that an adjacency has been
  4344.                attempted, the DD sequence number should be assigned
  4345.                some unique value (like the time of day clock).  It
  4346.                then declares itself master (sets the master/slave
  4347.                bit to master), and starts sending Database
  4348.                Description Packets, with the initialize (I), more
  4349.                (M) and master (MS) bits set.  This Database
  4350.                Description Packet should be otherwise empty.  This
  4351.                Database Description Packet should be retransmitted
  4352.                at intervals of RxmtInterval until the next state is
  4353.                entered (see Section 10.8).
  4354.  
  4355.  
  4356.     State(s):  ExStart
  4357.  
  4358.        Event:  NegotiationDone
  4359.  
  4360.    New state:  Exchange
  4361.  
  4362.       Action:  The router must list the contents of its entire area
  4363.                link state database in the neighbor Database summary
  4364.                list.  The area link state database consists of the
  4365.                router-LSAs, network-LSAs and summary-LSAs contained
  4366.                in the area structure, along with the AS-external-
  4367.  
  4368.  
  4369.  
  4370. Moy                         Standards Track                    [Page 78]
  4371.  
  4372. RFC 2178                     OSPF Version 2                    July 1997
  4373.  
  4374.  
  4375.                LSAs contained in the global structure.  AS-
  4376.                external-LSAs are omitted from a virtual neighbor's
  4377.                Database summary list.  AS-external-LSAs are omitted
  4378.                from the Database summary list if the area has been
  4379.                configured as a stub (see Section 3.6).  LSAs whose
  4380.                age is equal to MaxAge are instead added to the
  4381.                neighbor's Link state retransmission list.  A
  4382.                summary of the Database summary list will be sent to
  4383.                the neighbor in Database Description packets.  Each
  4384.                Database Description Packet has a DD sequence
  4385.                number, and is explicitly acknowledged.  Only one
  4386.                Database Description Packet is allowed outstanding
  4387.                at any one time.  For more detail on the sending and
  4388.                receiving of Database Description packets, see
  4389.                Sections 10.8 and 10.6.
  4390.  
  4391.  
  4392.     State(s):  Exchange
  4393.  
  4394.        Event:  ExchangeDone
  4395.  
  4396.    New state:  Depends upon action routine.
  4397.  
  4398.       Action:  If the neighbor Link state request list is empty,
  4399.                the new neighbor state is Full.  No other action is
  4400.                required.  This is an adjacency's final state.
  4401.  
  4402.                Otherwise, the new neighbor state is Loading.  Start
  4403.                (or continue) sending Link State Request packets to
  4404.                the neighbor (see Section 10.9).  These are requests
  4405.                for the neighbor's more recent LSAs (which were
  4406.                discovered but not yet received in the Exchange
  4407.                state).  These LSAs are listed in the Link state
  4408.                request list associated with the neighbor.
  4409.  
  4410.  
  4411.     State(s):  Loading
  4412.  
  4413.        Event:  Loading Done
  4414.  
  4415.    New state:  Full
  4416.  
  4417.       Action:  No action required.  This is an adjacency's final
  4418.                state.
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426. Moy                         Standards Track                    [Page 79]
  4427.  
  4428. RFC 2178                     OSPF Version 2                    July 1997
  4429.  
  4430.  
  4431.     State(s):  2-Way
  4432.  
  4433.        Event:  AdjOK?
  4434.  
  4435.    New state:  Depends upon action routine.
  4436.  
  4437.       Action:  Determine whether an adjacency should be formed with
  4438.                the neighboring router (see Section 10.4).  If not,
  4439.                the neighbor state remains at 2-Way.  Otherwise,
  4440.                transition the neighbor state to ExStart and perform
  4441.                the actions associated with the above state machine
  4442.                entry for state Init and event 2-WayReceived.
  4443.  
  4444.  
  4445.     State(s):  ExStart or greater
  4446.  
  4447.        Event:  AdjOK?
  4448.  
  4449.    New state:  Depends upon action routine.
  4450.  
  4451.       Action:  Determine whether the neighboring router should
  4452.                still be adjacent.  If yes, there is no state change
  4453.                and no further action is necessary.
  4454.  
  4455.                Otherwise, the (possibly partially formed) adjacency
  4456.                must be destroyed.  The neighbor state transitions
  4457.                to 2-Way.  The Link state retransmission list,
  4458.                Database summary list and Link state request list
  4459.                are cleared of LSAs.
  4460.  
  4461.  
  4462.     State(s):  Exchange or greater
  4463.  
  4464.        Event:  SeqNumberMismatch
  4465.  
  4466.    New state:  ExStart
  4467.  
  4468.       Action:  The (possibly partially formed) adjacency is torn
  4469.                down, and then an attempt is made at
  4470.                reestablishment.  The neighbor state first
  4471.                transitions to ExStart.  The Link state
  4472.                retransmission list, Database summary list and Link
  4473.                state request list are cleared of LSAs.  Then the
  4474.                router increments the DD sequence number in the
  4475.                neighbor data structure, declares itself master
  4476.                (sets the master/slave bit to master), and starts
  4477.                sending Database Description Packets, with the
  4478.                initialize (I), more (M) and master (MS) bits set.
  4479.  
  4480.  
  4481.  
  4482. Moy                         Standards Track                    [Page 80]
  4483.  
  4484. RFC 2178                     OSPF Version 2                    July 1997
  4485.  
  4486.  
  4487.                This Database Description Packet should be otherwise
  4488.                empty (see Section 10.8).
  4489.  
  4490.  
  4491.     State(s):  Exchange or greater
  4492.  
  4493.        Event:  BadLSReq
  4494.  
  4495.    New state:  ExStart
  4496.  
  4497.       Action:  The action for event BadLSReq is exactly the same as
  4498.                for the neighbor event SeqNumberMismatch.  The
  4499.                (possibly partially formed) adjacency is torn down,
  4500.                and then an attempt is made at reestablishment.  For
  4501.                more information, see the neighbor state machine
  4502.                entry that is invoked when event SeqNumberMismatch
  4503.                is generated in state Exchange or greater.
  4504.  
  4505.  
  4506.     State(s):  Any state
  4507.  
  4508.        Event:  KillNbr
  4509.  
  4510.    New state:  Down
  4511.  
  4512.       Action:  The Link state retransmission list, Database summary
  4513.                list and Link state request list are cleared of
  4514.                LSAs.  Also, the Inactivity Timer is disabled.
  4515.  
  4516.  
  4517.     State(s):  Any state
  4518.  
  4519.        Event:  LLDown
  4520.  
  4521.    New state:  Down
  4522.  
  4523.       Action:  The Link state retransmission list, Database summary
  4524.                list and Link state request list are cleared of
  4525.                LSAs.  Also, the Inactivity Timer is disabled.
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538. Moy                         Standards Track                    [Page 81]
  4539.  
  4540. RFC 2178                     OSPF Version 2                    July 1997
  4541.  
  4542.  
  4543.     State(s):  Any state
  4544.  
  4545.        Event:  InactivityTimer
  4546.  
  4547.    New state:  Down
  4548.  
  4549.       Action:  The Link state retransmission list, Database summary
  4550.                list and Link state request list are cleared of
  4551.                LSAs.
  4552.  
  4553.  
  4554.     State(s):  2-Way or greater
  4555.  
  4556.        Event:  1-WayReceived
  4557.  
  4558.    New state:  Init
  4559.  
  4560.       Action:  The Link state retransmission list, Database summary
  4561.                list and Link state request list are cleared of
  4562.                LSAs.
  4563.  
  4564.  
  4565.     State(s):  2-Way or greater
  4566.  
  4567.        Event:  2-WayReceived
  4568.  
  4569.    New state:  No state change.
  4570.  
  4571.       Action:  No action required.
  4572.  
  4573.  
  4574.     State(s):  Init
  4575.  
  4576.        Event:  1-WayReceived
  4577.  
  4578.    New state:  No state change.
  4579.  
  4580.       Action:  No action required.
  4581.  
  4582.  
  4583. 10.4.  Whether to become adjacent
  4584.  
  4585.    Adjacencies are established with some subset of the router's
  4586.    neighbors.  Routers connected by point-to-point networks, Point-to-
  4587.    MultiPoint networks and virtual links always become adjacent.  On
  4588.    broadcast and NBMA networks, all routers become adjacent to both the
  4589.    Designated Router and the Backup Designated Router.
  4590.  
  4591.  
  4592.  
  4593.  
  4594. Moy                         Standards Track                    [Page 82]
  4595.  
  4596. RFC 2178                     OSPF Version 2                    July 1997
  4597.  
  4598.  
  4599.    The adjacency-forming decision occurs in two places in the neighbor
  4600.    state machine.  First, when bidirectional communication is initially
  4601.    established with the neighbor, and secondly, when the identity of the
  4602.    attached network's (Backup) Designated Router changes.  If the
  4603.    decision is made to not attempt an adjacency, the state of the
  4604.    neighbor communication stops at 2-Way.
  4605.  
  4606.    An adjacency should be established with a bidirectional neighbor when
  4607.    at least one of the following conditions holds:
  4608.  
  4609.    o   The underlying network type is point-to-point
  4610.  
  4611.    o   The underlying network type is Point-to-MultiPoint
  4612.  
  4613.    o   The underlying network type is virtual link
  4614.  
  4615.    o   The router itself is the Designated Router
  4616.  
  4617.    o   The router itself is the Backup Designated Router
  4618.  
  4619.    o   The neighboring router is the Designated Router
  4620.  
  4621.    o   The neighboring router is the Backup Designated Router
  4622.  
  4623. 10.5.  Receiving Hello Packets
  4624.  
  4625.    This section explains the detailed processing of a received Hello
  4626.    Packet.  (See Section A.3.2 for the format of Hello packets.)  The
  4627.    generic input processing of OSPF packets will have checked the
  4628.    validity of the IP header and the OSPF packet header.  Next, the
  4629.    values of the Network Mask, HelloInterval, and RouterDeadInterval
  4630.    fields in the received Hello packet must be checked against the
  4631.    values configured for the receiving interface.  Any mismatch causes
  4632.    processing to stop and the packet to be dropped.  In other words, the
  4633.    above fields are really describing the attached network's
  4634.    configuration.  However, there is one exception to the above rule: on
  4635.    point-to-point networks and on virtual links, the Network Mask in the
  4636.    received Hello Packet should be ignored.
  4637.  
  4638.    The receiving interface attaches to a single OSPF area (this could be
  4639.    the backbone).  The setting of the E-bit found in the Hello Packet's
  4640.    Options field must match this area's ExternalRoutingCapability.  If
  4641.    AS-external-LSAs are not flooded into/throughout the area (i.e, the
  4642.    area is a "stub") the E-bit must be clear in received Hello Packets,
  4643.    otherwise the E-bit must be set.  A mismatch causes processing to
  4644.    stop and the packet to be dropped.  The setting of the rest of the
  4645.    bits in the Hello Packet's Options field should be ignored.
  4646.  
  4647.  
  4648.  
  4649.  
  4650. Moy                         Standards Track                    [Page 83]
  4651.  
  4652. RFC 2178                     OSPF Version 2                    July 1997
  4653.  
  4654.  
  4655.    At this point, an attempt is made to match the source of the Hello
  4656.    Packet to one of the receiving interface's neighbors.  If the
  4657.    receiving interface connects to a broadcast, Point-to-MultiPoint or
  4658.    NBMA network the source is identified by the IP source address found
  4659.    in the Hello's IP header.  If the receiving interface connects to a
  4660.    point-to-point link or a virtual link, the source is identified by
  4661.    the Router ID found in the Hello's OSPF packet header.  The
  4662.    interface's current list of neighbors is contained in the interface's
  4663.    data structure.  If a matching neighbor structure cannot be found,
  4664.    (i.e., this is the first time the neighbor has been detected), one is
  4665.    created.  The initial state of a newly created neighbor is set to
  4666.    Down.
  4667.  
  4668.    When receiving an Hello Packet from a neighbor on a broadcast,
  4669.    Point-to-MultiPoint or NBMA network, set the neighbor structure's
  4670.    Neighbor ID equal to the Router ID found in the packet's OSPF header.
  4671.    When receiving an Hello on a point-to-point network (but not on a
  4672.    virtual link) set the neighbor structure's Neighbor IP address to the
  4673.    packet's IP source address.
  4674.  
  4675.    Now the rest of the Hello Packet is examined, generating events to be
  4676.    given to the neighbor and interface state machines.  These state
  4677.    machines are specified either to be executed or scheduled (see
  4678.    Section 4.4).  For example, by specifying below that the neighbor
  4679.    state machine be executed in line, several neighbor state transitions
  4680.    may be effected by a single received Hello:
  4681.  
  4682.    o   Each Hello Packet causes the neighbor state machine to be
  4683.        executed with the event HelloReceived.
  4684.  
  4685.    o   Then the list of neighbors contained in the Hello Packet is
  4686.        examined.  If the router itself appears in this list, the
  4687.        neighbor state machine should be executed with the event 2-
  4688.        WayReceived.  Otherwise, the neighbor state machine should
  4689.        be executed with the event 1-WayReceived, and the processing
  4690.        of the packet stops.
  4691.  
  4692.    o   Next, the Hello Packet's Router Priority field is examined.
  4693.        If this field is different than the one previously received
  4694.        from the neighbor, the receiving interface's state machine
  4695.        is scheduled with the event NeighborChange.  In any case,
  4696.        the Router Priority field in the neighbor data structure
  4697.        should be updated accordingly.
  4698.  
  4699.    o   Next the Designated Router field in the Hello Packet is
  4700.        examined.  If the neighbor is both declaring itself to be
  4701.        Designated Router (Designated Router field = Neighbor IP
  4702.        address) and the Backup Designated Router field in the
  4703.  
  4704.  
  4705.  
  4706. Moy                         Standards Track                    [Page 84]
  4707.  
  4708. RFC 2178                     OSPF Version 2                    July 1997
  4709.  
  4710.  
  4711.        packet is equal to 0.0.0.0 and the receiving interface is in
  4712.        state Waiting, the receiving interface's state machine is
  4713.        scheduled with the event BackupSeen.  Otherwise, if the
  4714.        neighbor is declaring itself to be Designated Router and it
  4715.        had not previously, or the neighbor is not declaring itself
  4716.        Designated Router where it had previously, the receiving
  4717.        interface's state machine is scheduled with the event
  4718.        NeighborChange.  In any case, the Neighbors' Designated
  4719.        Router item in the neighbor structure is updated
  4720.        accordingly.
  4721.  
  4722.    o   Finally, the Backup Designated Router field in the Hello
  4723.        Packet is examined.  If the neighbor is declaring itself to
  4724.        be Backup Designated Router (Backup Designated Router field
  4725.        = Neighbor IP address) and the receiving interface is in
  4726.        state Waiting, the receiving interface's state machine is
  4727.        scheduled with the event BackupSeen.  Otherwise, if the
  4728.        neighbor is declaring itself to be Backup Designated Router
  4729.        and it had not previously, or the neighbor is not declaring
  4730.        itself Backup Designated Router where it had previously, the
  4731.        receiving interface's state machine is scheduled with the
  4732.        event NeighborChange.  In any case, the Neighbor's Backup
  4733.        Designated Router item in the neighbor structure is updated
  4734.        accordingly.
  4735.  
  4736.    On NBMA networks, receipt of an Hello Packet may also cause an Hello
  4737.    Packet to be sent back to the neighbor in response. See Section 9.5.1
  4738.    for more details.
  4739.  
  4740. 10.6.  Receiving Database Description Packets
  4741.  
  4742.    This section explains the detailed processing of a received Database
  4743.    Description Packet.  The incoming Database Description Packet has
  4744.    already been associated with a neighbor and receiving interface by
  4745.    the generic input packet processing (Section 8.2).  Whether the
  4746.    Database Description packet should be accepted, and if so, how it
  4747.    should be further processed depends upon the neighbor state.
  4748.  
  4749.    If a Database Description packet is accepted, the following packet
  4750.    fields should be saved in the corresponding neighbor data structure
  4751.    under "last received Database Description packet": the packet's
  4752.    initialize(I), more (M) and master(MS) bits, Options field, and DD
  4753.    sequence number. If these fields are set identically in two
  4754.    consecutive Database Description packets received from the neighbor,
  4755.    the second Database Description packet is considered to be a
  4756.    "duplicate" in the processing described below.
  4757.  
  4758.  
  4759.  
  4760.  
  4761.  
  4762. Moy                         Standards Track                    [Page 85]
  4763.  
  4764. RFC 2178                     OSPF Version 2                    July 1997
  4765.  
  4766.  
  4767.    If the Interface MTU field in the Database Description packet
  4768.    indicates an IP datagram size that is larger than the router can
  4769.    accept on the receiving interface without fragmentation, the Database
  4770.    Description packet is rejected.  Otherwise, if the neighbor state is:
  4771.  
  4772.    Down
  4773.       The packet should be rejected.
  4774.  
  4775.    Attempt
  4776.       The packet should be rejected.
  4777.  
  4778.    Init
  4779.       The neighbor state machine should be executed with the event 2-
  4780.       WayReceived.  This causes an immediate state change to either
  4781.       state 2-Way or state ExStart. If the new state is ExStart, the
  4782.       processing of the current packet should then continue in this new
  4783.       state by falling through to case ExStart below.
  4784.  
  4785.    2-Way
  4786.       The packet should be ignored.  Database Description Packets are
  4787.       used only for the purpose of bringing up adjacencies.[7]
  4788.  
  4789.    ExStart
  4790.       If the received packet matches one of the following cases, then
  4791.       the neighbor state machine should be executed with the event
  4792.       NegotiationDone (causing the state to transition to Exchange), the
  4793.       packet's Options field should be recorded in the neighbor
  4794.       structure's Neighbor Options field and the packet should be
  4795.       accepted as next in sequence and processed further (see below).
  4796.       Otherwise, the packet should be ignored.
  4797.  
  4798.        o   The initialize(I), more (M) and master(MS) bits are set,
  4799.            the contents of the packet are empty, and the neighbor's
  4800.            Router ID is larger than the router's own.  In this case
  4801.            the router is now Slave.  Set the master/slave bit to
  4802.            slave, and set the neighbor data structure's DD sequence
  4803.            number to that specified by the master.
  4804.  
  4805.        o   The initialize(I) and master(MS) bits are off, the
  4806.            packet's DD sequence number equals the neighbor data
  4807.            structure's DD sequence number (indicating
  4808.            acknowledgment) and the neighbor's Router ID is smaller
  4809.            than the router's own.  In this case the router is
  4810.            Master.
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818. Moy                         Standards Track                    [Page 86]
  4819.  
  4820. RFC 2178                     OSPF Version 2                    July 1997
  4821.  
  4822.  
  4823.    Exchange
  4824.       Duplicate Database Description packets are discarded by the
  4825.       master, and cause the slave to retransmit the last Database
  4826.       Description packet that it had sent. Otherwise (the packet is not
  4827.       a duplicate):
  4828.  
  4829.        o   If the state of the MS-bit is inconsistent with the
  4830.            master/slave state of the connection, generate the
  4831.            neighbor event SeqNumberMismatch and stop processing the
  4832.            packet.
  4833.  
  4834.        o   If the initialize(I) bit is set, generate the neighbor
  4835.            event SeqNumberMismatch and stop processing the packet.
  4836.  
  4837.        o   If the packet's Options field indicates a different set
  4838.            of optional OSPF capabilities than were previously
  4839.            received from the neighbor (recorded in the Neighbor
  4840.            Options field of the neighbor structure), generate the
  4841.            neighbor event SeqNumberMismatch and stop processing the
  4842.            packet.
  4843.  
  4844.        o   Database Description packets must be processed in
  4845.            sequence, as indicated by the packets' DD sequence
  4846.            numbers. If the router is master, the next packet
  4847.            received should have DD sequence number equal to the DD
  4848.            sequence number in the neighbor data structure. If the
  4849.            router is slave, the next packet received should have DD
  4850.            sequence number equal to one more than the DD sequence
  4851.            number stored in the neighbor data structure. In either
  4852.            case, if the packet is the next in sequence it should be
  4853.            accepted and its contents processed as specified below.
  4854.  
  4855.        o   Else, generate the neighbor event SeqNumberMismatch and
  4856.            stop processing the packet.
  4857.  
  4858.    Loading or Full
  4859.       In this state, the router has sent and received an entire sequence
  4860.       of Database Description Packets.  The only packets received should
  4861.       be duplicates (see above). In particular, the packet's Options
  4862.       field should match the set of optional OSPF capabilities
  4863.       previously indicated by the neighbor (stored in the neighbor
  4864.       structure's Neighbor Options field).  Any other packets received,
  4865.       including the reception of a packet with the Initialize(I) bit
  4866.       set, should generate the neighbor event SeqNumberMismatch.[8]
  4867.       Duplicates should be discarded by the master.  The slave must
  4868.       respond to duplicates by repeating the last Database Description
  4869.       packet that it had sent.
  4870.  
  4871.  
  4872.  
  4873.  
  4874. Moy                         Standards Track                    [Page 87]
  4875.  
  4876. RFC 2178                     OSPF Version 2                    July 1997
  4877.  
  4878.  
  4879.    When the router accepts a received Database Description Packet as the
  4880.    next in sequence the packet contents are processed as follows.  For
  4881.    each LSA listed, the LSA's LS type is checked for validity.  If the
  4882.    LS type is unknown (e.g., not one of the LS types 1-5 defined by this
  4883.    specification), or if this is an AS-external-LSA (LS type = 5) and
  4884.    the neighbor is associated with a stub area, generate the neighbor
  4885.    event SeqNumberMismatch and stop processing the packet.  Otherwise,
  4886.    the router looks up the LSA in its database to see whether it also
  4887.    has an instance of the LSA.  If it does not, or if the database copy
  4888.    is less recent (see Section 13.1), the LSA is put on the Link state
  4889.    request list so that it can be requested (immediately or at some
  4890.    later time) in Link State Request Packets.
  4891.  
  4892.    When the router accepts a received Database Description Packet as the
  4893.    next in sequence, it also performs the following actions, depending
  4894.    on whether it is master or slave:
  4895.  
  4896.    Master
  4897.       Increments the DD sequence number in the neighbor data structure.
  4898.       If the router has already sent its entire sequence of Database
  4899.       Description Packets, and the just accepted packet has the more bit
  4900.       (M) set to 0, the neighbor event ExchangeDone is generated.
  4901.       Otherwise, it should send a new Database Description to the slave.
  4902.  
  4903.    Slave
  4904.       Sets the DD sequence number in the neighbor data structure to the
  4905.       DD sequence number appearing in the received packet.  The slave
  4906.       must send a Database Description Packet in reply.  If the received
  4907.       packet has the more bit (M) set to 0, and the packet to be sent by
  4908.       the slave will also have the M-bit set to 0, the neighbor event
  4909.       ExchangeDone is generated.  Note that the slave always generates
  4910.       this event before the master.
  4911.  
  4912. 10.7.  Receiving Link State Request Packets
  4913.  
  4914.    This section explains the detailed processing of received Link State
  4915.    Request packets.  Received Link State Request Packets specify a list
  4916.    of LSAs that the neighbor wishes to receive.  Link State Request
  4917.    Packets should be accepted when the neighbor is in states Exchange,
  4918.    Loading, or Full.  In all other states Link State Request Packets
  4919.    should be ignored.
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930. Moy                         Standards Track                    [Page 88]
  4931.  
  4932. RFC 2178                     OSPF Version 2                    July 1997
  4933.  
  4934.  
  4935.    Each LSA specified in the Link State Request packet should be located
  4936.    in the router's database, and copied into Link State Update packets
  4937.    for transmission to the neighbor.  These LSAs should NOT be placed on
  4938.    the Link state retransmission list for the neighbor.  If an LSA
  4939.    cannot be found in the database, something has gone wrong with the
  4940.    Database Exchange process, and neighbor event BadLSReq should be
  4941.    generated.
  4942.  
  4943. 10.8.  Sending Database Description Packets
  4944.  
  4945.    This section describes how Database Description Packets are sent to a
  4946.    neighbor. The Database Description packet's Interface MTU field is
  4947.    set to the size of the largest IP datagram that can be sent out the
  4948.    sending interface, without fragmentation.  Common MTUs in use in the
  4949.    Internet can be found in Table 7-1 of [Ref22]. Interface MTU should
  4950.    be set to 0 in Database Description packets sent over virtual links.
  4951.  
  4952.    The router's optional OSPF capabilities (see Section 4.5) are
  4953.    transmitted to the neighbor in the Options field of the Database
  4954.    Description packet.  The router should maintain the same set of
  4955.    optional capabilities throughout the Database Exchange and flooding
  4956.    procedures.  If for some reason the router's optional capabilities
  4957.    change, the Database Exchange procedure should be restarted by
  4958.    reverting to neighbor state ExStart.  One optional capability is
  4959.    defined in this specification (see Sections 4.5 and A.2). The E-bit
  4960.    should be set if and only if the attached network belongs to a non-
  4961.    stub area. Unrecognized bits in the Options field should be set to
  4962.    zero.  The sending of Database Description packets depends on the
  4963.    neighbor's state.  In state ExStart the router sends empty Database
  4964.    Description packets, with the initialize (I), more (M) and master
  4965.    (MS) bits set.  These packets are retransmitted every RxmtInterval
  4966.    seconds.
  4967.  
  4968.    In state Exchange the Database Description Packets actually contain
  4969.    summaries of the link state information contained in the router's
  4970.    database.  Each LSA in the area's link-state database (at the time
  4971.    the neighbor transitions into Exchange state) is listed in the
  4972.    neighbor Database summary list.  Each new Database Description Packet
  4973.    copies its DD sequence number from the neighbor data structure and
  4974.    then describes the current top of the Database summary list.  Items
  4975.    are removed from the Database summary list when the previous packet
  4976.    is acknowledged.
  4977.  
  4978.    In state Exchange, the determination of when to send a Database
  4979.    Description packet depends on whether the router is master or slave:
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986. Moy                         Standards Track                    [Page 89]
  4987.  
  4988. RFC 2178                     OSPF Version 2                    July 1997
  4989.  
  4990.  
  4991.    Master
  4992.       Database Description packets are sent when either a) the slave
  4993.       acknowledges the previous Database Description packet by echoing
  4994.       the DD sequence number or b) RxmtInterval seconds elapse without
  4995.       an acknowledgment, in which case the previous Database Description
  4996.       packet is retransmitted.
  4997.  
  4998.    Slave
  4999.       Database Description packets are sent only in response to Database
  5000.       Description packets received from the master.  If the Database
  5001.       Description packet received from the master is new, a new Database
  5002.       Description packet is sent, otherwise the previous Database
  5003.       Description packet is resent.
  5004.  
  5005.    In states Loading and Full the slave must resend its last Database
  5006.    Description packet in response to duplicate Database Description
  5007.    packets received from the master.  For this reason the slave must
  5008.    wait RouterDeadInterval seconds before freeing the last Database
  5009.    Description packet.  Reception of a Database Description packet from
  5010.    the master after this interval will generate a SeqNumberMismatch
  5011.    neighbor event.
  5012.  
  5013. 10.9.  Sending Link State Request Packets
  5014.  
  5015.    In neighbor states Exchange or Loading, the Link state request list
  5016.    contains a list of those LSAs that need to be obtained from the
  5017.    neighbor.  To request these LSAs, a router sends the neighbor the
  5018.    beginning of the Link state request list, packaged in a Link State
  5019.    Request packet.
  5020.  
  5021.    When the neighbor responds to these requests with the proper Link
  5022.    State Update packet(s), the Link state request list is truncated and
  5023.    a new Link State Request packet is sent.  This process continues
  5024.    until the Link state request list becomes empty.  Unsatisfied Link
  5025.    State Request packets are retransmitted at intervals of RxmtInterval.
  5026.    There should be at most one Link State Request packet outstanding at
  5027.    any one time.
  5028.  
  5029.    When the Link state request list becomes empty, and the neighbor
  5030.    state is Loading (i.e., a complete sequence of Database Description
  5031.    packets has been sent to and received from the neighbor), the Loading
  5032.    Done neighbor event is generated.
  5033.  
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039.  
  5040.  
  5041.  
  5042. Moy                         Standards Track                    [Page 90]
  5043.  
  5044. RFC 2178                     OSPF Version 2                    July 1997
  5045.  
  5046.  
  5047. 10.10.  An Example
  5048.  
  5049.    Figure 14 shows an example of an adjacency forming.  Routers RT1 and
  5050.    RT2 are both connected to a broadcast network.  It is assumed that
  5051.    RT2 is the Designated Router for the network, and that RT2 has a
  5052.    higher Router ID than Router RT1.
  5053.  
  5054.    The neighbor state changes realized by each router are listed on the
  5055.    sides of the figure.
  5056.  
  5057.    At the beginning of Figure 14, Router RT1's interface to the network
  5058.    becomes operational.  It begins sending Hello Packets, although it
  5059.    doesn't know the identity of the Designated Router or of any other
  5060.    neighboring routers.  Router RT2 hears this hello (moving the
  5061.    neighbor to Init state), and in its next Hello Packet indicates that
  5062.    it is itself the Designated Router and that it has heard Hello
  5063.    Packets from RT1.  This in turn causes RT1 to go to state ExStart, as
  5064.    it starts to bring up the adjacency.
  5065.  
  5066.    RT1 begins by asserting itself as the master.  When it sees that RT2
  5067.    is indeed the master (because of RT2's higher Router ID), RT1
  5068.    transitions to slave state and adopts its neighbor's DD sequence
  5069.    number.  Database Description packets are then exchanged, with polls
  5070.    coming from the master (RT2) and responses from the slave (RT1).
  5071.    This sequence of Database Description Packets ends when both the poll
  5072.    and associated response has the M-bit off.
  5073.  
  5074.    In this example, it is assumed that RT2 has a completely up to date
  5075.    database.  In that case, RT2 goes immediately into Full state.  RT1
  5076.    will go into Full state after updating the necessary parts of its
  5077.    database.  This is done by sending Link State Request Packets, and
  5078.    receiving Link State Update Packets in response.  Note that, while
  5079.    RT1 has waited until a complete set of Database Description Packets
  5080.    has been received (from RT2) before sending any Link State Request
  5081.    Packets, this need not be the case.  RT1 could have interleaved the
  5082.    sending of Link State Request Packets with the reception of Database
  5083.    Description Packets.
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098. Moy                         Standards Track                    [Page 91]
  5099.  
  5100. RFC 2178                     OSPF Version 2                    July 1997
  5101.  
  5102.  
  5103.             +---+                                         +---+
  5104.             |RT1|                                         |RT2|
  5105.             +---+                                         +---+
  5106.  
  5107.             Down                                          Down
  5108.                             Hello(DR=0,seen=0)
  5109.                        ------------------------------>
  5110.                          Hello (DR=RT2,seen=RT1,...)      Init
  5111.                        <------------------------------
  5112.             ExStart        D-D (Seq=x,I,M,Master)
  5113.                        ------------------------------>
  5114.                            D-D (Seq=y,I,M,Master)         ExStart
  5115.                        <------------------------------
  5116.             Exchange       D-D (Seq=y,M,Slave)
  5117.                        ------------------------------>
  5118.                            D-D (Seq=y+1,M,Master)         Exchange
  5119.                        <------------------------------
  5120.                            D-D (Seq=y+1,M,Slave)
  5121.                        ------------------------------>
  5122.                                      ...
  5123.                                      ...
  5124.                                      ...
  5125.                            D-D (Seq=y+n, Master)
  5126.                        <------------------------------
  5127.                            D-D (Seq=y+n, Slave)
  5128.              Loading   ------------------------------>
  5129.                                  LS Request                Full
  5130.                        ------------------------------>
  5131.                                  LS Update
  5132.                        <------------------------------
  5133.                                  LS Request
  5134.                        ------------------------------>
  5135.                                  LS Update
  5136.                        <------------------------------
  5137.              Full
  5138.  
  5139.  
  5140.                 Figure 14: An adjacency bring-up example
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154. Moy                         Standards Track                    [Page 92]
  5155.  
  5156. RFC 2178                     OSPF Version 2                    July 1997
  5157.  
  5158.  
  5159. 11.  The Routing Table Structure
  5160.  
  5161.    The routing table data structure contains all the information
  5162.    necessary to forward an IP data packet toward its destination.  Each
  5163.    routing table entry describes the collection of best paths to a
  5164.    particular destination.  When forwarding an IP data packet, the
  5165.    routing table entry providing the best match for the packet's IP
  5166.    destination is located.  The matching routing table entry then
  5167.    provides the next hop towards the packet's destination.  OSPF also
  5168.    provides for the existence of a default route (Destination ID =
  5169.    DefaultDestination, Address Mask = 0x00000000).  When the default
  5170.    route exists, it matches all IP destinations (although any other
  5171.    matching entry is a better match). Finding the routing table entry
  5172.    that best matches an IP destination is further described in Section
  5173.    11.1.
  5174.  
  5175.    There is a single routing table in each router.  Two sample routing
  5176.    tables are described in Sections 11.2 and 11.3.  The building of the
  5177.    routing table is discussed in Section 16.
  5178.  
  5179.    The rest of this section defines the fields found in a routing table
  5180.    entry.  The first set of fields describes the routing table entry's
  5181.    destination.
  5182.  
  5183.    Destination Type
  5184.       Destination type is either "network" or "router". Only network entries
  5185.       are actually used when forwarding IP data traffic.  Router routing
  5186.       table entries are used solely as intermediate steps in the routing
  5187.       table build process.
  5188.  
  5189.       A network is a range of IP addresses, to which IP data traffic may be
  5190.       forwarded.  This includes IP networks (class A, B, or C), IP subnets,
  5191.       IP supernets and single IP hosts.  The default route also falls into
  5192.       this category.
  5193.  
  5194.       Router entries are kept for area border routers and AS boundary
  5195.       routers.  Routing table entries for area border routers are used when
  5196.       calculating the inter-area routes (see Section 16.2), and when
  5197.       maintaining configured virtual links (see Section 15).  Routing table
  5198.       entries for AS boundary routers are used when calculating the AS
  5199.       external routes (see Section 16.4).
  5200.  
  5201.    Destination ID
  5202.       The destination's identifier or name.  This depends on the
  5203.       Destination Type.  For networks, the identifier is their associated IP
  5204.       address.  For routers, the identifier is the OSPF Router ID.[9]
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210. Moy                         Standards Track                    [Page 93]
  5211.  
  5212. RFC 2178                     OSPF Version 2                    July 1997
  5213.  
  5214.  
  5215.    Address Mask
  5216.       Only defined for networks.  The network's IP address together with its
  5217.       address mask defines a range of IP addresses.  For IP subnets, the
  5218.       address mask is referred to as the subnet mask.  For host routes, the
  5219.       mask is "all ones" (0xffffffff).
  5220.  
  5221.    Optional Capabilities
  5222.       When the destination is a router this field indicates the optional
  5223.       OSPF capabilities supported by the destination router.  The only
  5224.       optional capability defined by this specification is the ability to
  5225.       process AS-external-LSAs.  For a further discussion of OSPF's optional
  5226.       capabilities, see Section 4.5.
  5227.  
  5228.    The set of paths to use for a destination may vary based on the OSPF
  5229.    area to which the paths belong.  This means that there may be
  5230.    multiple routing table entries for the same destination, depending on
  5231.    the values of the next field.
  5232.  
  5233.    Area
  5234.       This field indicates the area whose link state information has led
  5235.       to the routing table entry's collection of paths.  This is called
  5236.       the entry's associated area.  For sets of AS external paths, this
  5237.       field is not defined.  For destinations of type "router", there
  5238.       may be separate sets of paths (and therefore separate routing
  5239.       table entries) associated with each of several areas. For example,
  5240.       this will happen when two area border routers share multiple areas
  5241.       in common.  For destinations of type "network", only the set of
  5242.       paths associated with the best area (the one providing the
  5243.       preferred route) is kept.
  5244.  
  5245.    The rest of the routing table entry describes the set of paths to the
  5246.    destination.  The following fields pertain to the set of paths as a
  5247.    whole.  In other words, each one of the paths contained in a routing
  5248.    table entry is of the same path-type and cost (see below).
  5249.  
  5250.    Path-type
  5251.       There are four possible types of paths used to route traffic to
  5252.       the destination, listed here in order of preference: intra-area,
  5253.       inter-area, type 1 external or type 2 external.  Intra-area paths
  5254.       indicate destinations belonging to one of the router's attached
  5255.       areas.  Inter-area paths are paths to destinations in other OSPF
  5256.       areas.  These are discovered through the examination of received
  5257.       summary-LSAs.  AS external paths are paths to destinations
  5258.       external to the AS.  These are detected through the examination of
  5259.       received AS-external-LSAs.
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266. Moy                         Standards Track                    [Page 94]
  5267.  
  5268. RFC 2178                     OSPF Version 2                    July 1997
  5269.  
  5270.  
  5271.    Cost
  5272.       The link state cost of the path to the destination.  For all paths
  5273.       except type 2 external paths this describes the entire path's
  5274.       cost.  For Type 2 external paths, this field describes the cost of
  5275.       the portion of the path internal to the AS.  This cost is
  5276.       calculated as the sum of the costs of the path's constituent
  5277.       links.
  5278.  
  5279.    Type 2 cost
  5280.       Only valid for type 2 external paths.  For these paths, this field
  5281.       indicates the cost of the path's external portion.  This cost has
  5282.       been advertised by an AS boundary router, and is the most
  5283.       significant part of the total path cost.  For example, a type 2
  5284.       external path with type 2 cost of 5 is always preferred over a
  5285.       path with type 2 cost of 10, regardless of the cost of the two
  5286.       paths' internal components.
  5287.  
  5288.    Link State Origin
  5289.       Valid only for intra-area paths, this field indicates the LSA
  5290.       (router-LSA or network-LSA) that directly references the
  5291.       destination.  For example, if the destination is a transit
  5292.       network, this is the transit network's network-LSA.  If the
  5293.       destination is a stub network, this is the router-LSA for the
  5294.       attached router.  The LSA is discovered during the shortest-path
  5295.       tree calculation (see Section 16.1).  Multiple LSAs may reference
  5296.       the destination, however a tie-breaking scheme always reduces the
  5297.       choice to a single LSA. The Link State Origin field is not used by
  5298.       the OSPF protocol, but it is used by the routing table calculation
  5299.       in OSPF's Multicast routing extensions (MOSPF).
  5300.  
  5301.    When multiple paths of equal path-type and cost exist to a
  5302.    destination (called elsewhere "equal-cost" paths), they are stored in
  5303.    a single routing table entry.  Each one of the "equal-cost" paths is
  5304.    distinguished by the following fields:
  5305.  
  5306.    Next hop
  5307.       The outgoing router interface to use when forwarding traffic to
  5308.       the destination.  On broadcast, Point-to-MultiPoint and NBMA
  5309.       networks, the next hop also includes the IP address of the next
  5310.       router (if any) in the path towards the destination.
  5311.  
  5312.    Advertising router
  5313.       Valid only for inter-area and AS external paths.  This field
  5314.       indicates the Router ID of the router advertising the summary-LSA
  5315.       or AS-external-LSA that led to this path.
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322. Moy                         Standards Track                    [Page 95]
  5323.  
  5324. RFC 2178                     OSPF Version 2                    July 1997
  5325.  
  5326.  
  5327. 11.1.  Routing table lookup
  5328.  
  5329.    When an IP data packet is received, an OSPF router finds the routing
  5330.    table entry that best matches the packet's destination.  This routing
  5331.    table entry then provides the outgoing interface and next hop router
  5332.    to use in forwarding the packet. This section describes the process
  5333.    of finding the best matching routing table entry. The process
  5334.    consists of a number of steps, wherein the collection of routing
  5335.    table entries is progressively pruned.  In the end, the single
  5336.    routing table entry remaining is called the "best match".
  5337.  
  5338.    Before the lookup begins, "discard" routing table entries should be
  5339.    inserted into the routing table for each of the router's active area
  5340.    address ranges (see Section 3.5).  (An area range is considered
  5341.    "active" if the range contains one or more networks reachable by
  5342.    intra-area paths.) The destination of a "discard" entry is the set of
  5343.    addresses described by its associated active area address range, and
  5344.    the path type of each "discard" entry is set to "inter-area".[10]
  5345.  
  5346.    Note that the steps described below may fail to produce a best match
  5347.    routing table entry (i.e., all existing routing table entries are
  5348.    pruned for some reason or another), or the best match routing table
  5349.    entry may be one of the above "discard" routing table entries. In
  5350.    these cases, the packet's IP destination is considered unreachable.
  5351.    Instead of being forwarded, the packet should be discarded and an
  5352.    ICMP destination unreachable message should be returned to the
  5353.    packet's source.
  5354.  
  5355.    (1) Select the complete set of "matching" routing table entries
  5356.        from the routing table.  Each routing table entry describes
  5357.        a (set of) path(s) to a range of IP addresses. If the data
  5358.        packet's IP destination falls into an entry's range of IP
  5359.        addresses, the routing table entry is called a match. (It is
  5360.        quite likely that multiple entries will match the data
  5361.        packet.  For example, a default route will match all
  5362.        packets.)
  5363.  
  5364.    (2) Reduce the set of matching entries to those having the most
  5365.        preferential path-type (see Section 11). OSPF has a four
  5366.        level hierarchy of paths. Intra-area paths are the most
  5367.        preferred, followed in order by inter-area, type 1 external
  5368.        and type 2 external paths.
  5369.  
  5370.    (3) Select the remaining routing table entry that provides the
  5371.        most specific (longest) match. Another way of saying this is
  5372.        to choose the remaining entry that specifies the narrowest
  5373.        range of IP addresses.[11] For example, the entry for the
  5374.        address/mask pair of (128.185.1.0, 0xffffff00) is more
  5375.  
  5376.  
  5377.  
  5378. Moy                         Standards Track                    [Page 96]
  5379.  
  5380. RFC 2178                     OSPF Version 2                    July 1997
  5381.  
  5382.  
  5383.        specific than an entry for the pair (128.185.0.0,
  5384.        0xffff0000). The default route is the least specific match,
  5385.        since it matches all destinations.
  5386.  
  5387. 11.2.  Sample routing table, without areas
  5388.  
  5389.    Consider the Autonomous System pictured in Figure 2.  No OSPF areas
  5390.    have been configured.  A single metric is shown per outbound
  5391.    interface.  The calculation of Router RT6's routing table proceeds as
  5392.    described in Section 2.2.  The resulting routing table is shown in
  5393.    Table 12.  Destination types are abbreviated: Network as "N", Router
  5394.    as "R".
  5395.  
  5396.    There are no instances of multiple equal-cost shortest paths in this
  5397.    example.  Also, since there are no areas, there are no inter-area
  5398.    paths.
  5399.  
  5400.    Routers RT5 and RT7 are AS boundary routers.  Intra-area routes have
  5401.    been calculated to Routers RT5 and RT7.  This allows external routes
  5402.    to be calculated to the destinations advertised by RT5 and RT7 (i.e.,
  5403.    Networks N12, N13, N14 and N15).  It is assumed all AS-external-LSAs
  5404.    originated by RT5 and RT7 are advertising type 1 external metrics.
  5405.    This results in type 1 external paths being calculated to
  5406.    destinations N12-N15.
  5407.  
  5408. 11.3.  Sample routing table, with areas
  5409.  
  5410.    Consider the previous example, this time split into OSPF areas.  An
  5411.    OSPF area configuration is pictured in Figure 6.  Router RT4's
  5412.    routing table will be described for this area configuration.  Router
  5413.    RT4 has a connection to Area 1 and a backbone connection.  This
  5414.    causes Router RT4 to view the AS as the concatenation of the two
  5415.    graphs shown in Figures 7 and 8.  The resulting routing table is
  5416.    displayed in Table 13.
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.  
  5434. Moy                         Standards Track                    [Page 97]
  5435.  
  5436. RFC 2178                     OSPF Version 2                    July 1997
  5437.  
  5438.  
  5439.       Type   Dest   Area   Path  Type    Cost   Next     Adv.
  5440.                                                 Hop(s)   Router(s)
  5441.       ____________________________________________________________
  5442.       N      N1     0      intra-area    10     RT3      *
  5443.       N      N2     0      intra-area    10     RT3      *
  5444.       N      N3     0      intra-area    7      RT3      *
  5445.       N      N4     0      intra-area    8      RT3      *
  5446.       N      Ib     0      intra-area    7      *        *
  5447.       N      Ia     0      intra-area    12     RT10     *
  5448.       N      N6     0      intra-area    8      RT10     *
  5449.       N      N7     0      intra-area    12     RT10     *
  5450.       N      N8     0      intra-area    10     RT10     *
  5451.       N      N9     0      intra-area    11     RT10     *
  5452.       N      N10    0      intra-area    13     RT10     *
  5453.       N      N11    0      intra-area    14     RT10     *
  5454.       N      H1     0      intra-area    21     RT10     *
  5455.       R      RT5    0      intra-area    6      RT5      *
  5456.       R      RT7    0      intra-area    8      RT10     *
  5457.       ____________________________________________________________
  5458.       N      N12    *      type 1 ext.   10     RT10     RT7
  5459.       N      N13    *      type 1 ext.   14     RT5      RT5
  5460.       N      N14    *      type 1 ext.   14     RT5      RT5
  5461.       N      N15    *      type 1 ext.   17     RT10     RT7
  5462.  
  5463.  
  5464.                Table 12: The routing table for Router RT6
  5465.                          (no configured areas).
  5466.  
  5467.    Again, Routers RT5 and RT7 are AS boundary routers.  Routers RT3,
  5468.    RT4, RT7, RT10 and RT11 are area border routers.  Note that there are
  5469.    two routing entries for the area border router RT3, since it has two
  5470.    areas in common with RT4 (Area 1 and the backbone).
  5471.  
  5472.    Backbone paths have been calculated to all area border routers.
  5473.    These are used when determining the inter-area routes.  Note that all
  5474.    of the inter-area routes are associated with the backbone; this is
  5475.    always the case when the calculating router is itself an area border
  5476.    router.  Routing information is condensed at area boundaries.  In
  5477.    this example, we assume that Area 3 has been defined so that networks
  5478.    N9-N11 and the host route to H1 are all condensed to a single route
  5479.    when advertised into the backbone (by Router RT11).  Note that the
  5480.    cost of this route is the maximum of the set of costs to its
  5481.    individual components.
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490. Moy                         Standards Track                    [Page 98]
  5491.  
  5492. RFC 2178                     OSPF Version 2                    July 1997
  5493.  
  5494.  
  5495.    There is a virtual link configured between Routers RT10 and RT11.
  5496.    Without this configured virtual link, RT11 would be unable to
  5497.    advertise a route for networks N9-N11 and Host H1 into the backbone,
  5498.    and there would not be an entry for these networks in Router RT4's
  5499.    routing table.
  5500.  
  5501.    In this example there are two equal-cost paths to Network N12.
  5502.    However, they both use the same next hop (Router RT5).
  5503.  
  5504.  
  5505.    Type   Dest        Area   Path  Type    Cost   Next      Adv.
  5506.                                                   Hops(s)   Router(s)
  5507.    __________________________________________________________________
  5508.    N      N1          1      intra-area    4      RT1       *
  5509.    N      N2          1      intra-area    4      RT2       *
  5510.    N      N3          1      intra-area    1      *         *
  5511.    N      N4          1      intra-area    3      RT3       *
  5512.    R      RT3         1      intra-area    1      *         *
  5513.    __________________________________________________________________
  5514.    N      Ib          0      intra-area    22     RT5       *
  5515.    N      Ia          0      intra-area    27     RT5       *
  5516.    R      RT3         0      intra-area    21     RT5       *
  5517.    R      RT5         0      intra-area    8      *         *
  5518.    R      RT7         0      intra-area    14     RT5       *
  5519.    R      RT10        0      intra-area    22     RT5       *
  5520.    R      RT11        0      intra-area    25     RT5       *
  5521.    __________________________________________________________________
  5522.    N      N6          0      inter-area    15     RT5       RT7
  5523.    N      N7          0      inter-area    19     RT5       RT7
  5524.    N      N8          0      inter-area    18     RT5       RT7
  5525.    N      N9-N11,H1   0      inter-area    36     RT5       RT11
  5526.    __________________________________________________________________
  5527.    N      N12         *      type 1 ext.   16     RT5       RT5,RT7
  5528.    N      N13         *      type 1 ext.   16     RT5       RT5
  5529.    N      N14         *      type 1 ext.   16     RT5       RT5
  5530.    N      N15         *      type 1 ext.   23     RT5       RT7
  5531.  
  5532.                   Table 13: Router RT4's routing table
  5533.                        in the presence of areas.
  5534.  
  5535.  
  5536.    Router RT4's routing table would improve (i.e., some of the paths in
  5537.    the routing table would become shorter) if an additional virtual link
  5538.    were configured between Router RT4 and Router RT3.  The new virtual
  5539.    link would itself be associated with the first entry for area border
  5540.    router RT3 in Table 13 (an intra-area path through Area 1).  This
  5541.    would yield a cost of 1 for the virtual link.  The routing table
  5542.    entries changes that would be caused by the addition of this virtual
  5543.  
  5544.  
  5545.  
  5546. Moy                         Standards Track                    [Page 99]
  5547.  
  5548. RFC 2178                     OSPF Version 2                    July 1997
  5549.  
  5550.  
  5551.    link are shown in Table 14.
  5552.  
  5553. 12.  Link State Advertisements (LSAs)
  5554.  
  5555.    Each router in the Autonomous System originates one or more link
  5556.    state advertisements (LSAs).  This memo defines five distinct types
  5557.    of LSAs, which are described in Section 4.3.  The collection of LSAs
  5558.    forms the link-state database.  Each separate type of LSA has a
  5559.    separate function. Router-LSAs and network-LSAs describe how an
  5560.    area's routers and networks are interconnected.  Summary-LSAs provide
  5561.    a way of condensing an area's routing information. AS-external-LSAs
  5562.    provide a way of transparently advertising externally-derived routing
  5563.    information throughout the Autonomous System.
  5564.  
  5565.    Each LSA begins with a standard 20-byte header.  This LSA header is
  5566.    discussed below.
  5567.  
  5568.     Type   Dest        Area   Path  Type   Cost   Next     Adv.
  5569.                                                   Hop(s)   Router(s)
  5570.     ________________________________________________________________
  5571.     N      Ib          0      intra-area   16     RT3      *
  5572.     N      Ia          0      intra-area   21     RT3      *
  5573.     R      RT3         0      intra-area   1      *        *
  5574.     R      RT10        0      intra-area   16     RT3      *
  5575.     R      RT11        0      intra-area   19     RT3      *
  5576.     ________________________________________________________________
  5577.     N      N9-N11,H1   0      inter-area   30     RT3      RT11
  5578.  
  5579.  
  5580.                   Table 14: Changes resulting from an
  5581.                         additional virtual link.
  5582.  
  5583. 12.1.  The LSA Header
  5584.  
  5585.    The LSA header contains the LS type, Link State ID and Advertising
  5586.    Router fields.  The combination of these three fields uniquely
  5587.    identifies the LSA.
  5588.  
  5589.    There may be several instances of an LSA present in the Autonomous
  5590.    System, all at the same time.  It must then be determined which
  5591.    instance is more recent.  This determination is made by examining the
  5592.    LS sequence, LS checksum and LS age fields.  These fields are also
  5593.    contained in the 20-byte LSA header.
  5594.  
  5595.    Several of the OSPF packet types list LSAs.  When the instance is not
  5596.    important, an LSA is referred to by its LS type, Link State ID and
  5597.    Advertising Router (see Link State Request Packets).  Otherwise, the
  5598.    LS sequence number, LS age and LS checksum fields must also be
  5599.  
  5600.  
  5601.  
  5602. Moy                         Standards Track                   [Page 100]
  5603.  
  5604. RFC 2178                     OSPF Version 2                    July 1997
  5605.  
  5606.  
  5607.    referenced.
  5608.  
  5609.    A detailed explanation of the fields contained in the LSA header
  5610.    follows.
  5611.  
  5612. 12.1.1.  LS age
  5613.  
  5614.    This field is the age of the LSA in seconds.  It should be processed
  5615.    as an unsigned 16-bit integer.  It is set to 0 when the LSA is
  5616.    originated.  It must be incremented by InfTransDelay on every hop of
  5617.    the flooding procedure.  LSAs are also aged as they are held in each
  5618.    router's database.
  5619.  
  5620.    The age of an LSA is never incremented past MaxAge.  LSAs having age
  5621.    MaxAge are not used in the routing table calculation.  When an LSA's
  5622.    age first reaches MaxAge, it is reflooded. An LSA of age MaxAge is
  5623.    finally flushed from the database when it is no longer needed to
  5624.    ensure database synchronization.  For more information on the aging
  5625.    of LSAs, consult Section 14.
  5626.  
  5627.    The LS age field is examined when a router receives two instances of
  5628.    an LSA, both having identical LS sequence numbers and LS checksums.
  5629.    An instance of age MaxAge is then always accepted as most recent;
  5630.    this allows old LSAs to be flushed quickly from the routing domain.
  5631.    Otherwise, if the ages differ by more than MaxAgeDiff, the instance
  5632.    having the smaller age is accepted as most recent.[12] See Section
  5633.    13.1 for more details.
  5634.  
  5635. 12.1.2.  Options
  5636.  
  5637.    The Options field in the LSA header indicates which optional
  5638.    capabilities are associated with the LSA.  OSPF's optional
  5639.    capabilities are described in Section 4.5. One optional capability is
  5640.    defined by this specification, represented by the E-bit found in the
  5641.    Options field.  The unrecognized bits in the Options field should be
  5642.    set to zero.  The E-bit represents OSPF's ExternalRoutingCapability.
  5643.    This bit should be set in all LSAs associated with the backbone, and
  5644.    all LSAs associated with non-stub areas (see Section 3.6).  It should
  5645.    also be set in all AS-external-LSAs.  It should be reset in all
  5646.    router-LSAs, network-LSAs and summary-LSAs associated with a stub
  5647.    area.  For all LSAs, the setting of the E-bit is for informational
  5648.    purposes only; it does not affect the routing table calculation.
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658. Moy                         Standards Track                   [Page 101]
  5659.  
  5660. RFC 2178                     OSPF Version 2                    July 1997
  5661.  
  5662.  
  5663. 12.1.3.  LS type
  5664.  
  5665.    The LS type field dictates the format and function of the LSA.  LSAs
  5666.    of different types have different names (e.g., router-LSAs or
  5667.    network-LSAs).  All LSA types defined by this memo, except the AS-
  5668.    external-LSAs (LS type = 5), are flooded throughout a single area
  5669.    only.  AS-external-LSAs are flooded throughout the entire Autonomous
  5670.    System, excepting stub areas (see Section 3.6).  Each separate LSA
  5671.    type is briefly described below in Table 15.
  5672.  
  5673. 12.1.4.  Link State ID
  5674.  
  5675.    This field identifies the piece of the routing domain that is being
  5676.    described by the LSA.  Depending on the LSA's LS type, the Link State
  5677.    ID takes on the values listed in Table 16.
  5678.  
  5679.    Actually, for Type 3 summary-LSAs (LS type = 3) and AS-external-LSAs
  5680.    (LS type = 5), the Link State ID may additionally have one or more of
  5681.    the destination network's "host" bits set. For example, when
  5682.    originating an AS-external-LSA for the network 10.0.0.0 with mask of
  5683.    255.0.0.0, the Link State ID can be set to anything in the range
  5684.    10.0.0.0 through 10.255.255.255 inclusive (although 10.0.0.0 should
  5685.    be used whenever possible). The freedom to set certain host bits
  5686.    allows a router to originate separate LSAs for two networks having
  5687.    the same address but different masks. See Appendix E for details.
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714. Moy                         Standards Track                   [Page 102]
  5715.  
  5716. RFC 2178                     OSPF Version 2                    July 1997
  5717.  
  5718.  
  5719.             LS Type   LSA description
  5720.             ________________________________________________
  5721.             1         These are the router-LSAs.
  5722.                       They describe the collected
  5723.                        states of the router's
  5724.                       interfaces. For more information,
  5725.                       consult Section 12.4.1.
  5726.             ________________________________________________
  5727.             2         These are the network-LSAs.
  5728.                       They describe the set of routers
  5729.                       attached to the network. For
  5730.                       more information, consult
  5731.                       Section 12.4.2.
  5732.             ________________________________________________
  5733.             3 or 4    These are the summary-LSAs.
  5734.                       They describe inter-area routes,
  5735.                       and enable the condensation of
  5736.                       routing information at area
  5737.                       borders. Originated by area border
  5738.                       routers, the Type 3 summary-LSAs
  5739.                       describe routes to networks while the
  5740.                       Type 4 summary-LSAs describe routes to
  5741.                       AS boundary routers.
  5742.             ________________________________________________
  5743.             5         These are the AS-external-LSAs.
  5744.                       Originated by AS boundary routers,
  5745.                       they describe routes
  5746.                       to destinations external to the
  5747.                       Autonomous System. A default route for
  5748.                       the Autonomous System can also be
  5749.                       described by an AS-external-LSA.
  5750.  
  5751.             Table 15: OSPF link state advertisements (LSAs).
  5752.  
  5753.             LS Type   Link State ID
  5754.             _______________________________________________
  5755.             1         The originating router's Router ID.
  5756.             2         The IP interface address of the
  5757.                       network's Designated Router.
  5758.             3         The destination network's IP address.
  5759.             4         The Router ID of the described AS
  5760.                       boundary router.
  5761.             5         The destination network's IP address.
  5762.  
  5763.  
  5764.                    Table 16: The LSA's Link State ID.
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770. Moy                         Standards Track                   [Page 103]
  5771.  
  5772. RFC 2178                     OSPF Version 2                    July 1997
  5773.  
  5774.  
  5775.    When the LSA is describing a network (LS type = 2, 3 or 5), the
  5776.    network's IP address is easily derived by masking the Link State ID
  5777.    with the network/subnet mask contained in the body of the LSA.  When
  5778.    the LSA is describing a router (LS type = 1 or 4), the Link State ID
  5779.    is always the described router's OSPF Router ID.
  5780.  
  5781.    When an AS-external-LSA (LS Type = 5) is describing a default route,
  5782.    its Link State ID is set to DefaultDestination (0.0.0.0).
  5783.  
  5784. 12.1.5.  Advertising Router
  5785.  
  5786.    This field specifies the OSPF Router ID of the LSA's originator.  For
  5787.    router-LSAs, this field is identical to the Link State ID field.
  5788.    Network-LSAs are originated by the network's Designated Router.
  5789.    Summary-LSAs originated by area border routers.  AS-external-LSAs are
  5790.    originated by AS boundary routers.
  5791.  
  5792. 12.1.6.  LS sequence number
  5793.  
  5794.  
  5795.    The sequence number field is a signed 32-bit integer.  It is used to
  5796.    detect old and duplicate LSAs.  The space of sequence numbers is
  5797.    linearly ordered.  The larger the sequence number (when compared as
  5798.    signed 32-bit integers) the more recent the LSA.  To describe to
  5799.    sequence number space more precisely, let N refer in the discussion
  5800.    below to the constant 2**31.
  5801.  
  5802.    The sequence number -N (0x80000000) is reserved (and unused).  This
  5803.    leaves -N + 1 (0x80000001) as the smallest (and therefore oldest)
  5804.    sequence number; this sequence number is referred to as the constant
  5805.    InitialSequenceNumber. A router uses InitialSequenceNumber the first
  5806.    time it originates any LSA.  Afterwards, the LSA's sequence number is
  5807.    incremented each time the router originates a new instance of the
  5808.    LSA.  When an attempt is made to increment the sequence number past
  5809.    the maximum value of N - 1 (0x7fffffff; also referred to as
  5810.    MaxSequenceNumber), the current instance of the LSA must first be
  5811.    flushed from the routing domain.  This is done by prematurely aging
  5812.    the LSA (see Section 14.1) and reflooding it.  As soon as this flood
  5813.    has been acknowledged by all adjacent neighbors, a new instance can
  5814.    be originated with sequence number of InitialSequenceNumber.
  5815.  
  5816.    The router may be forced to promote the sequence number of one of its
  5817.    LSAs when a more recent instance of the LSA is unexpectedly received
  5818.    during the flooding process. This should be a rare event.  This may
  5819.    indicate that an out-of-date LSA, originated by the router itself
  5820.    before its last restart/reload, still exists in the Autonomous
  5821.    System.  For more information see Section 13.4.
  5822.  
  5823.  
  5824.  
  5825.  
  5826. Moy                         Standards Track                   [Page 104]
  5827.  
  5828. RFC 2178                     OSPF Version 2                    July 1997
  5829.  
  5830.  
  5831. 12.1.7.  LS checksum
  5832.  
  5833.    This field is the checksum of the complete contents of the LSA,
  5834.    excepting the LS age field.  The LS age field is excepted so that an
  5835.    LSA's age can be incremented without updating the checksum.  The
  5836.    checksum used is the same that is used for ISO connectionless
  5837.    datagrams; it is commonly referred to as the Fletcher checksum.  It
  5838.    is documented in Annex B of [Ref6]. The LSA header also contains the
  5839.    length of the LSA in bytes; subtracting the size of the LS age field
  5840.    (two bytes) yields the amount of data to checksum.
  5841.  
  5842.    The checksum is used to detect data corruption of an LSA.  This
  5843.    corruption can occur while an LSA is being flooded, or while it is
  5844.    being held in a router's memory.  The LS checksum field cannot take
  5845.    on the value of zero; the occurrence of such a value should be
  5846.    considered a checksum failure.  In other words, calculation of the
  5847.    checksum is not optional.
  5848.  
  5849.    The checksum of an LSA is verified in two cases: a) when it is
  5850.    received in a Link State Update Packet and b) at times during the
  5851.    aging of the link state database.  The detection of a checksum
  5852.    failure leads to separate actions in each case.  See Sections 13 and
  5853.    14 for more details.
  5854.  
  5855.    Whenever the LS sequence number field indicates that two instances of
  5856.    an LSA are the same, the LS checksum field is examined.  If there is
  5857.    a difference, the instance with the larger LS checksum is considered
  5858.    to be most recent.[13] See Section 13.1 for more details.
  5859.  
  5860. 12.2.  The link state database
  5861.  
  5862.    A router has a separate link state database for every area to which
  5863.    it belongs. All routers belonging to the same area have identical
  5864.    link state databases for the area.
  5865.  
  5866.    The databases for each individual area are always dealt with
  5867.    separately.  The shortest path calculation is performed separately
  5868.    for each area (see Section 16).  Components of the area link-state
  5869.    database are flooded throughout the area only.  Finally, when an
  5870.    adjacency (belonging to Area A) is being brought up, only the
  5871.    database for Area A is synchronized between the two routers.
  5872.  
  5873.    The area database is composed of router-LSAs, network-LSAs and
  5874.    summary-LSAs (all listed in the area data structure).  In addition,
  5875.    external routes (AS-external-LSAs) are included in all non-stub area
  5876.    databases (see Section 3.6).
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882. Moy                         Standards Track                   [Page 105]
  5883.  
  5884. RFC 2178                     OSPF Version 2                    July 1997
  5885.  
  5886.  
  5887.    An implementation of OSPF must be able to access individual pieces of
  5888.    an area database.  This lookup function is based on an LSA's LS type,
  5889.    Link State ID and Advertising Router.[14] There will be a single
  5890.    instance (the most up-to-date) of each LSA in the database.  The
  5891.    database lookup function is invoked during the LSA flooding procedure
  5892.    (Section 13) and the routing table calculation (Section 16).  In
  5893.    addition, using this lookup function the router can determine whether
  5894.    it has itself ever originated a particular LSA, and if so, with what
  5895.    LS sequence number.
  5896.  
  5897.    An LSA is added to a router's database when either a) it is received
  5898.    during the flooding process (Section 13) or b) it is originated by
  5899.    the router itself (Section 12.4).  An LSA is deleted from a router's
  5900.    database when either a) it has been overwritten by a newer instance
  5901.    during the flooding process (Section 13) or b) the router originates
  5902.    a newer instance of one of its self-originated LSAs (Section 12.4) or
  5903.    c) the LSA ages out and is flushed from the routing domain (Section
  5904.    14).
  5905.  
  5906.    Whenever an LSA is deleted from the database it must also be removed
  5907.    from all neighbors' Link state retransmission lists (see Section 10).
  5908.  
  5909. 12.3.  Representation of TOS
  5910.  
  5911.    For backward compatibility with previous versions of the OSPF
  5912.    specification ([Ref9]), TOS-specific information can be included in
  5913.    router-LSAs, summary-LSAs and AS-external-LSAs.  The encoding of TOS
  5914.    in OSPF LSAs is specified in Table 17. That table relates the OSPF
  5915.    encoding to the IP packet header's TOS field (defined in [Ref12]).
  5916.    The OSPF encoding is expressed as a decimal integer, and the IP
  5917.    packet header's TOS field is expressed in the binary TOS values used
  5918.    in [Ref12].
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938. Moy                         Standards Track                   [Page 106]
  5939.  
  5940. RFC 2178                     OSPF Version 2                    July 1997
  5941.  
  5942.  
  5943.                     OSPF encoding   RFC 1349 TOS values
  5944.                     ___________________________________________
  5945.                     0               0000 normal service
  5946.                     2               0001 minimize monetary cost
  5947.                     4               0010 maximize reliability
  5948.                     6               0011
  5949.                     8               0100 maximize throughput
  5950.                     10              0101
  5951.                     12              0110
  5952.                     14              0111
  5953.                     16              1000 minimize delay
  5954.                     18              1001
  5955.                     20              1010
  5956.                     22              1011
  5957.                     24              1100
  5958.                     26              1101
  5959.                     28              1110
  5960.                     30              1111
  5961.  
  5962.                   Table 17: Representing TOS in OSPF.
  5963.  
  5964. 12.4.  Originating LSAs
  5965.  
  5966.    Into any given OSPF area, a router will originate several LSAs.  Each
  5967.    router originates a router-LSA.  If the router is also the Designated
  5968.    Router for any of the area's networks, it will originate network-LSAs
  5969.    for those networks.
  5970.  
  5971.    Area border routers originate a single summary-LSA for each known
  5972.    inter-area destination.  AS boundary routers originate a single AS-
  5973.    external-LSA for each known AS external destination.  Destinations
  5974.    are advertised one at a time so that the change in any single route
  5975.    can be flooded without reflooding the entire collection of routes.
  5976.    During the flooding procedure, many LSAs can be carried by a single
  5977.    Link State Update packet.
  5978.  
  5979.    As an example, consider Router RT4 in Figure 6.  It is an area border
  5980.    router, having a connection to Area 1 and the backbone.  Router RT4
  5981.    originates 5 distinct LSAs into the backbone (one router-LSA, and one
  5982.    summary-LSA for each of the networks N1-N4).  Router RT4 will also
  5983.    originate 8 distinct LSAs into Area 1 (one router-LSA and seven
  5984.    summary-LSAs as pictured in Figure 7).  If RT4 has been selected as
  5985.    Designated Router for Network N3, it will also originate a network-
  5986.    LSA for N3 into Area 1.
  5987.  
  5988.    In this same figure, Router RT5 will be originating 3 distinct AS-
  5989.    external-LSAs (one for each of the networks N12-N14).  These will be
  5990.    flooded throughout the entire AS, assuming that none of the areas
  5991.  
  5992.  
  5993.  
  5994. Moy                         Standards Track                   [Page 107]
  5995.  
  5996. RFC 2178                     OSPF Version 2                    July 1997
  5997.  
  5998.  
  5999.    have been configured as stubs.  However, if area 3 has been
  6000.    configured as a stub area, the AS-external-LSAs for networks N12-N14
  6001.    will not be flooded into area 3 (see Section 3.6).  Instead, Router
  6002.    RT11 would originate a default summary- LSA that would be flooded
  6003.    throughout area 3 (see Section 12.4.3).  This instructs all of area
  6004.    3's internal routers to send their AS external traffic to RT11.
  6005.  
  6006.    Whenever a new instance of an LSA is originated, its LS sequence
  6007.    number is incremented, its LS age is set to 0, its LS checksum is
  6008.    calculated, and the LSA is added to the link state database and
  6009.    flooded out the appropriate interfaces.  See Section 13.2 for details
  6010.    concerning the installation of the LSA into the link state database.
  6011.    See Section 13.3 for details concerning the flooding of newly
  6012.    originated LSAs.
  6013.  
  6014.    The ten events that can cause a new instance of an LSA to be
  6015.    originated are:
  6016.  
  6017.    (1) The LS age field of one of the router's self-originated LSAs
  6018.        reaches the value LSRefreshTime. In this case, a new
  6019.        instance of the LSA is originated, even though the contents
  6020.        of the LSA (apart from the LSA header) will be the same.
  6021.        This guarantees periodic originations of all LSAs.  This
  6022.        periodic updating of LSAs adds robustness to the link state
  6023.        algorithm.  LSAs that solely describe unreachable
  6024.        destinations should not be refreshed, but should instead be
  6025.        flushed from the routing domain (see Section 14.1).
  6026.  
  6027.    When whatever is being described by an LSA changes, a new LSA is
  6028.    originated.  However, two instances of the same LSA may not be
  6029.    originated within the time period MinLSInterval.  This may require
  6030.    that the generation of the next instance be delayed by up to
  6031.    MinLSInterval.  The following events may cause the contents of an LSA
  6032.    to change.  These events should cause new originations if and only if
  6033.    the contents of the new LSA would be different:
  6034.  
  6035.    (2) An interface's state changes (see Section 9.1).  This may
  6036.        mean that it is necessary to produce a new instance of the
  6037.        router-LSA.
  6038.  
  6039.    (3) An attached network's Designated Router changes.  A new
  6040.        router-LSA should be originated.  Also, if the router itself
  6041.        is now the Designated Router, a new network-LSA should be
  6042.        produced.  If the router itself is no longer the Designated
  6043.        Router, any network-LSA that it might have originated for
  6044.        the network should be flushed from the routing domain (see
  6045.        Section 14.1).
  6046.  
  6047.  
  6048.  
  6049.  
  6050. Moy                         Standards Track                   [Page 108]
  6051.  
  6052. RFC 2178                     OSPF Version 2                    July 1997
  6053.  
  6054.  
  6055.    (4) One of the neighboring routers changes to/from the FULL
  6056.        state.  This may mean that it is necessary to produce a new
  6057.        instance of the router-LSA.  Also, if the router is itself
  6058.        the Designated Router for the attached network, a new
  6059.        network-LSA should be produced.
  6060.  
  6061.    The next four events concern area border routers only:
  6062.  
  6063.    (5) An intra-area route has been added/deleted/modified in the
  6064.        routing table.  This may cause a new instance of a summary-
  6065.        LSA (for this route) to be originated in each attached area
  6066.        (possibly including the backbone).
  6067.  
  6068.    (6) An inter-area route has been added/deleted/modified in the
  6069.        routing table.  This may cause a new instance of a summary-
  6070.        LSA (for this route) to be originated in each attached area
  6071.        (but NEVER for the backbone).
  6072.  
  6073.    (7) The router becomes newly attached to an area.  The router
  6074.        must then originate summary-LSAs into the newly attached
  6075.        area for all pertinent intra-area and inter-area routes in
  6076.        the router's routing table.  See Section 12.4.3 for more
  6077.        details.
  6078.  
  6079.    (8) When the state of one of the router's configured virtual
  6080.        links changes, it may be necessary to originate a new
  6081.        router-LSA into the virtual link's Transit area (see the
  6082.        discussion of the router-LSA's bit V in Section 12.4.1), as
  6083.        well as originating a new router-LSA into the backbone.
  6084.  
  6085.    The last two events concern AS boundary routers (and former AS
  6086.    boundary routers) only:
  6087.  
  6088.    (9) An external route gained through direct experience with an
  6089.        external routing protocol (like BGP) changes.  This will
  6090.        cause an AS boundary router to originate a new instance of
  6091.        an AS-external-LSA.
  6092.  
  6093.    (10)
  6094.        A router ceases to be an AS boundary router, perhaps after
  6095.        restarting. In this situation the router should flush all
  6096.        AS-external-LSAs that it had previously originated.  These
  6097.        LSAs can be flushed via the premature aging procedure
  6098.        specified in Section 14.1.
  6099.  
  6100.  
  6101.  
  6102.  
  6103.  
  6104.  
  6105.  
  6106. Moy                         Standards Track                   [Page 109]
  6107.  
  6108. RFC 2178                     OSPF Version 2                    July 1997
  6109.  
  6110.  
  6111.    The construction of each type of LSA is explained in detail below. In
  6112.    general, these sections describe the contents of the LSA body (i.e.,
  6113.    the part coming after the 20-byte LSA header).  For information
  6114.    concerning the building of the LSA header, see Section 12.1.
  6115.  
  6116. 12.4.1.  Router-LSAs
  6117.  
  6118.    A router originates a router-LSA for each area that it belongs to.
  6119.    Such an LSA describes the collected states of the router's links to
  6120.    the area.  The LSA is flooded throughout the particular area, and no
  6121.    further.  The format of a router-LSA is shown in Appendix A (Section
  6122.    A.4.2).  The first 20 bytes of the LSA consist of the generic LSA
  6123.    header that was discussed in Section 12.1.  router-LSAs have LS type
  6124.    = 1.
  6125.  
  6126.    A router also indicates whether it is an area border router, or an AS
  6127.    boundary router, by setting the appropriate bits
  6128.  
  6129.                   ....................................
  6130.                   . 192.1.2                   Area 1 .
  6131.                   .     +                            .
  6132.                   .     |                            .
  6133.                   .     | 3+---+1                    .
  6134.                   .  N1 |--|RT1|-----+               .
  6135.                   .     |  +---+      \              .
  6136.                   .     |              \  _______N3  .
  6137.                   .     +               \/       \   .  1+---+
  6138.                   .                     * 192.1.1 *------|RT4|
  6139.                   .     +               /\_______/   .   +---+
  6140.                   .     |              /     |       .
  6141.                   .     | 3+---+1     /      |       .
  6142.                   .  N2 |--|RT2|-----+      1|       .
  6143.                   .     |  +---+           +---+8    .         6+---+
  6144.                   .     |                  |RT3|----------------|RT6|
  6145.                   .     +                  +---+     .          +---+
  6146.                   . 192.1.3                  |2      .   18.10.0.6|7
  6147.                   .                          |       .            |
  6148.                   .                   +------------+ .
  6149.                   .                     192.1.4 (N4) .
  6150.                   ....................................
  6151.  
  6152.                Figure 15: Area 1 with IP addresses shown
  6153.  
  6154.    (bit B and bit E, respectively) in its router-LSAs. This enables
  6155.    paths to those types of routers to be saved in the routing table, for
  6156.    later processing of summary-LSAs and AS-external-LSAs.  Bit B should
  6157.    be set whenever the router is actively attached to two or more areas,
  6158.    even if the router is not currently attached to the OSPF backbone
  6159.  
  6160.  
  6161.  
  6162. Moy                         Standards Track                   [Page 110]
  6163.  
  6164. RFC 2178                     OSPF Version 2                    July 1997
  6165.  
  6166.  
  6167.    area.  Bit E should never be set in a router-LSA for a stub area
  6168.    (stub areas cannot contain AS boundary routers).
  6169.  
  6170.    In addition, the router sets bit V in its router-LSA for Area A if
  6171.    and only if the router is the endpoint of one or more fully adjacent
  6172.    virtual links having Area A as their Transit area. The setting of bit
  6173.    V enables other routers in Area A to discover whether the area
  6174.    supports transit traffic (see TransitCapability in Section 6).
  6175.  
  6176.    The router-LSA then describes the router's working connections (i.e.,
  6177.    interfaces or links) to the area.  Each link is typed according to
  6178.    the kind of attached network.  Each link is also labelled with its
  6179.    Link ID.  This Link ID gives a name to the entity that is on the
  6180.    other end of the link.  Table 18 summarizes the values used for the
  6181.    Type and Link ID fields.
  6182.  
  6183.            Link type   Description       Link ID
  6184.            __________________________________________________
  6185.            1           Point-to-point    Neighbor Router ID
  6186.                        link
  6187.            2           Link to transit   Interface address of
  6188.                        network           Designated Router
  6189.            3           Link to stub      IP network number
  6190.                        network
  6191.            4           Virtual link      Neighbor Router ID
  6192.  
  6193.                    Table 18: Link descriptions in the
  6194.                               router-LSA.
  6195.  
  6196.    In addition, the Link Data field is specified for each link.  This
  6197.    field gives 32 bits of extra information for the link.  For links to
  6198.    transit networks, numbered point-to-point links and virtual links,
  6199.    this field specifies the IP interface address of the associated
  6200.    router interface (this is needed by the routing table calculation,
  6201.    see Section 16.1.1).  For links to stub networks, this field
  6202.    specifies the stub network's IP address mask. For unnumbered point-
  6203.    to-point links, the Link Data field should be set to the unnumbered
  6204.    interface's MIB-II [Ref8] ifIndex value.
  6205.  
  6206.    Finally, the cost of using the link for output is specified.  The
  6207.    output cost of a link is configurable. With the exception of links to
  6208.    stub networks, the output cost must always be non-zero.
  6209.  
  6210.    To further describe the process of building the list of link
  6211.    descriptions, suppose a router wishes to build a router-LSA for Area
  6212.    A.  The router examines its collection of interface data structures.
  6213.    For each interface, the following steps are taken:
  6214.  
  6215.  
  6216.  
  6217.  
  6218. Moy                         Standards Track                   [Page 111]
  6219.  
  6220. RFC 2178                     OSPF Version 2                    July 1997
  6221.  
  6222.  
  6223.    o    If the attached network does not belong to Area A, no
  6224.        links are added to the LSA, and the next interface should be
  6225.        examined.
  6226.  
  6227.    o    If the state of the interface is Down, no links are added.
  6228.  
  6229.    o    If the state of the interface is Loopback, add a Type 3
  6230.        link (stub network) as long as this is not an interface to an
  6231.        unnumbered point-to-point network.  The Link ID should be set to
  6232.        the IP interface address, the Link Data set to the
  6233.        mask 0xffffffff (indicating a host route), and the cost set to 0.
  6234.  
  6235.    o   Otherwise, the link descriptions added to the router-LSA
  6236.        depend on the OSPF interface type. Link descriptions used for
  6237.        point-to-point interfaces are specified in Section 12.4.1.1, for
  6238.        virtual links in Section 12.4.1.2, for broadcast and NBMA
  6239.        interfaces in 12.4.1.3, and for Point-to-MultiPoint interfaces in
  6240.        12.4.1.4.
  6241.  
  6242.    After consideration of all the router interfaces, host links are
  6243.    added to the router-LSA by examining the list of attached hosts
  6244.    belonging to Area A.  A host route is represented as a Type 3 link
  6245.    (stub network) whose Link ID is the host's IP address, Link Data is
  6246.    the mask of all ones (0xffffffff), and cost the host's configured
  6247.    cost (see Section C.7).
  6248.  
  6249. 12.4.1.1.  Describing point-to-point interfaces
  6250.  
  6251.    For point-to-point interfaces, one or more link descriptions are
  6252.    added to the router-LSA as follows:
  6253.  
  6254.    o   If the neighboring router is fully adjacent, add a
  6255.        Type 1 link (point-to-point). The Link ID should be set to the
  6256.        Router ID of the neighboring router. For numbered point-to-point
  6257.        networks, the Link Data should specify the IP interface address.
  6258.        For unnumbered point-to-point networks, the Link Data field
  6259.        should specify the interface's MIB-II [Ref8] ifIndex value. The
  6260.        cost should be set to the output cost of the point-to-point
  6261.        interface.
  6262.  
  6263.    o   In addition, as long as the state of the interface
  6264.        is "Point-to-Point" (and regardless of the neighboring router
  6265.        state), a Type 3 link (stub network) should be added. There are
  6266.        two forms that this stub link can take:
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274. Moy                         Standards Track                   [Page 112]
  6275.  
  6276. RFC 2178                     OSPF Version 2                    July 1997
  6277.  
  6278.  
  6279.    Option 1
  6280.       Assuming that the neighboring router's IP address is known, set
  6281.       the Link ID of the Type 3 link to the neighbor's IP address, the
  6282.       Link Data to the mask 0xffffffff (indicating a host route), and
  6283.       the cost to the interface's configured output cost.[15]
  6284.  
  6285.    Option 2
  6286.       If a subnet has been assigned to the point-to-point link, set the
  6287.       Link ID of the Type 3 link to the subnet's IP address, the Link
  6288.       Data to the subnet's mask, and the cost to the interface's
  6289.       configured output cost.[16]
  6290.  
  6291. 12.4.1.2.  Describing broadcast and NBMA interfaces
  6292.  
  6293.    For operational broadcast and NBMA interfaces, a single link
  6294.    description is added to the router-LSA as follows:
  6295.  
  6296.    o   If the state of the interface is Waiting, add a Type
  6297.        3 link (stub network) with Link ID set to the IP network number
  6298.        of the attached network, Link Data set to the attached network's
  6299.        address mask, and cost equal to the interface's configured output
  6300.        cost.
  6301.  
  6302.    o   Else, there has been a Designated Router elected for
  6303.        the attached network.  If the router is fully adjacent to the
  6304.        Designated Router, or if the router itself is Designated Router
  6305.        and is fully adjacent to at least one other router, add a single
  6306.        Type 2 link (transit network) with Link ID set to the IP
  6307.        interface address of the attached network's Designated Router
  6308.        (which may be the router itself), Link Data set to the router's
  6309.        own IP interface address, and cost equal to the interface's
  6310.        configured output cost.  Otherwise, add a link as if the
  6311.        interface state were Waiting (see above).
  6312.  
  6313. 12.4.1.3.  Describing virtual links
  6314.  
  6315.    For virtual links, a link description is added to the router-LSA only
  6316.    when the virtual neighbor is fully adjacent. In this case, add a Type
  6317.    4 link (virtual link) with Link ID set to the Router ID of the
  6318.    virtual neighbor, Link Data set to the IP interface address
  6319.    associated with the virtual link and cost set to the cost calculated
  6320.    for the virtual link during the routing table calculation (see
  6321.    Section 15).
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330. Moy                         Standards Track                   [Page 113]
  6331.  
  6332. RFC 2178                     OSPF Version 2                    July 1997
  6333.  
  6334.  
  6335. 12.4.1.4.  Describing Point-to-MultiPoint interfaces
  6336.  
  6337.    For operational Point-to-MultiPoint interfaces, one or more link
  6338.    descriptions are added to the router-LSA as follows:
  6339.  
  6340.    o   A single Type 3 link (stub network) is added with
  6341.        Link ID set to the router's own IP interface address, Link Data
  6342.        set to the mask 0xffffffff (indicating a host route), and cost
  6343.        set to 0.
  6344.  
  6345.    o   For each fully adjacent neighbor associated with the
  6346.        interface, add an additional Type 1 link (point-to-point) with
  6347.        Link ID set to the Router ID of the neighboring router, Link Data
  6348.        set to the IP interface address and cost equal to the interface's
  6349.        configured output cost.
  6350.  
  6351. 12.4.1.5.  Examples of router-LSAs
  6352.  
  6353.    Consider the router-LSAs generated by Router RT3, as pictured in
  6354.    Figure 6.  The area containing Router RT3 (Area 1) has been redrawn,
  6355.    with actual network addresses, in Figure 15.  Assume that the last
  6356.    byte of all of RT3's interface addresses is 3, giving it the
  6357.    interface addresses 192.1.1.3 and 192.1.4.3, and that the other
  6358.    routers have similar addressing schemes.  In addition, assume that
  6359.    all links are functional, and that Router IDs are assigned as the
  6360.    smallest IP interface address.
  6361.  
  6362.    RT3 originates two router-LSAs, one for Area 1 and one for the
  6363.    backbone.  Assume that Router RT4 has been selected as the Designated
  6364.    router for network 192.1.1.0.  RT3's router-LSA for Area 1 is then
  6365.    shown below.  It indicates that RT3 has two connections to Area 1,
  6366.    the first a link to the transit network 192.1.1.0 and the second a
  6367.    link to the stub network 192.1.4.0.  Note that the transit network is
  6368.    identified by the IP interface of its Designated Router (i.e., the
  6369.    Link ID = 192.1.1.4 which is the Designated Router RT4's IP interface
  6370.    to 192.1.1.0).  Note also that RT3 has indicated that it is an area
  6371.    border router.
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386. Moy                         Standards Track                   [Page 114]
  6387.  
  6388. RFC 2178                     OSPF Version 2                    July 1997
  6389.  
  6390.  
  6391.      ; RT3's router-LSA for Area 1
  6392.  
  6393.      LS age = 0                     ;always true on origination
  6394.      Options = (E-bit)              ;
  6395.      LS type = 1                    ;indicates router-LSA
  6396.      Link State ID = 192.1.1.3      ;RT3's Router ID
  6397.      Advertising Router = 192.1.1.3 ;RT3's Router ID
  6398.      bit E = 0                      ;not an AS boundary router
  6399.      bit B = 1                      ;area border router
  6400.      #links = 2
  6401.             Link ID = 192.1.1.4     ;IP address of Desig. Rtr.
  6402.             Link Data = 192.1.1.3   ;RT3's IP interface to net
  6403.             Type = 2                ;connects to transit network
  6404.             # TOS metrics = 0
  6405.             metric = 1
  6406.  
  6407.             Link ID = 192.1.4.0     ;IP Network number
  6408.             Link Data = 0xffffff00  ;Network mask
  6409.             Type = 3                ;connects to stub network
  6410.             # TOS metrics = 0
  6411.             metric = 2
  6412.  
  6413.    Next RT3's router-LSA for the backbone is shown.  It indicates that
  6414.    RT3 has a single attachment to the backbone.  This attachment is via
  6415.    an unnumbered point-to-point link to Router RT6.  RT3 has again
  6416.    indicated that it is an area border router.
  6417.  
  6418.  
  6419.      ; RT3's router-LSA for the backbone
  6420.  
  6421.      LS age = 0                     ;always true on origination
  6422.      Options = (E-bit)              ;
  6423.      LS type = 1                    ;indicates router-LSA
  6424.      Link State ID = 192.1.1.3      ;RT3's router ID
  6425.      Advertising Router = 192.1.1.3 ;RT3's router ID
  6426.      bit E = 0                      ;not an AS boundary router
  6427.      bit B = 1                      ;area border router
  6428.      #links = 1
  6429.             Link ID = 18.10.0.6     ;Neighbor's Router ID
  6430.             Link Data = 0.0.0.3     ;MIB-II ifIndex of P-P link
  6431.             Type = 1                ;connects to router
  6432.             # TOS metrics = 0
  6433.             metric = 8
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442. Moy                         Standards Track                   [Page 115]
  6443.  
  6444. RFC 2178                     OSPF Version 2                    July 1997
  6445.  
  6446.  
  6447. 12.4.2.  Network-LSAs
  6448.  
  6449.    A network-LSA is generated for every transit broadcast or NBMA
  6450.    network.  (A transit network is a network having two or more attached
  6451.    routers).  The network-LSA describes all the routers that are
  6452.    attached to the network.
  6453.  
  6454.    The Designated Router for the network originates the LSA.  The
  6455.    Designated Router originates the LSA only if it is fully adjacent to
  6456.    at least one other router on the network.  The network-LSA is flooded
  6457.    throughout the area that contains the transit network, and no
  6458.    further.  The network-LSA lists those routers that are fully adjacent
  6459.    to the Designated Router; each fully adjacent router is identified by
  6460.    its OSPF Router ID. The Designated Router includes itself in this
  6461.    list.
  6462.  
  6463.    The Link State ID for a network-LSA is the IP interface address of
  6464.    the Designated Router.  This value, masked by the network's address
  6465.    mask (which is also contained in the network-LSA) yields the
  6466.    network's IP address.
  6467.  
  6468.    A router that has formerly been the Designated Router for a network,
  6469.    but is no longer, should flush the network-LSA that it had previously
  6470.    originated.  This LSA is no longer used in the routing table
  6471.    calculation.  It is flushed by prematurely incrementing the LSA's age
  6472.    to MaxAge and reflooding (see Section 14.1). In addition, in those
  6473.    rare cases where a router's Router ID has changed, any network-LSAs
  6474.    that were originated with the router's previous Router ID must be
  6475.    flushed. Since the router may have no idea what it's previous Router
  6476.    ID might have been, these network-LSAs are indicated by having their
  6477.    Link State ID equal to one of the router's IP interface addresses and
  6478.    their Advertising Router equal to some value other than the router's
  6479.    current Router ID (see Section 13.4 for more details).
  6480.  
  6481. 12.4.2.1.  Examples of network-LSAs
  6482.  
  6483.    Again consider the area configuration in Figure 6.  Network-LSAs are
  6484.    originated for Network N3 in Area 1, Networks N6 and N8 in Area 2,
  6485.    and Network N9 in Area 3.  Assuming that Router RT4 has been selected
  6486.    as the Designated Router for Network N3, the following network-LSA is
  6487.    generated by RT4 on behalf of Network N3 (see Figure 15 for the
  6488.    address assignments):
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498. Moy                         Standards Track                   [Page 116]
  6499.  
  6500. RFC 2178                     OSPF Version 2                    July 1997
  6501.  
  6502.  
  6503.      ; Network-LSA for Network N3
  6504.  
  6505.      LS age = 0                     ;always true on origination
  6506.      Options = (E-bit)              ;
  6507.      LS type = 2                    ;indicates network-LSA
  6508.      Link State ID = 192.1.1.4      ;IP address of Desig. Rtr.
  6509.      Advertising Router = 192.1.1.4 ;RT4's Router ID
  6510.      Network Mask = 0xffffff00
  6511.             Attached Router = 192.1.1.4    ;Router ID
  6512.             Attached Router = 192.1.1.1    ;Router ID
  6513.             Attached Router = 192.1.1.2    ;Router ID
  6514.             Attached Router = 192.1.1.3    ;Router ID
  6515.  
  6516. 12.4.3.  Summary-LSAs
  6517.  
  6518.    The destination described by a summary-LSA is either an IP network,
  6519.    an AS boundary router or a range of IP addresses.  Summary-LSAs are
  6520.    flooded throughout a single area only.  The destination described is
  6521.    one that is external to the area, yet still belongs to the Autonomous
  6522.    System.
  6523.  
  6524.    Summary-LSAs are originated by area border routers.  The precise
  6525.    summary routes to advertise into an area are determined by examining
  6526.    the routing table structure (see Section 11) in accordance with the
  6527.    algorithm described below. Note that only intra-area routes are
  6528.    advertised into the backbone, while both intra-area and inter-area
  6529.    routes are advertised into the other areas.
  6530.  
  6531.    To determine which routes to advertise into an attached Area A, each
  6532.    routing table entry is processed as follows.  Remember that each
  6533.    routing table entry describes a set of equal-cost best paths to a
  6534.    particular destination:
  6535.  
  6536.    o  Only Destination Types of network and AS boundary router
  6537.       are advertised in summary-LSAs.  If the routing table entry's
  6538.       Destination Type is area border router, examine the next routing
  6539.       table entry.
  6540.  
  6541.    o  AS external routes are never advertised in summary-LSAs.
  6542.       If the routing table entry has Path-type of type 1 external or
  6543.       type 2 external, examine the next routing table entry.
  6544.  
  6545.    o  Else, if the area associated with this set of paths is
  6546.       the Area A itself, do not generate a summary-LSA for the
  6547.       route.[17]
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554. Moy                         Standards Track                   [Page 117]
  6555.  
  6556. RFC 2178                     OSPF Version 2                    July 1997
  6557.  
  6558.  
  6559.    o  Else, if the next hops associated with this set of paths
  6560.       belong to Area A itself, do not generate a summary-LSA for the
  6561.       route.[18] This is the logical equivalent of a Distance Vector
  6562.       protocol's split horizon logic.
  6563.  
  6564.    o  Else, if the routing table cost equals or exceeds the
  6565.       value LSInfinity, a summary-LSA cannot be generated for this
  6566.       route.
  6567.  
  6568.    o  Else, if the destination of this route is an AS boundary
  6569.       router, a summary-LSA should be originated if and only if the
  6570.       routing table entry describes the preferred path to the AS
  6571.       boundary router (see Step 3 of Section 16.4).  If so, a Type 4
  6572.       summary-LSA is originated for the destination, with Link State ID
  6573.       equal to the AS boundary router's Router ID and metric equal to
  6574.       the routing table entry's cost. Note: these LSAs should not be
  6575.       generated if Area A has been configured as a stub area.
  6576.  
  6577.    o  Else, the Destination type is network. If this is an
  6578.       inter-area route, generate a Type 3 summary-LSA for the
  6579.       destination, with Link State ID equal to the network's address (if
  6580.       necessary, the Link State ID can also have one or more of the
  6581.       network's host bits set; see Appendix E for details) and metric
  6582.       equal to the routing table cost.
  6583.  
  6584.    o  The one remaining case is an intra-area route to a network.  This
  6585.       means that the network is contained in one of the router's
  6586.       directly attached areas.  In general, this information must be
  6587.       condensed before appearing in summary-LSAs.  Remember that an area
  6588.       has a configured list of address ranges, each range consisting of
  6589.       an [address,mask] pair and a status indication of either Advertise
  6590.       or DoNotAdvertise.  At most a single Type 3 summary-LSA is
  6591.       originated for each range. When the range's status indicates
  6592.       Advertise, a Type 3 summary-LSA is generated with Link State ID
  6593.       equal to the range's address (if necessary, the Link State ID can
  6594.       also have one or more of the range's "host" bits set; see Appendix
  6595.       E for details) and cost equal to the largest cost of any of the
  6596.       component networks. When the range's status indicates
  6597.       DoNotAdvertise, the Type 3 summary-LSA is suppressed and the
  6598.       component networks remain hidden from other areas.
  6599.  
  6600.    By default, if a network is not contained in any explicitly
  6601.    configured address range, a Type 3 summary-LSA is generated with Link
  6602.    State ID equal to the network's address (if necessary, the Link State
  6603.    ID can also have one or more of the network's "host" bits set; see
  6604.    Appendix E for details) and metric equal to the network's routing
  6605.    table cost.
  6606.  
  6607.  
  6608.  
  6609.  
  6610. Moy                         Standards Track                   [Page 118]
  6611.  
  6612. RFC 2178                     OSPF Version 2                    July 1997
  6613.  
  6614.  
  6615.    If an area is capable of carrying transit traffic (i.e., its
  6616.    TransitCapability is set to TRUE), routing information concerning
  6617.    backbone networks should not be condensed before being summarized
  6618.    into the area.  Nor should the advertisement of backbone networks
  6619.    into transit areas be suppressed.  In other words, the backbone's
  6620.    configured ranges should be ignored when originating summary-LSAs
  6621.    into transit areas.
  6622.  
  6623.    If a router advertises a summary-LSA for a destination which then
  6624.    becomes unreachable, the router must then flush the LSA from the
  6625.    routing domain by setting its age to MaxAge and reflooding (see
  6626.    Section 14.1).  Also, if the destination is still reachable, yet can
  6627.    no longer be advertised according to the above procedure (e.g., it is
  6628.    now an inter-area route, when it used to be an intra-area route
  6629.    associated with some non-backbone area; it would thus no longer be
  6630.    advertisable to the backbone), the LSA should also be flushed from
  6631.    the routing domain.
  6632.  
  6633. 12.4.3.1.  Originating summary-LSAs into stub areas
  6634.  
  6635.    The algorithm in Section 12.4.3 is optional when Area A is an OSPF
  6636.    stub area. Area border routers connecting to a stub area can
  6637.    originate summary-LSAs into the area according to the Section
  6638.    12.4.3's algorithm, or can choose to originate only a subset of the
  6639.    summary-LSAs, possibly under configuration control.  The fewer LSAs
  6640.    originated, the smaller the stub area's link state database, further
  6641.    reducing the demands on its routers' resources. However, omitting
  6642.    LSAs may also lead to sub-optimal inter-area routing, although
  6643.    routing will continue to function.
  6644.  
  6645.    As specified in Section 12.4.3, Type 4 summary-LSAs (ASBR-summary-
  6646.    LSAs) are never originated into stub areas.
  6647.  
  6648.    In a stub area, instead of importing external routes each area border
  6649.    router originates a "default summary-LSA" into the area. The Link
  6650.    State ID for the default summary-LSA is set to DefaultDestination,
  6651.    and the metric set to the (per-area) configurable parameter
  6652.    StubDefaultCost.  Note that StubDefaultCost need not be configured
  6653.    identically in all of the stub area's area border routers.
  6654.  
  6655. 12.4.3.2.  Examples of summary-LSAs
  6656.  
  6657.    Consider again the area configuration in Figure 6.  Routers RT3, RT4,
  6658.    RT7, RT10 and RT11 are all area border routers, and therefore are
  6659.    originating summary-LSAs.  Consider in particular Router RT4.  Its
  6660.    routing table was calculated as the example in Section 11.3. RT4
  6661.    originates summary-LSAs into both the backbone and Area 1.  Into the
  6662.    backbone, Router RT4 originates separate LSAs for each of the
  6663.  
  6664.  
  6665.  
  6666. Moy                         Standards Track                   [Page 119]
  6667.  
  6668. RFC 2178                     OSPF Version 2                    July 1997
  6669.  
  6670.  
  6671.    networks N1-N4.  Into Area 1, Router RT4 originates separate LSAs for
  6672.    networks N6-N8 and the AS boundary routers RT5,RT7.  It also
  6673.    condenses host routes Ia and Ib into a single summary-LSA.  Finally,
  6674.    the routes to networks N9,N10,N11 and Host H1 are advertised by a
  6675.    single summary-LSA.  This condensation was originally performed by
  6676.    the router RT11.
  6677.  
  6678.    These LSAs are illustrated graphically in Figures 7 and 8.  Two of
  6679.    the summary-LSAs originated by Router RT4 follow.  The actual IP
  6680.    addresses for the networks and routers in question have been assigned
  6681.    in Figure 15.
  6682.  
  6683.      ; Summary-LSA for Network N1,
  6684.      ; originated by Router RT4 into the backbone
  6685.  
  6686.      LS age = 0                  ;always true on origination
  6687.      Options = (E-bit)           ;
  6688.      LS type = 3                 ;Type 3 summary-LSA
  6689.      Link State ID = 192.1.2.0   ;N1's IP network number
  6690.      Advertising Router = 192.1.1.4       ;RT4's ID
  6691.      metric = 4
  6692.  
  6693.      ; Summary-LSA for AS boundary router RT7
  6694.      ; originated by Router RT4 into Area 1
  6695.  
  6696.      LS age = 0                  ;always true on origination
  6697.      Options = (E-bit)           ;
  6698.      LS type = 4                 ;Type 4 summary-LSA
  6699.      Link State ID = Router RT7's ID
  6700.      Advertising Router = 192.1.1.4       ;RT4's ID
  6701.      metric = 14
  6702.  
  6703. 12.4.4.  AS-external-LSAs
  6704.  
  6705.    AS-external-LSAs describe routes to destinations external to the
  6706.    Autonomous System.  Most AS-external-LSAs describe routes to specific
  6707.    external destinations; in these cases the LSA's Link State ID is set
  6708.    to the destination network's IP address (if necessary, the Link State
  6709.    ID can also have one or more of the network's "host" bits set; see
  6710.    Appendix E for details).  However, a default route for the Autonomous
  6711.    System can be described in an AS-external-LSA by setting the LSA's
  6712.    Link State ID to DefaultDestination (0.0.0.0).  AS-external-LSAs are
  6713.    originated by AS boundary routers.  An AS boundary router originates
  6714.    a single AS-external-LSA for each external route that it has learned,
  6715.    either through another routing protocol (such as BGP), or through
  6716.    configuration information.
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722. Moy                         Standards Track                   [Page 120]
  6723.  
  6724. RFC 2178                     OSPF Version 2                    July 1997
  6725.  
  6726.  
  6727.    AS-external-LSAs are the only type of LSAs that are flooded
  6728.    throughout the entire Autonomous System; all other types of LSAs are
  6729.    specific to a single area.  However, AS-external-LSAs are not flooded
  6730.    into/throughout stub areas (see Section 3.6).  This enables a
  6731.    reduction in link state database size for routers internal to stub
  6732.    areas.
  6733.  
  6734.    The metric that is advertised for an external route can be one of two
  6735.    types.  Type 1 metrics are comparable to the link state metric.  Type
  6736.    2 metrics are assumed to be larger than the cost of any intra-AS
  6737.    path.
  6738.  
  6739.    If a router advertises an AS-external-LSA for a destination which
  6740.    then becomes unreachable, the router must then flush the LSA from the
  6741.    routing domain by setting its age to MaxAge and reflooding (see
  6742.    Section 14.1).
  6743.  
  6744. 12.4.4.1.  Examples of AS-external-LSAs
  6745.  
  6746.    Consider once again the AS pictured in Figure 6.  There are two AS
  6747.    boundary routers: RT5 and RT7.  Router RT5 originates three AS-
  6748.    external-LSAs, for networks N12-N14.  Router RT7 originates two AS-
  6749.    external-LSAs, for networks N12 and N15.  Assume that RT7 has learned
  6750.    its route to N12 via BGP, and that it wishes to advertise a Type 2
  6751.    metric to the AS.  RT7 would then originate the following LSA for
  6752.    N12:
  6753.  
  6754.      ; AS-external-LSA for Network N12,
  6755.      ; originated by Router RT7
  6756.  
  6757.      LS age = 0                  ;always true on origination
  6758.      Options = (E-bit)           ;
  6759.      LS type = 5                 ;AS-external-LSA
  6760.      Link State ID = N12's IP network number
  6761.      Advertising Router = Router RT7's ID
  6762.      bit E = 1                   ;Type 2 metric
  6763.      metric = 2
  6764.      Forwarding address = 0.0.0.0
  6765.  
  6766.    In the above example, the forwarding address field has been set to
  6767.    0.0.0.0, indicating that packets for the external destination should
  6768.    be forwarded to the advertising OSPF router (RT7). This is not always
  6769.    desirable.  Consider the example pictured in Figure 16.  There are
  6770.    three OSPF routers (RTA, RTB and RTC) connected to a common network.
  6771.    Only one of these routers, RTA, is exchanging BGP information with
  6772.    the non-OSPF router RTX.  RTA must then originate AS- external-LSAs
  6773.    for those destinations it has learned from RTX.  By using the AS-
  6774.    external-LSA's forwarding address field, RTA can specify that packets
  6775.  
  6776.  
  6777.  
  6778. Moy                         Standards Track                   [Page 121]
  6779.  
  6780. RFC 2178                     OSPF Version 2                    July 1997
  6781.  
  6782.  
  6783.    for these destinations be forwarded directly to RTX.  Without this
  6784.    feature, Routers RTB and RTC would take an extra hop to get to these
  6785.    destinations.
  6786.  
  6787.    Note that when the forwarding address field is non-zero, it should
  6788.    point to a router belonging to another Autonomous System.
  6789.  
  6790.    A forwarding address can also be specified for the default route. For
  6791.    example, in figure 16 RTA may want to specify that all externally-
  6792.    destined packets should by default be forwarded to its BGP peer RTX.
  6793.    The resulting AS-external-LSA is pictured below.  Note that the Link
  6794.    State ID is set to DefaultDestination.
  6795.  
  6796.      ; Default route, originated by Router RTA
  6797.      ; Packets forwarded through RTX
  6798.  
  6799.      LS age = 0                  ;always true on origination
  6800.      Options = (E-bit)           ;
  6801.      LS type = 5                 ;AS-external-LSA
  6802.      Link State ID = DefaultDestination  ; default route
  6803.      Advertising Router = Router RTA's ID
  6804.      bit E = 1                   ;Type 2 metric
  6805.      metric = 1
  6806.      Forwarding address = RTX's IP address
  6807.  
  6808.    In figure 16, suppose instead that both RTA and RTB exchange BGP
  6809.    information with RTX.  In this case, RTA and RTB would originate the
  6810.    same set of AS-external-LSAs.  These LSAs, if they specify the same
  6811.    metric, would be functionally equivalent since they would specify the
  6812.    same destination and forwarding address (RTX). This leads to a clear
  6813.    duplication of effort.  If only one of RTA or RTB originated the set
  6814.    of AS-external-LSAs, the routing would remain the same, and the size
  6815.    of the link state database would decrease.  However, it must be
  6816.    unambiguously defined as to which router originates the LSAs
  6817.    (otherwise neither may, or the identity of the originator may
  6818.    oscillate). The following rule is thereby established: if two
  6819.    routers, both reachable from one another, originate functionally
  6820.    equivalent AS-external-LSAs (i.e., same destination, cost and non-
  6821.    zero forwarding address), then the LSA originated by the router
  6822.    having the highest OSPF Router ID is used.  The router having the
  6823.    lower OSPF Router ID can then flush its LSA.  Flushing an LSA is
  6824.    discussed in Section 14.1.
  6825.  
  6826. 13.  The Flooding Procedure
  6827.  
  6828.    Link State Update packets provide the mechanism for flooding LSAs.  A
  6829.    Link State Update packet may contain several distinct LSAs, and
  6830.    floods each LSA one hop further from its point of origination.  To
  6831.  
  6832.  
  6833.  
  6834. Moy                         Standards Track                   [Page 122]
  6835.  
  6836. RFC 2178                     OSPF Version 2                    July 1997
  6837.  
  6838.  
  6839.    make the flooding procedure reliable, each LSA must be acknowledged
  6840.    separately.  Acknowledgments are transmitted in Link State
  6841.    Acknowledgment packets.  Many separate acknowledgments can also be
  6842.    grouped together into a single packet.
  6843.  
  6844.    The flooding procedure starts when a Link State Update packet has
  6845.    been received.  Many consistency checks have been made on the
  6846.    received packet before being handed to the flooding procedure (see
  6847.    Section 8.2).  In particular, the Link State Update packet has been
  6848.    associated with a particular neighbor, and a particular area.  If the
  6849.    neighbor is in a lesser state than Exchange, the packet should be
  6850.    dropped without further processing.
  6851.  
  6852.                                 +
  6853.                                 |
  6854.                       +---+.....|.BGP
  6855.                       |RTA|-----|.....+---+
  6856.                       +---+     |-----|RTX|
  6857.                                 |     +---+
  6858.                       +---+     |
  6859.                       |RTB|-----|
  6860.                       +---+     |
  6861.                                 |
  6862.                       +---+     |
  6863.                       |RTC|-----|
  6864.                       +---+     |
  6865.                                 |
  6866.                                 +
  6867.  
  6868.                  Figure 16: Forwarding address example
  6869.  
  6870.    All types of LSAs, other than AS-external-LSAs, are associated with a
  6871.    specific area.  However, LSAs do not contain an area field.  An LSA's
  6872.    area must be deduced from the Link State Update packet header.
  6873.  
  6874.    For each LSA contained in a Link State Update packet, the following
  6875.    steps are taken:
  6876.  
  6877.  
  6878.     (1) Validate the LSA's LS checksum.  If the checksum turns out to be
  6879.         invalid, discard the LSA and get the next one from the Link
  6880.         State Update packet.
  6881.  
  6882.     (2) Examine the LSA's LS type.  If the LS type is unknown, discard
  6883.         the LSA and get the next one from the Link State Update Packet.
  6884.         This specification defines LS types 1-5 (see Section 4.3).
  6885.  
  6886.     (3) Else if this is an AS-external-LSA (LS type = 5), and the area
  6887.  
  6888.  
  6889.  
  6890. Moy                         Standards Track                   [Page 123]
  6891.  
  6892. RFC 2178                     OSPF Version 2                    July 1997
  6893.  
  6894.  
  6895.         has been configured as a stub area, discard the LSA and get the
  6896.         next one from the Link State Update Packet.  AS-external-LSAs
  6897.         are not flooded into/throughout stub areas (see Section 3.6).
  6898.  
  6899.     (4) Else if the LSA's LS age is equal to MaxAge, and there is
  6900.         currently no instance of the LSA in the router's link state
  6901.         database, then take the following actions:
  6902.  
  6903.         (a) Acknowledge the receipt of the LSA by sending a Link State
  6904.             Acknowledgment packet back to the sending neighbor (see
  6905.             Section 13.5).
  6906.  
  6907.         (b) Purge all outstanding requests for equal or previous
  6908.             instances of the LSA from the sending neighbor's Link State
  6909.             Request list (see Section 10).
  6910.  
  6911.         (c) If the sending neighbor is in state Exchange or in state
  6912.             Loading, then install the MaxAge LSA in the link state
  6913.             database.  Otherwise, simply discard the LSA.  In either
  6914.             case, examine the next LSA (if any) listed in the Link State
  6915.             Update packet.
  6916.  
  6917.     (5) Otherwise, find the instance of this LSA that is currently
  6918.         contained in the router's link state database.  If there is no
  6919.         database copy, or the received LSA is more recent than the
  6920.         database copy (see Section 13.1 below for the determination of
  6921.         which LSA is more recent) the following steps must be performed:
  6922.  
  6923.         (a) If there is already a database copy, and if the database
  6924.             copy was installed less than MinLSArrival seconds ago,
  6925.             discard the new LSA (without acknowledging it) and examine
  6926.             the next LSA (if any) listed in the Link State Update
  6927.             packet.
  6928.  
  6929.         (b) Otherwise immediately flood the new LSA out some subset of
  6930.             the router's interfaces (see Section 13.3).  In some cases
  6931.             (e.g., the state of the receiving interface is DR and the
  6932.             LSA was received from a router other than the Backup DR) the
  6933.             LSA will be flooded back out the receiving interface.  This
  6934.             occurrence should be noted for later use by the
  6935.             acknowledgment process (Section 13.5).
  6936.  
  6937.         (c) Remove the current database copy from all neighbors' Link
  6938.             state retransmission lists.
  6939.  
  6940.         (d) Install the new LSA in the link state database (replacing
  6941.             the current database copy).  This may cause the routing
  6942.             table calculation to be scheduled.  In addition, timestamp
  6943.  
  6944.  
  6945.  
  6946. Moy                         Standards Track                   [Page 124]
  6947.  
  6948. RFC 2178                     OSPF Version 2                    July 1997
  6949.  
  6950.  
  6951.             the new LSA with the current time (i.e., the time it was
  6952.             received).  The flooding procedure cannot overwrite the
  6953.             newly installed LSA until MinLSArrival seconds have elapsed.
  6954.             The LSA installation process is discussed further in Section
  6955.             13.2.
  6956.  
  6957.         (e) Possibly acknowledge the receipt of the LSA by sending a
  6958.             Link State Acknowledgment packet back out the receiving
  6959.             interface.  This is explained below in Section 13.5.
  6960.  
  6961.         (f) If this new LSA indicates that it was originated by the
  6962.             receiving router itself (i.e., is considered a self-
  6963.             originated LSA), the router must take special action, either
  6964.             updating the LSA or in some cases flushing it from the
  6965.             routing domain. For a description of how self-originated
  6966.             LSAs are detected and subsequently handled, see Section
  6967.             13.4.
  6968.  
  6969.     (6) Else, if there is an instance of the LSA on the sending
  6970.         neighbor's Link state request list, an error has occurred in the
  6971.         Database Exchange process.  In this case, restart the Database
  6972.         Exchange process by generating the neighbor event BadLSReq for
  6973.         the sending neighbor and stop processing the Link State Update
  6974.         packet.
  6975.  
  6976.     (7) Else, if the received LSA is the same instance as the database
  6977.         copy (i.e., neither one is more recent) the following two steps
  6978.         should be performed:
  6979.  
  6980.         (a) If the LSA is listed in the Link state retransmission list
  6981.             for the receiving adjacency, the router itself is expecting
  6982.             an acknowledgment for this LSA.  The router should treat the
  6983.             received LSA as an acknowledgment by removing the LSA from
  6984.             the Link state retransmission list.  This is termed an
  6985.             "implied acknowledgment".  Its occurrence should be noted
  6986.             for later use by the acknowledgment process (Section 13.5).
  6987.  
  6988.         (b) Possibly acknowledge the receipt of the LSA by sending a
  6989.             Link State Acknowledgment packet back out the receiving
  6990.             interface.  This is explained below in Section 13.5.
  6991.  
  6992.     (8) Else, the database copy is more recent.  If the database copy
  6993.         has LS age equal to MaxAge and LS sequence number equal to
  6994.         MaxSequenceNumber, simply discard the received LSA without
  6995.         acknowledging it. (In this case, the LSA's LS sequence number is
  6996.         wrapping, and the MaxSequenceNumber LSA must be completely
  6997.         flushed before any new LSA instance can be introduced).
  6998.         Otherwise, send the database copy back to the sending neighbor,
  6999.  
  7000.  
  7001.  
  7002. Moy                         Standards Track                   [Page 125]
  7003.  
  7004. RFC 2178                     OSPF Version 2                    July 1997
  7005.  
  7006.  
  7007.         encapsulated within a Link State Update Packet. The Link State
  7008.         Update Packet should be unicast to the neighbor. In so doing, do
  7009.         not put the database copy of the LSA on the neighbor's link
  7010.         state retransmission list, and do not acknowledge the received
  7011.         (less recent) LSA instance.
  7012.  
  7013. 13.1.  Determining which LSA is newer
  7014.  
  7015.    When a router encounters two instances of an LSA, it must determine
  7016.    which is more recent.  This occurred above when comparing a received
  7017.    LSA to its database copy. This comparison must also be done during
  7018.    the Database Exchange procedure which occurs during adjacency bring-
  7019.    up.
  7020.  
  7021.    An LSA is identified by its LS type, Link State ID and Advertising
  7022.    Router.  For two instances of the same LSA, the LS sequence number,
  7023.    LS age, and LS checksum fields are used to determine which instance
  7024.    is more recent:
  7025.  
  7026.    o   The LSA having the newer LS sequence number is more recent.
  7027.        See Section 12.1.6 for an explanation of the LS sequence number
  7028.        space.  If both instances have the same LS sequence number, then:
  7029.  
  7030.    o   If the two instances have different LS checksums, then the
  7031.        instance having the larger LS checksum (when considered as a 16-
  7032.        bit unsigned integer) is considered more recent.
  7033.  
  7034.    o   Else, if only one of the instances has its LS age field set
  7035.        to MaxAge, the instance of age MaxAge is considered to be more
  7036.        recent.
  7037.  
  7038.    o   Else, if the LS age fields of the two instances differ by
  7039.        more than MaxAgeDiff, the instance having the smaller (younger)
  7040.        LS age is considered to be more recent.
  7041.  
  7042.    o   Else, the two instances are considered to be identical.
  7043.  
  7044.  
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  7056.  
  7057.  
  7058. Moy                         Standards Track                   [Page 126]
  7059.  
  7060. RFC 2178                     OSPF Version 2                    July 1997
  7061.  
  7062.  
  7063. 13.2.  Installing LSAs in the database
  7064.  
  7065.    Installing a new LSA in the database, either as the result of
  7066.    flooding or a newly self-originated LSA, may cause the OSPF routing
  7067.    table structure to be recalculated.  The contents of the new LSA
  7068.    should be compared to the old instance, if present.  If there is no
  7069.    difference, there is no need to recalculate the routing table. When
  7070.    comparing an LSA to its previous instance, the following are all
  7071.    considered to be differences in contents:
  7072.  
  7073.    o   The LSA's Options field has changed.
  7074.  
  7075.    o   One of the LSA instances has LS age set to MaxAge, and
  7076.        the other does not.
  7077.  
  7078.    o   The length field in the LSA header has changed.
  7079.  
  7080.    o   The body of the LSA (i.e., anything outside the 20-byte
  7081.        LSA header) has changed. Note that this excludes changes in LS
  7082.        Sequence Number and LS Checksum.
  7083.  
  7084.    If the contents are different, the following pieces of the routing
  7085.    table must be recalculated, depending on the new LSA's LS type field:
  7086.  
  7087.    Router-LSAs and network-LSAs
  7088.       The entire routing table must be recalculated, starting with the
  7089.       shortest path calculations for each area (not just the area whose
  7090.       link-state database has changed).  The reason that the shortest
  7091.       path calculation cannot be restricted to the single changed area
  7092.       has to do with the fact that AS boundary routers may belong to
  7093.       multiple areas.  A change in the area currently providing the best
  7094.       route may force the router to use an intra-area route provided by
  7095.       a different area.[19]
  7096.  
  7097.    Summary-LSAs
  7098.       The best route to the destination described by the summary-LSA
  7099.       must be recalculated (see Section 16.5).  If this destination is
  7100.       an AS boundary router, it may also be necessary to re-examine all
  7101.       the AS-external-LSAs.
  7102.  
  7103.    AS-external-LSAs
  7104.       The best route to the destination described by the AS-external-LSA
  7105.       must be recalculated (see Section 16.6).
  7106.  
  7107.       Also, any old instance of the LSA must be removed from the
  7108.       database when the new LSA is installed.  This old instance must
  7109.       also be removed from all neighbors' Link state retransmission
  7110.       lists (see Section 10).
  7111.  
  7112.  
  7113.  
  7114. Moy                         Standards Track                   [Page 127]
  7115.  
  7116. RFC 2178                     OSPF Version 2                    July 1997
  7117.  
  7118.  
  7119. 13.3.  Next step in the flooding procedure
  7120.  
  7121.    When a new (and more recent) LSA has been received, it must be
  7122.    flooded out some set of the router's interfaces.  This section
  7123.    describes the second part of flooding procedure (the first part being
  7124.    the processing that occurred in Section 13), namely, selecting the
  7125.    outgoing interfaces and adding the LSA to the appropriate neighbors'
  7126.    Link state retransmission lists.  Also included in this part of the
  7127.    flooding procedure is the maintenance of the neighbors' Link state
  7128.    request lists.
  7129.  
  7130.    This section is equally applicable to the flooding of an LSA that the
  7131.    router itself has just originated (see Section 12.4).
  7132.  
  7133.    For these LSAs, this section provides the entirety of the flooding
  7134.    procedure (i.e., the processing of Section 13 is not performed,
  7135.    since, for example, the LSA has not been received from a neighbor and
  7136.    therefore does not need to be acknowledged).
  7137.  
  7138.    Depending upon the LSA's LS type, the LSA can be flooded out only
  7139.    certain interfaces.  These interfaces, defined by the following, are
  7140.    called the eligible interfaces:
  7141.  
  7142.    AS-external-LSAs (LS Type = 5)
  7143.       AS-external-LSAs are flooded throughout the entire AS, with the
  7144.       exception of stub areas (see Section 3.6).  The eligible
  7145.       interfaces are all the router's interfaces, excluding virtual
  7146.       links and those interfaces attaching to stub areas.
  7147.  
  7148.    All other LS types
  7149.       All other types are specific to a single area (Area A).  The
  7150.       eligible interfaces are all those interfaces attaching to the Area
  7151.       A.  If Area A is the backbone, this includes all the virtual
  7152.       links.
  7153.  
  7154.    Link state databases must remain synchronized over all adjacencies
  7155.    associated with the above eligible interfaces.  This is accomplished
  7156.    by executing the following steps on each eligible interface.  It
  7157.    should be noted that this procedure may decide not to flood an LSA
  7158.    out a particular interface, if there is a high probability that the
  7159.    attached neighbors have already received the LSA.  However, in these
  7160.    cases the flooding procedure must be absolutely sure that the
  7161.    neighbors eventually do receive the LSA, so the LSA is still added to
  7162.    each adjacency's Link state retransmission list.  For each eligible
  7163.    interface:
  7164.  
  7165.  
  7166.  
  7167.  
  7168.  
  7169.  
  7170. Moy                         Standards Track                   [Page 128]
  7171.  
  7172. RFC 2178                     OSPF Version 2                    July 1997
  7173.  
  7174.  
  7175.    (1) Each of the neighbors attached to this interface are
  7176.        examined, to determine whether they must receive the new
  7177.        LSA.  The following steps are executed for each neighbor:
  7178.  
  7179.        (a) If the neighbor is in a lesser state than Exchange, it
  7180.            does not participate in flooding, and the next neighbor
  7181.            should be examined.
  7182.  
  7183.        (b) Else, if the adjacency is not yet full (neighbor state
  7184.            is Exchange or Loading), examine the Link state request
  7185.            list associated with this adjacency.  If there is an
  7186.            instance of the new LSA on the list, it indicates that
  7187.            the neighboring router has an instance of the LSA
  7188.            already.  Compare the new LSA to the neighbor's copy:
  7189.  
  7190.            o   If the new LSA is less recent, then examine the next
  7191.                neighbor.
  7192.  
  7193.            o   If the two copies are the same instance, then delete
  7194.                the LSA from the Link state request list, and
  7195.                examine the next neighbor.[20]
  7196.  
  7197.            o   Else, the new LSA is more recent.  Delete the LSA
  7198.                from the Link state request list.
  7199.  
  7200.        (c) If the new LSA was received from this neighbor, examine
  7201.            the next neighbor.
  7202.  
  7203.        (d) At this point we are not positive that the neighbor has
  7204.            an up-to-date instance of this new LSA.  Add the new LSA
  7205.            to the Link state retransmission list for the adjacency.
  7206.            This ensures that the flooding procedure is reliable;
  7207.            the LSA will be retransmitted at intervals until an
  7208.            acknowledgment is seen from the neighbor.
  7209.  
  7210.    (2) The router must now decide whether to flood the new LSA out
  7211.        this interface.  If in the previous step, the LSA was NOT
  7212.        added to any of the Link state retransmission lists, there
  7213.        is no need to flood the LSA out the interface and the next
  7214.        interface should be examined.
  7215.  
  7216.    (3) If the new LSA was received on this interface, and it was
  7217.        received from either the Designated Router or the Backup
  7218.        Designated Router, chances are that all the neighbors have
  7219.        received the LSA already.  Therefore, examine the next
  7220.        interface.
  7221.  
  7222.  
  7223.  
  7224.  
  7225.  
  7226. Moy                         Standards Track                   [Page 129]
  7227.  
  7228. RFC 2178                     OSPF Version 2                    July 1997
  7229.  
  7230.  
  7231.    (4) If the new LSA was received on this interface, and the
  7232.        interface state is Backup (i.e., the router itself is the
  7233.        Backup Designated Router), examine the next interface.  The
  7234.        Designated Router will do the flooding on this interface.
  7235.        However, if the Designated Router fails the router (i.e.,
  7236.        the Backup Designated Router) will end up retransmitting the
  7237.        updates.
  7238.  
  7239.    (5) If this step is reached, the LSA must be flooded out the
  7240.        interface.  Send a Link State Update packet (including the
  7241.        new LSA as contents) out the interface.  The LSA's LS age
  7242.        must be incremented by InfTransDelay (which must be > 0)
  7243.        when it is copied into the outgoing Link State Update packet
  7244.        (until the LS age field reaches the maximum value of
  7245.        MaxAge).
  7246.  
  7247.        On broadcast networks, the Link State Update packets are
  7248.        multicast.  The destination IP address specified for the
  7249.        Link State Update Packet depends on the state of the
  7250.        interface.  If the interface state is DR or Backup, the
  7251.        address AllSPFRouters should be used.  Otherwise, the
  7252.        address AllDRouters should be used.
  7253.  
  7254.        On non-broadcast networks, separate Link State Update
  7255.        packets must be sent, as unicasts, to each adjacent neighbor
  7256.        (i.e., those in state Exchange or greater).  The destination
  7257.        IP addresses for these packets are the neighbors' IP
  7258.        addresses.
  7259.  
  7260. 13.4.  Receiving self-originated LSAs
  7261.  
  7262.    It is a common occurrence for a router to receive self-originated
  7263.    LSAs via the flooding procedure. A self-originated LSA is detected
  7264.    when either 1) the LSA's Advertising Router is equal to the router's
  7265.    own Router ID or 2) the LSA is a network-LSA and its Link State ID is
  7266.    equal to one of the router's own IP interface addresses.
  7267.  
  7268.    However, if the received self-originated LSA is newer than the last
  7269.    instance that the router actually originated, the router must take
  7270.    special action.  The reception of such an LSA indicates that there
  7271.    are LSAs in the routing domain that were originated by the router
  7272.    before the last time it was restarted.  In most cases, the router
  7273.    must then advance the LSA's LS sequence number one past the received
  7274.    LS sequence number, and originate a new instance of the LSA.
  7275.  
  7276.    It may be the case the router no longer wishes to originate the
  7277.    received LSA. Possible examples include: 1) the LSA is a summary-LSA
  7278.    or AS-external-LSA and the router no longer has an (advertisable)
  7279.  
  7280.  
  7281.  
  7282. Moy                         Standards Track                   [Page 130]
  7283.  
  7284. RFC 2178                     OSPF Version 2                    July 1997
  7285.  
  7286.  
  7287.    route to the destination, 2) the LSA is a network-LSA but the router
  7288.    is no longer Designated Router for the network or 3) the LSA is a
  7289.    network-LSA whose Link State ID is one of the router's own IP
  7290.    interface addresses but whose Advertising Router is not equal to the
  7291.    router's own Router ID (this latter case should be rare, and it
  7292.    indicates that the router's Router ID has changed since originating
  7293.    the LSA).  In all these cases, instead of updating the LSA, the LSA
  7294.    should be flushed from the routing domain by incrementing the
  7295.    received LSA's LS age to MaxAge and reflooding (see Section 14.1).
  7296.  
  7297. 13.5.  Sending Link State Acknowledgment packets
  7298.  
  7299.    Each newly received LSA must be acknowledged.  This is usually done
  7300.    by sending Link State Acknowledgment packets.  However,
  7301.    acknowledgments can also be accomplished implicitly by sending Link
  7302.    State Update packets (see step 7a of Section 13).
  7303.  
  7304.    Many acknowledgments may be grouped together into a single Link State
  7305.    Acknowledgment packet.  Such a packet is sent back out the interface
  7306.    which received the LSAs.  The packet can be sent in one of two ways:
  7307.    delayed and sent on an interval timer, or sent directly (as a
  7308.    unicast) to a particular neighbor.  The particular acknowledgment
  7309.    strategy used depends on the circumstances surrounding the receipt of
  7310.    the LSA.
  7311.  
  7312.    Sending delayed acknowledgments accomplishes several things: 1) it
  7313.    facilitates the packaging of multiple acknowledgments in a single
  7314.    Link State Acknowledgment packet, 2) it enables a single Link State
  7315.    Acknowledgment packet to indicate acknowledgments to several
  7316.    neighbors at once (through multicasting) and 3) it randomizes the
  7317.    Link State Acknowledgment packets sent by the various routers
  7318.    attached to a common network.  The fixed interval between a router's
  7319.    delayed transmissions must be short (less than RxmtInterval) or
  7320.    needless retransmissions will ensue.
  7321.  
  7322.    Direct acknowledgments are sent to a particular neighbor in response
  7323.    to the receipt of duplicate LSAs.  These acknowledgments are sent as
  7324.    unicasts, and are sent immediately when the duplicate is received.
  7325.  
  7326.    The precise procedure for sending Link State Acknowledgment packets
  7327.    is described in Table 19.  The circumstances surrounding the receipt
  7328.    of the LSA are listed in the left column.  The acknowledgment action
  7329.    then taken is listed in one of the two right columns.  This action
  7330.    depends on the state of the concerned interface; interfaces in state
  7331.    Backup behave differently from interfaces in all other states.
  7332.    Delayed acknowledgments must be delivered to all adjacent routers
  7333.    associated with the interface.  On broadcast networks, this is
  7334.    accomplished by sending the delayed Link State Acknowledgment packets
  7335.  
  7336.  
  7337.  
  7338. Moy                         Standards Track                   [Page 131]
  7339.  
  7340. RFC 2178                     OSPF Version 2                    July 1997
  7341.  
  7342.  
  7343.    as multicasts.  The Destination IP address used depends on the state
  7344.    of the interface.  If the interface state is DR or Backup, the
  7345.    destination AllSPFRouters is used.  In all other states, the
  7346.    destination AllDRouters is used.  On non-broadcast networks, delayed
  7347.    Link State Acknowledgment packets must be unicast separately over
  7348.    each adjacency (i.e., neighbor whose state is >= Exchange).
  7349.  
  7350.                                     Action taken in state
  7351.     Circumstances          Backup                All other states
  7352.     _______________________________________________________________
  7353.     LSA  has               No  acknowledgment    No  acknowledgment
  7354.     been  flooded back     sent.                 sent.
  7355.     out receiving  in-
  7356.     terface  (see Sec-
  7357.     tion 13, step 5b).
  7358.     _______________________________________________________________
  7359.     LSA   is               Delayed acknowledg-   Delayed       ack-
  7360.     more  recent  than     ment sent if adver-   nowledgment sent.
  7361.     database copy, but     tisement   received
  7362.     was   not  flooded     from    Designated
  7363.     back out receiving     Router,  otherwise
  7364.     interface              do nothing
  7365.     _______________________________________________________________
  7366.     LSA is a               Delayed acknowledg-   No  acknowledgment
  7367.     duplicate, and was     ment sent if adver-   sent.
  7368.     treated as an  im-     tisement   received
  7369.     plied  acknowledg-     from    Designated
  7370.     ment (see  Section     Router,  otherwise
  7371.     13, step 7a).          do nothing
  7372.     _______________________________________________________________
  7373.     LSA is a               Direct acknowledg-    Direct acknowledg-
  7374.     duplicate, and was     ment sent.            ment sent.
  7375.     not treated as  an
  7376.     implied       ack-
  7377.     nowledgment.
  7378.     _______________________________________________________________
  7379.     LSA's LS               Direct acknowledg-    Direct acknowledg-
  7380.     age is equal to        ment sent.            ment sent.
  7381.     MaxAge, and there is
  7382.     no current instance
  7383.     of the LSA
  7384.     in the link state
  7385.     database (see
  7386.     Section 13, step 4).
  7387.  
  7388.  
  7389.              Table 19: Sending link state acknowledgments.
  7390.  
  7391.  
  7392.  
  7393.  
  7394. Moy                         Standards Track                   [Page 132]
  7395.  
  7396. RFC 2178                     OSPF Version 2                    July 1997
  7397.  
  7398.  
  7399.    The reasoning behind sending the above packets as multicasts is best
  7400.    explained by an example.  Consider the network configuration depicted
  7401.    in Figure 15.  Suppose RT4 has been elected as Designated Router, and
  7402.    RT3 as Backup Designated Router for the network N3.  When Router RT4
  7403.    floods a new LSA to Network N3, it is received by routers RT1, RT2,
  7404.    and RT3.  These routers will not flood the LSA back onto net N3, but
  7405.    they still must ensure that their link-state databases remain
  7406.    synchronized with their adjacent neighbors.  So RT1, RT2, and RT4 are
  7407.    waiting to see an acknowledgment from RT3.  Likewise, RT4 and RT3 are
  7408.    both waiting to see acknowledgments from RT1 and RT2.  This is best
  7409.    achieved by sending the acknowledgments as multicasts.
  7410.  
  7411.    The reason that the acknowledgment logic for Backup DRs is slightly
  7412.    different is because they perform differently during the flooding of
  7413.    LSAs (see Section 13.3, step 4).
  7414.  
  7415.  
  7416. 13.6.  Retransmitting LSAs
  7417.  
  7418.    LSAs flooded out an adjacency are placed on the adjacency's Link
  7419.    state retransmission list.  In order to ensure that flooding is
  7420.    reliable, these LSAs are retransmitted until they are acknowledged.
  7421.    The length of time between retransmissions is a configurable per-
  7422.    interface value, RxmtInterval.  If this is set too low for an
  7423.    interface, needless retransmissions will ensue.  If the value is set
  7424.    too high, the speed of the flooding, in the face of lost packets, may
  7425.    be affected.
  7426.  
  7427.    Several retransmitted LSAs may fit into a single Link State Update
  7428.    packet.  When LSAs are to be retransmitted, only the number fitting
  7429.    in a single Link State Update packet should be sent.  Another packet
  7430.    of retransmissions can be sent whenever some of the LSAs are
  7431.    acknowledged, or on the next firing of the retransmission timer.
  7432.  
  7433.    Link State Update Packets carrying retransmissions are always sent as
  7434.    unicasts (directly to the physical address of the neighbor).  They
  7435.    are never sent as multicasts.  Each LSA's LS age must be incremented
  7436.    by InfTransDelay (which must be > 0) when it is copied into the
  7437.    outgoing Link State Update packet (until the LS age field reaches the
  7438.    maximum value of MaxAge).
  7439.  
  7440.    If an adjacent router goes down, retransmissions may occur until the
  7441.    adjacency is destroyed by OSPF's Hello Protocol.  When the adjacency
  7442.    is destroyed, the Link state retransmission list is cleared.
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450. Moy                         Standards Track                   [Page 133]
  7451.  
  7452. RFC 2178                     OSPF Version 2                    July 1997
  7453.  
  7454.  
  7455. 13.7.  Receiving link state acknowledgments
  7456.  
  7457.    Many consistency checks have been made on a received Link State
  7458.    Acknowledgment packet before it is handed to the flooding procedure.
  7459.    In particular, it has been associated with a particular neighbor.  If
  7460.    this neighbor is in a lesser state than Exchange, the Link State
  7461.    Acknowledgment packet is discarded.
  7462.  
  7463.    Otherwise, for each acknowledgment in the Link State Acknowledgment
  7464.    packet, the following steps are performed:
  7465.  
  7466.  
  7467.    o   Does the LSA acknowledged have an instance on the Link state
  7468.        retransmission list for the neighbor?  If not, examine the
  7469.        next acknowledgment.  Otherwise:
  7470.  
  7471.    o   If the acknowledgment is for the same instance that is
  7472.        contained on the list, remove the item from the list and
  7473.        examine the next acknowledgment.  Otherwise:
  7474.  
  7475.       o   Log the questionable acknowledgment, and examine the next
  7476.           one.
  7477.  
  7478. 14.  Aging The Link State Database
  7479.  
  7480.    Each LSA has an LS age field.  The LS age is expressed in seconds.
  7481.    An LSA's LS age field is incremented while it is contained in a
  7482.    router's database.  Also, when copied into a Link State Update Packet
  7483.    for flooding out a particular interface, the LSA's LS age is
  7484.    incremented by InfTransDelay.
  7485.  
  7486.    An LSA's LS age is never incremented past the value MaxAge.  LSAs
  7487.    having age MaxAge are not used in the routing table calculation.  As
  7488.    a router ages its link state database, an LSA's LS age may reach
  7489.    MaxAge.[21]  At this time, the router must attempt to flush the LSA
  7490.    from the routing domain.  This is done simply by reflooding the
  7491.    MaxAge LSA just as if it was a newly originated LSA (see Section
  7492.    13.3).
  7493.  
  7494.    When creating a Database summary list for a newly forming adjacency,
  7495.    any MaxAge LSAs present in the link state database are added to the
  7496.    neighbor's Link state retransmission list instead of the neighbor's
  7497.    Database summary list.  See Section 10.3 for more details.
  7498.  
  7499.    A MaxAge LSA must be removed immediately from the router's link state
  7500.    database as soon as both a) it is no longer contained on any neighbor
  7501.    Link state retransmission lists and b) none of the router's neighbors
  7502.    are in states Exchange or Loading.
  7503.  
  7504.  
  7505.  
  7506. Moy                         Standards Track                   [Page 134]
  7507.  
  7508. RFC 2178                     OSPF Version 2                    July 1997
  7509.  
  7510.  
  7511.    When, in the process of aging the link state database, an LSA's LS
  7512.    age hits a multiple of CheckAge, its LS checksum should be verified.
  7513.    If the LS checksum is incorrect, a program or memory error has been
  7514.    detected, and at the very least the router itself should be
  7515.    restarted.
  7516.  
  7517. 14.1.  Premature aging of LSAs
  7518.  
  7519.    An LSA can be flushed from the routing domain by setting its LS age
  7520.    to MaxAge and reflooding the LSA.  This procedure follows the same
  7521.    course as flushing an LSA whose LS age has naturally reached the
  7522.    value MaxAge (see Section 14).  In particular, the MaxAge LSA is
  7523.    removed from the router's link state database as soon as a) it is no
  7524.    longer contained on any neighbor Link state retransmission lists and
  7525.    b) none of the router's neighbors are in states Exchange or Loading.
  7526.    We call the setting of an LSA's LS age to MaxAge "premature aging".
  7527.  
  7528.    Premature aging is used when it is time for a self-originated LSA's
  7529.    sequence number field to wrap.  At this point, the current LSA
  7530.    instance (having LS sequence number MaxSequenceNumber) must be
  7531.    prematurely aged and flushed from the routing domain before a new
  7532.    instance with sequence number equal to InitialSequenceNumber can be
  7533.    originated.  See Section 12.1.6 for more information.
  7534.  
  7535.    Premature aging can also be used when, for example, one of the
  7536.    router's previously advertised external routes is no longer
  7537.    reachable.  In this circumstance, the router can flush its AS-
  7538.    external-LSA from the routing domain via premature aging. This
  7539.    procedure is preferable to the alternative, which is to originate a
  7540.    new LSA for the destination specifying a metric of LSInfinity.
  7541.    Premature aging is also be used when unexpectedly receiving self-
  7542.    originated LSAs during the flooding procedure (see Section 13.4).
  7543.  
  7544.    A router may only prematurely age its own self-originated LSAs.  The
  7545.    router may not prematurely age LSAs that have been originated by
  7546.    other routers. An LSA is considered self- originated when either 1)
  7547.    the LSA's Advertising Router is equal to the router's own Router ID
  7548.    or 2) the LSA is a network-LSA and its Link State ID is equal to one
  7549.    of the router's own IP interface addresses.
  7550.  
  7551. 15.  Virtual Links
  7552.  
  7553.    The single backbone area (Area ID = 0.0.0.0) cannot be disconnected,
  7554.    or some areas of the Autonomous System will become unreachable.  To
  7555.    establish/maintain connectivity of the backbone, virtual links can be
  7556.    configured through non-backbone areas.  Virtual links serve to
  7557.    connect physically separate components of the backbone.  The two
  7558.    endpoints of a virtual link are area border routers.  The virtual
  7559.  
  7560.  
  7561.  
  7562. Moy                         Standards Track                   [Page 135]
  7563.  
  7564. RFC 2178                     OSPF Version 2                    July 1997
  7565.  
  7566.  
  7567.    link must be configured in both routers.  The configuration
  7568.    information in each router consists of the other virtual endpoint
  7569.    (the other area border router), and the non-backbone area the two
  7570.    routers have in common (called the Transit area).  Virtual links
  7571.    cannot be configured through stub areas (see Section 3.6).
  7572.  
  7573.    The virtual link is treated as if it were an unnumbered point-to-
  7574.    point network belonging to the backbone and joining the two area
  7575.    border routers.  An attempt is made to establish an adjacency over
  7576.    the virtual link.  When this adjacency is established, the virtual
  7577.    link will be included in backbone router-LSAs, and OSPF packets
  7578.    pertaining to the backbone area will flow over the adjacency.  Such
  7579.    an adjacency has been referred to in this document as a "virtual
  7580.    adjacency".
  7581.  
  7582.    In each endpoint router, the cost and viability of the virtual link
  7583.    is discovered by examining the routing table entry for the other
  7584.    endpoint router.  (The entry's associated area must be the configured
  7585.    Transit area).  This is called the virtual link's corresponding
  7586.    routing table entry. The InterfaceUp event occurs for a virtual link
  7587.    when its corresponding routing table entry becomes reachable.
  7588.    Conversely, the InterfaceDown event occurs when its routing table
  7589.    entry becomes unreachable.  In other words, the virtual link's
  7590.    viability is determined by the existence of an intra-area path,
  7591.    through the Transit area, between the two endpoints. Note that a
  7592.    virtual link whose underlying path has cost greater than hexadecimal
  7593.    0xffff (the maximum size of an interface cost in a router-LSA) should
  7594.    be considered inoperational (i.e., treated the same as if the path
  7595.    did not exist).
  7596.  
  7597.    The other details concerning virtual links are as follows:
  7598.  
  7599.    o AS-external-LSAs are NEVER flooded over virtual adjacencies.  This
  7600.    would be duplication of effort, since the same AS-external-LSAs are
  7601.    already flooded throughout the virtual link's Transit area.  For this
  7602.    same reason, AS-external-LSAs are not summarized over virtual
  7603.    adjacencies during the Database Exchange process.
  7604.  
  7605.    o The cost of a virtual link is NOT configured.  It is defined to be
  7606.    the cost of the intra-area path between the two defining area border
  7607.    routers.  This cost appears in the virtual link's corresponding
  7608.    routing table entry.  When the cost of a virtual link changes, a new
  7609.    router-LSA should be originated for the backbone area.
  7610.  
  7611.    o Just as the virtual link's cost and viability are determined by the
  7612.    routing table build process (through construction of the routing
  7613.    table entry for the other endpoint), so are the IP interface address
  7614.    for the virtual interface and the virtual neighbor's IP address.
  7615.  
  7616.  
  7617.  
  7618. Moy                         Standards Track                   [Page 136]
  7619.  
  7620. RFC 2178                     OSPF Version 2                    July 1997
  7621.  
  7622.  
  7623.    These are used when sending OSPF protocol packets over the virtual
  7624.    link. Note that when one (or both) of the virtual link endpoints
  7625.    connect to the Transit area via an unnumbered point-to-point link, it
  7626.    may be impossible to calculate either the virtual interface's IP
  7627.    address and/or the virtual neighbor's IP address, thereby causing the
  7628.    virtual link to fail.
  7629.  
  7630.    o In each endpoint's router-LSA for the backbone, the virtual link is
  7631.    represented as a Type 4 link whose Link ID is set to the virtual
  7632.    neighbor's OSPF Router ID and whose Link Data is set to the virtual
  7633.    interface's IP address.  See Section 12.4.1 for more information.
  7634.  
  7635.    o A non-backbone area can carry transit data traffic (i.e., is
  7636.    considered a "transit area") if and only if it serves as the Transit
  7637.    area for one or more fully adjacent virtual links (see
  7638.    TransitCapability in Sections 6 and 16.1). Such an area requires
  7639.    special treatment when summarizing backbone networks into it (see
  7640.    Section 12.4.3), and during the routing calculation (see Section
  7641.    16.3).
  7642.  
  7643.    o The time between link state retransmissions, RxmtInterval, is
  7644.    configured for a virtual link. This should be well over the expected
  7645.    round-trip delay between the two routers.  This may be hard to
  7646.    estimate for a virtual link; it is better to err on the side of
  7647.    making it too large.
  7648.  
  7649. 16.  Calculation of the routing table
  7650.  
  7651.    This section details the OSPF routing table calculation.  Using its
  7652.    attached areas' link state databases as input, a router runs the
  7653.    following algorithm, building its routing table step by step.  At
  7654.    each step, the router must access individual pieces of the link state
  7655.    databases (e.g., a router-LSA originated by a certain router).  This
  7656.    access is performed by the lookup function discussed in Section 12.2.
  7657.    The lookup process may return an LSA whose LS age is equal to MaxAge.
  7658.    Such an LSA should not be used in the routing table calculation, and
  7659.    is treated just as if the lookup process had failed.
  7660.  
  7661.    The OSPF routing table's organization is explained in Section 11.
  7662.    Two examples of the routing table build process are presented in
  7663.    Sections 11.2 and 11.3.  This process can be broken into the
  7664.    following steps:
  7665.  
  7666.    (1) The present routing table is invalidated.  The routing table is
  7667.         built again from scratch.  The old routing table is saved so
  7668.         that changes in routing table entries can be identified.
  7669.  
  7670.  
  7671.  
  7672.  
  7673.  
  7674. Moy                         Standards Track                   [Page 137]
  7675.  
  7676. RFC 2178                     OSPF Version 2                    July 1997
  7677.  
  7678.  
  7679.    (2) The intra-area routes are calculated by building the shortest-
  7680.        path tree for each attached area.  In particular, all routing
  7681.        table entries whose Destination Type is "area border router" are
  7682.        calculated in this step.  This step is described in two parts.
  7683.        At first the tree is constructed by only considering those links
  7684.        between routers and transit networks.  Then the stub networks
  7685.        are incorporated into the tree.  During the area's shortest-path
  7686.        tree calculation, the area's TransitCapability is also
  7687.        calculated for later use in Step 4.
  7688.  
  7689.    (3) The inter-area routes are calculated, through examination of
  7690.        summary-LSAs.  If the router is attached to multiple areas
  7691.        (i.e., it is an area border router), only backbone summary-LSAs
  7692.        are examined.
  7693.  
  7694.    (4) In area border routers connecting to one or more transit areas
  7695.        (i.e, non-backbone areas whose TransitCapability is found to be
  7696.        TRUE), the transit areas' summary-LSAs are examined to see
  7697.        whether better paths exist using the transit areas than were
  7698.        found in Steps 2-3 above.
  7699.  
  7700.    (5) Routes to external destinations are calculated, through
  7701.        examination of AS-external-LSAs.  The locations of the AS
  7702.        boundary routers (which originate the AS-external-LSAs) have
  7703.        been determined in steps 2-4.
  7704.  
  7705.    Steps 2-5 are explained in further detail below.
  7706.  
  7707.    Changes made to routing table entries as a result of these
  7708.    calculations can cause the OSPF protocol to take further actions.
  7709.    For example, a change to an intra-area route will cause an area
  7710.    border router to originate new summary-LSAs (see Section 12.4).  See
  7711.  
  7712.    Section 16.7 for a complete list of the OSPF protocol actions
  7713.    resulting from routing table changes.
  7714.  
  7715. 16.1.  Calculating the shortest-path tree for an area
  7716.  
  7717.    This calculation yields the set of intra-area routes associated with
  7718.    an area (called hereafter Area A).  A router calculates the
  7719.    shortest-path tree using itself as the root.[22] The formation of the
  7720.    shortest path tree is done here in two stages.  In the first stage,
  7721.    only links between routers and transit networks are considered.
  7722.    Using the Dijkstra algorithm, a tree is formed from this subset of
  7723.    the link state database.  In the second stage, leaves are added to
  7724.    the tree by considering the links to stub networks.
  7725.  
  7726.  
  7727.  
  7728.  
  7729.  
  7730. Moy                         Standards Track                   [Page 138]
  7731.  
  7732. RFC 2178                     OSPF Version 2                    July 1997
  7733.  
  7734.  
  7735.    The procedure will be explained using the graph terminology that was
  7736.    introduced in Section 2.  The area's link state database is
  7737.    represented as a directed graph.  The graph's vertices are routers,
  7738.    transit networks and stub networks.  The first stage of the procedure
  7739.    concerns only the transit vertices (routers and transit networks) and
  7740.    their connecting links.  Throughout the shortest path calculation,
  7741.    the following data is also associated with each transit vertex:
  7742.  
  7743.  
  7744.    Vertex (node) ID
  7745.        A 32-bit number uniquely identifying the vertex.  For router
  7746.        vertices this is the router's OSPF Router ID.  For network
  7747.        vertices, this is the IP address of the network's Designated
  7748.        Router.
  7749.  
  7750.    An LSA
  7751.        Each transit vertex has an associated LSA.  For router
  7752.        vertices, this is a router-LSA.  For transit networks, this
  7753.        is a network-LSA (which is actually originated by the
  7754.        network's Designated Router).  In any case, the LSA's Link
  7755.        State ID is always equal to the above Vertex ID.
  7756.  
  7757.    List of next hops
  7758.        The list of next hops for the current set of shortest paths
  7759.        from the root to this vertex.  There can be multiple
  7760.        shortest paths due to the equal-cost multipath capability.
  7761.        Each next hop indicates the outgoing router interface to use
  7762.        when forwarding traffic to the destination.  On broadcast,
  7763.        Point-to-MultiPoint and NBMA networks, the next hop also
  7764.        includes the IP address of the next router (if any) in the
  7765.        path towards the destination.
  7766.  
  7767.    Distance from root
  7768.        The link state cost of the current set of shortest paths
  7769.        from the root to the vertex.  The link state cost of a path
  7770.        is calculated as the sum of the costs of the path's
  7771.        constituent links (as advertised in router-LSAs and
  7772.        network-LSAs).  One path is said to be "shorter" than
  7773.        another if it has a smaller link state cost.
  7774.  
  7775.  
  7776.    The first stage of the procedure (i.e., the Dijkstra algorithm) can
  7777.    now be summarized as follows. At each iteration of the algorithm,
  7778.    there is a list of candidate vertices.  Paths from the root to these
  7779.    vertices have been found, but not necessarily the shortest ones.
  7780.    However, the paths to the candidate vertex that is closest to the
  7781.    root are guaranteed to be shortest; this vertex is added to the
  7782.    shortest-path tree, removed from the candidate list, and its adjacent
  7783.  
  7784.  
  7785.  
  7786. Moy                         Standards Track                   [Page 139]
  7787.  
  7788. RFC 2178                     OSPF Version 2                    July 1997
  7789.  
  7790.  
  7791.    vertices are examined for possible addition to/modification of the
  7792.    candidate list.  The algorithm then iterates again.  It terminates
  7793.    when the candidate list becomes empty.
  7794.  
  7795.    The following steps describe the algorithm in detail.  Remember that
  7796.    we are computing the shortest path tree for Area A.  All references
  7797.    to link state database lookup below are from Area A's database.
  7798.  
  7799.    (1) Initialize the algorithm's data structures.  Clear the list
  7800.        of candidate vertices.  Initialize the shortest-path tree to
  7801.        only the root (which is the router doing the calculation).
  7802.        Set Area A's TransitCapability to FALSE.
  7803.  
  7804.    (2) Call the vertex just added to the tree vertex V.  Examine
  7805.        the LSA associated with vertex V.  This is a lookup in the
  7806.        Area A's link state database based on the Vertex ID.  If
  7807.        this is a router-LSA, and bit V of the router-LSA (see
  7808.        Section A.4.2) is set, set Area A's TransitCapability to
  7809.        TRUE.  In any case, each link described by the LSA gives the
  7810.        cost to an adjacent vertex.  For each described link, (say
  7811.        it joins vertex V to vertex W):
  7812.  
  7813.        (a) If this is a link to a stub network, examine the next
  7814.            link in V's LSA.  Links to stub networks will be
  7815.            considered in the second stage of the shortest path
  7816.            calculation.
  7817.  
  7818.        (b) Otherwise, W is a transit vertex (router or transit
  7819.            network).  Look up the vertex W's LSA (router-LSA or
  7820.            network-LSA) in Area A's link state database.  If the
  7821.            LSA does not exist, or its LS age is equal to MaxAge, or
  7822.            it does not have a link back to vertex V, examine the
  7823.            next link in V's LSA.[23]
  7824.  
  7825.        (c) If vertex W is already on the shortest-path tree,
  7826.            examine the next link in the LSA.
  7827.  
  7828.        (d) Calculate the link state cost D of the resulting path
  7829.            from the root to vertex W.  D is equal to the sum of the
  7830.            link state cost of the (already calculated) shortest
  7831.            path to vertex V and the advertised cost of the link
  7832.            between vertices V and W.  If D is:
  7833.  
  7834.            o   Greater than the value that already appears for
  7835.                vertex W on the candidate list, then examine the
  7836.                next link.
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842. Moy                         Standards Track                   [Page 140]
  7843.  
  7844. RFC 2178                     OSPF Version 2                    July 1997
  7845.  
  7846.  
  7847.            o   Equal to the value that appears for vertex W on the
  7848.                candidate list, calculate the set of next hops that
  7849.                result from using the advertised link.  Input to
  7850.                this calculation is the destination (W), and its
  7851.                parent (V).  This calculation is shown in Section
  7852.                16.1.1.  This set of hops should be added to the
  7853.                next hop values that appear for W on the candidate
  7854.                list.
  7855.  
  7856.            o   Less than the value that appears for vertex W on the
  7857.                candidate list, or if W does not yet appear on the
  7858.                candidate list, then set the entry for W on the
  7859.                candidate list to indicate a distance of D from the
  7860.                root.  Also calculate the list of next hops that
  7861.                result from using the advertised link, setting the
  7862.                next hop values for W accordingly.  The next hop
  7863.                calculation is described in Section 16.1.1; it takes
  7864.                as input the destination (W) and its parent (V).
  7865.  
  7866.    (3) If at this step the candidate list is empty, the shortest-
  7867.        path tree (of transit vertices) has been completely built
  7868.        and this stage of the procedure terminates.  Otherwise,
  7869.        choose the vertex belonging to the candidate list that is
  7870.        closest to the root, and add it to the shortest-path tree
  7871.        (removing it from the candidate list in the process). Note
  7872.        that when there is a choice of vertices closest to the root,
  7873.        network vertices must be chosen before router vertices in
  7874.        order to necessarily find all equal-cost paths. This is
  7875.        consistent with the tie-breakers that were introduced in the
  7876.        modified Dijkstra algorithm used by OSPF's Multicast routing
  7877.        extensions (MOSPF).
  7878.  
  7879.    (4) Possibly modify the routing table.  For those routing table
  7880.        entries modified, the associated area will be set to Area A,
  7881.        the path type will be set to intra-area, and the cost will
  7882.        be set to the newly discovered shortest path's calculated
  7883.        distance.
  7884.  
  7885.        If the newly added vertex is an area border router or AS
  7886.        boundary router, a routing table entry is added whose
  7887.        destination type is "router".  The Options field found in
  7888.        the associated router-LSA is copied into the routing table
  7889.        entry's Optional capabilities field. Call the newly added
  7890.        vertex Router X.  If Router X is the endpoint of one of the
  7891.        calculating router's virtual links, and the virtual link
  7892.        uses Area A as Transit area:  the virtual link is declared
  7893.        up, the IP address of the virtual interface is set to the IP
  7894.        address of the outgoing interface calculated above for
  7895.  
  7896.  
  7897.  
  7898. Moy                         Standards Track                   [Page 141]
  7899.  
  7900. RFC 2178                     OSPF Version 2                    July 1997
  7901.  
  7902.  
  7903.        Router X, and the virtual neighbor's IP address is set to
  7904.        Router X's interface address (contained in Router X's
  7905.        router-LSA) that points back to the root of the shortest-
  7906.        path tree; equivalently, this is the interface that points
  7907.        back to Router X's parent vertex on the shortest-path tree
  7908.        (similar to the calculation in Section 16.1.1).
  7909.  
  7910.        If the newly added vertex is a transit network, the routing
  7911.        table entry for the network is located.  The entry's
  7912.        Destination ID is the IP network number, which can be
  7913.        obtained by masking the Vertex ID (Link State ID) with its
  7914.        associated subnet mask (found in the body of the associated
  7915.        network-LSA).  If the routing table entry already exists
  7916.        (i.e., there is already an intra-area route to the
  7917.        destination installed in the routing table), multiple
  7918.        vertices have mapped to the same IP network.  For example,
  7919.        this can occur when a new Designated Router is being
  7920.        established.  In this case, the current routing table entry
  7921.        should be overwritten if and only if the newly found path is
  7922.        just as short and the current routing table entry's Link
  7923.        State Origin has a smaller Link State ID than the newly
  7924.        added vertex' LSA.
  7925.  
  7926.        If there is no routing table entry for the network (the
  7927.        usual case), a routing table entry for the IP network should
  7928.        be added.  The routing table entry's Link State Origin
  7929.        should be set to the newly added vertex' LSA.
  7930.  
  7931.    (5) Iterate the algorithm by returning to Step 2.
  7932.  
  7933.    The stub networks are added to the tree in the procedure's second
  7934.    stage.  In this stage, all router vertices are again examined.  Those
  7935.    that have been determined to be unreachable in the above first phase
  7936.    are discarded.  For each reachable router vertex (call it V), the
  7937.    associated router-LSA is found in the link state database.  Each stub
  7938.    network link appearing in the LSA is then examined, and the following
  7939.    steps are executed:
  7940.  
  7941.  
  7942.    (1) Calculate the distance D of stub network from the root.  D
  7943.        is equal to the distance from the root to the router vertex
  7944.        (calculated in stage 1), plus the stub network link's
  7945.        advertised cost.  Compare this distance to the current best
  7946.        cost to the stub network.  This is done by looking up the
  7947.        stub network's current routing table entry.  If the
  7948.        calculated distance D is larger, go on to examine the next
  7949.        stub network link in the LSA.
  7950.  
  7951.  
  7952.  
  7953.  
  7954. Moy                         Standards Track                   [Page 142]
  7955.  
  7956. RFC 2178                     OSPF Version 2                    July 1997
  7957.  
  7958.  
  7959.    (2) If this step is reached, the stub network's routing table
  7960.        entry must be updated.  Calculate the set of next hops that
  7961.        would result from using the stub network link.  This
  7962.        calculation is shown in Section 16.1.1; input to this
  7963.        calculation is the destination (the stub network) and the
  7964.        parent vertex (the router vertex).  If the distance D is the
  7965.        same as the current routing table cost, simply add this set
  7966.        of next hops to the routing table entry's list of next hops.
  7967.        In this case, the routing table already has a Link State
  7968.        Origin.  If this Link State Origin is a router-LSA whose
  7969.        Link State ID is smaller than V's Router ID, reset the Link
  7970.        State Origin to V's router-LSA.
  7971.  
  7972.        Otherwise D is smaller than the routing table cost.
  7973.        Overwrite the current routing table entry by setting the
  7974.        routing table entry's cost to D, and by setting the entry's
  7975.        list of next hops to the newly calculated set.  Set the
  7976.        routing table entry's Link State Origin to V's router-LSA.
  7977.        Then go on to examine the next stub network link.
  7978.  
  7979.    For all routing table entries added/modified in the second stage, the
  7980.    associated area will be set to Area A and the path type will be set to
  7981.    intra-area.  When the list of reachable router-LSAs is exhausted, the
  7982.    second stage is completed.  At this time, all intra-area routes
  7983.    associated with Area A have been determined.
  7984.  
  7985.    The specification does not require that the above two stage method be
  7986.    used to calculate the shortest path tree.  However, if another
  7987.    algorithm is used, an identical tree must be produced.  For this
  7988.    reason, it is important to note that links between transit vertices
  7989.    must be bidirectional in order to be included in the above tree.  It
  7990.    should also be mentioned that more efficient algorithms exist for
  7991.    calculating the tree; for example, the incremental SPF algorithm
  7992.    described in [Ref1].
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.  
  8000.  
  8001.  
  8002.  
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.  
  8009.  
  8010. Moy                         Standards Track                   [Page 143]
  8011.  
  8012. RFC 2178                     OSPF Version 2                    July 1997
  8013.  
  8014.  
  8015. 16.1.1.  The next hop calculation
  8016.  
  8017.    This section explains how to calculate the current set of next hops
  8018.    to use for a destination.  Each next hop consists of the outgoing
  8019.    interface to use in forwarding packets to the destination together
  8020.    with the IP address of the next hop router (if any).  The next hop
  8021.    calculation is invoked each time a shorter path to the destination is
  8022.    discovered.  This can happen in either stage of the shortest-path
  8023.    tree calculation (see Section 16.1).  In stage 1 of the shortest-path
  8024.    tree calculation a shorter path is found as the destination is added
  8025.    to the candidate list, or when the destination's entry on the
  8026.    candidate list is modified (Step 2d of Stage 1).  In stage 2 a
  8027.    shorter path is discovered each time the destination's routing table
  8028.    entry is modified (Step 2 of Stage 2).
  8029.  
  8030.    The set of next hops to use for the destination may be recalculated
  8031.    several times during the shortest-path tree calculation, as shorter
  8032.    and shorter paths are discovered.  In the end, the destination's
  8033.    routing table entry will always reflect the next hops resulting from
  8034.    the absolute shortest path(s).
  8035.  
  8036.    Input to the next hop calculation is a) the destination and b) its
  8037.    parent in the current shortest path between the root (the calculating
  8038.    router) and the destination.  The parent is always a transit vertex
  8039.    (i.e., always a router or a transit network).
  8040.  
  8041.    If there is at least one intervening router in the current shortest
  8042.    path between the destination and the root, the destination simply
  8043.    inherits the set of next hops from the parent.  Otherwise, there are
  8044.    two cases.  In the first case, the parent vertex is the root (the
  8045.    calculating router itself).  This means that the destination is
  8046.    either a directly connected network or directly connected router.
  8047.    The outgoing interface in this case is simply the OSPF interface
  8048.    connecting to the destination network/router. If the destination is a
  8049.    router which connects to the calculating router via a Point-to-
  8050.    MultiPoint network, the destination's next hop IP address(es) can be
  8051.    determined by examining the destination's router-LSA: each link
  8052.    pointing back to the calculating router and having a Link Data field
  8053.    belonging to the Point-to-MultiPoint network provides an IP address
  8054.    of the next hop router. If the destination is a directly connected
  8055.    network, or a router which connects to the calculating router via a
  8056.    point-to-point interface, no next hop IP address is required. If the
  8057.    destination is a router connected to the calculating router via a
  8058.    virtual link, the setting of the next hop should be deferred until
  8059.    the calculation in Section 16.3.
  8060.  
  8061.  
  8062.  
  8063.  
  8064.  
  8065.  
  8066. Moy                         Standards Track                   [Page 144]
  8067.  
  8068. RFC 2178                     OSPF Version 2                    July 1997
  8069.  
  8070.  
  8071.    In the second case, the parent vertex is a network that directly
  8072.    connects the calculating router to the destination router.  The list
  8073.    of next hops is then determined by examining the destination's
  8074.    router-LSA.  For each link in the router-LSA that points back to the
  8075.    parent network, the link's Link Data field provides the IP address of
  8076.    a next hop router.  The outgoing interface to use can then be derived
  8077.    from the next hop IP address (or it can be inherited from the parent
  8078.    network).
  8079.  
  8080. 16.2.  Calculating the inter-area routes
  8081.  
  8082.    The inter-area routes are calculated by examining summary-LSAs.  If
  8083.    the router has active attachments to multiple areas, only backbone
  8084.    summary-LSAs are examined.  Routers attached to a single area examine
  8085.    that area's summary-LSAs.  In either case, the summary-LSAs examined
  8086.    below are all part of a single area's link state database (call it
  8087.    Area A).
  8088.  
  8089.    Summary-LSAs are originated by the area border routers.  Each
  8090.    summary-LSA in Area A is considered in turn.  Remember that the
  8091.    destination described by a summary-LSA is either a network (Type 3
  8092.    summary-LSAs) or an AS boundary router (Type 4 summary-LSAs).  For
  8093.    each summary-LSA:
  8094.  
  8095.  
  8096.    (1) If the cost specified by the LSA is LSInfinity, or if the
  8097.        LSA's LS age is equal to MaxAge, then examine the the next
  8098.        LSA.
  8099.  
  8100.    (2) If the LSA was originated by the calculating router itself,
  8101.        examine the next LSA.
  8102.  
  8103.    (3) If it is a Type 3 summary-LSA, and the collection of
  8104.        destinations described by the summary-LSA equals one of the
  8105.        router's configured area address ranges (see Section 3.5),
  8106.        and the particular area address range is active, then the
  8107.        summary-LSA should be ignored.  "Active" means that there
  8108.        are one or more reachable (by intra-area paths) networks
  8109.        contained in the area range.
  8110.  
  8111.    (4) Else, call the destination described by the LSA N (for Type
  8112.        3 summary-LSAs, N's address is obtained by masking the LSA's
  8113.        Link State ID with the network/subnet mask contained in the
  8114.        body of the LSA), and the area border originating the LSA
  8115.        BR.  Look up the routing table entry for BR having Area A as
  8116.        its associated area.  If no such entry exists for router BR
  8117.        (i.e., BR is unreachable in Area A), do nothing with this
  8118.        LSA and consider the next in the list.  Else, this LSA
  8119.  
  8120.  
  8121.  
  8122. Moy                         Standards Track                   [Page 145]
  8123.  
  8124. RFC 2178                     OSPF Version 2                    July 1997
  8125.  
  8126.  
  8127.        describes an inter-area path to destination N, whose cost is
  8128.        the distance to BR plus the cost specified in the LSA. Call
  8129.        the cost of this inter-area path IAC.
  8130.  
  8131.    (5) Next, look up the routing table entry for the destination N.
  8132.        (If N is an AS boundary router, look up the "router" routing
  8133.        table entry associated with Area A).  If no entry exists for
  8134.        N or if the entry's path type is "type 1 external" or "type
  8135.        2 external", then install the inter-area path to N, with
  8136.        associated area Area A, cost IAC, next hop equal to the list
  8137.        of next hops to router BR, and Advertising router equal to
  8138.        BR.
  8139.  
  8140.    (6) Else, if the paths present in the table are intra-area
  8141.        paths, do nothing with the LSA (intra-area paths are always
  8142.        preferred).
  8143.  
  8144.    (7) Else, the paths present in the routing table are also
  8145.        inter-area paths.  Install the new path through BR if it is
  8146.        cheaper, overriding the paths in the routing table.
  8147.        Otherwise, if the new path is the same cost, add it to the
  8148.        list of paths that appear in the routing table entry.
  8149.  
  8150. 16.3.  Examining transit areas' summary-LSAs
  8151.  
  8152.    This step is only performed by area border routers attached to one or
  8153.    more non-backbone areas that are capable of carrying transit traffic
  8154.    (i.e., "transit areas", or those areas whose TransitCapability
  8155.    parameter has been set to TRUE in Step 2 of the Dijkstra algorithm
  8156.    (see Section 16.1).
  8157.  
  8158.    The purpose of the calculation below is to examine the transit areas
  8159.    to see whether they provide any better (shorter) paths than the paths
  8160.    previously calculated in Sections 16.1 and 16.2.  Any paths found
  8161.    that are better than or equal to previously discovered paths are
  8162.    installed in the routing table.
  8163.  
  8164.    The calculation proceeds as follows. All the transit areas' summary-
  8165.    LSAs are examined in turn.  Each such summary-LSA describes a route
  8166.    through a transit area Area A to a Network N (N's address is obtained
  8167.    by masking the LSA's Link State ID with the network/subnet mask
  8168.    contained in the body of the LSA) or in the case of a Type 4
  8169.    summary-LSA, to an AS boundary router N.  Suppose also that the
  8170.    summary-LSA was originated by an area border router BR.
  8171.  
  8172.    (1) If the cost advertised by the summary-LSA is LSInfinity, or
  8173.        if the LSA's LS age is equal to MaxAge, then examine the
  8174.        next LSA.
  8175.  
  8176.  
  8177.  
  8178. Moy                         Standards Track                   [Page 146]
  8179.  
  8180. RFC 2178                     OSPF Version 2                    July 1997
  8181.  
  8182.  
  8183.    (2) If the summary-LSA was originated by the calculating router
  8184.        itself, examine the next LSA.
  8185.  
  8186.    (3) Look up the routing table entry for N. (If N is an AS
  8187.        boundary router, look up the "router" routing table entry
  8188.        associated with the backbone area). If it does not exist, or
  8189.        if the route type is other than intra-area or inter-area, or
  8190.        if the area associated with the routing table entry is not
  8191.        the backbone area, then examine the next LSA. In other
  8192.        words, this calculation only updates backbone intra-area
  8193.        routes found in Section 16.1 and inter-area routes found in
  8194.        Section 16.2.
  8195.  
  8196.    (4) Look up the routing table entry for the advertising router
  8197.        BR associated with the Area A. If it is unreachable, examine
  8198.        the next LSA. Otherwise, the cost to destination N is the
  8199.        sum of the cost in BR's Area A routing table entry and the
  8200.        cost advertised in the LSA. Call this cost IAC.
  8201.  
  8202.    (5) If this cost is less than the cost occurring in N's routing
  8203.        table entry, overwrite N's list of next hops with those used
  8204.        for BR, and set N's routing table cost to IAC. Else, if IAC
  8205.        is the same as N's current cost, add BR's list of next hops
  8206.        to N's list of next hops. In any case, the area associated
  8207.        with N's routing table entry must remain the backbone area,
  8208.        and the path type (either intra-area or inter-area) must
  8209.        also remain the same.
  8210.  
  8211.  
  8212.  
  8213.  
  8214.  
  8215.  
  8216.  
  8217.  
  8218.  
  8219.  
  8220.  
  8221.  
  8222.  
  8223.  
  8224.  
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234. Moy                         Standards Track                   [Page 147]
  8235.  
  8236. RFC 2178                     OSPF Version 2                    July 1997
  8237.  
  8238.  
  8239.                       . Area 1 (transit)     .            +
  8240.                       .                      .            |
  8241.                       .      +---+1        1+---+100      |
  8242.                       .      |RT2|----------|RT4|=========|
  8243.                       .    1/+---+********* +---+         |
  8244.                       .    /*******          .            |
  8245.                       .  1/*Virtual          .            |
  8246.                    1+---+/*  Link            .         Net|work
  8247.              =======|RT1|*                   .            | N1
  8248.                     +---+\                   .            |
  8249.                       .   \                  .            |
  8250.                       .    \                 .            |
  8251.                       .    1\+---+1        1+---+20       |
  8252.                       .      |RT3|----------|RT5|=========|
  8253.                       .      +---+          +---+         |
  8254.                       .                      .            |
  8255.                       ........................            +
  8256.  
  8257.  
  8258.                 Figure 17: Routing through transit areas
  8259.  
  8260.    It is important to note that the above calculation never makes
  8261.    unreachable destinations reachable, but instead just potentially
  8262.    finds better paths to already reachable destinations.  The
  8263.    calculation installs any better cost found into the routing table
  8264.    entry, from which it may be readvertised in summary-LSAs to other
  8265.    areas.
  8266.  
  8267.    As an example of the calculation, consider the Autonomous System
  8268.    pictured in Figure 17. There is a single non-backbone area (Area 1)
  8269.    that physically divides the backbone into two separate pieces. To
  8270.    maintain connectivity of the backbone, a virtual link has been
  8271.    configured between routers RT1 and RT4. On the right side of the
  8272.    figure, Network N1 belongs to the backbone. The dotted lines indicate
  8273.    that there is a much shorter intra-area backbone path between router
  8274.    RT5 and Network N1 (cost 20) than there is between Router RT4 and
  8275.    Network N1 (cost 100). Both Router RT4 and Router RT5 will inject
  8276.    summary-LSAs for Network N1 into Area 1.
  8277.  
  8278.    After the shortest-path tree has been calculated for the backbone in
  8279.    Section 16.1, Router RT1 (left end of the virtual link) will have
  8280.    calculated a path through Router RT4 for all data traffic destined
  8281.    for Network N1. However, since Router RT5 is so much closer to
  8282.    Network N1, all routers internal to Area 1 (e.g., Routers RT2 and
  8283.    RT3) will forward their Network N1 traffic towards Router RT5,
  8284.    instead of RT4. And indeed, after examining Area 1's summary-LSAs by
  8285.    the above calculation, Router RT1 will also forward Network N1
  8286.    traffic towards RT5. Note that in this example the virtual link
  8287.  
  8288.  
  8289.  
  8290. Moy                         Standards Track                   [Page 148]
  8291.  
  8292. RFC 2178                     OSPF Version 2                    July 1997
  8293.  
  8294.  
  8295.    enables transit data traffic to be forwarded through Area 1, but the
  8296.    actual path the transit data traffic takes does not follow the
  8297.    virtual link.  In other words, virtual links allow transit traffic to
  8298.    be forwarded through an area, but do not dictate the precise path
  8299.    that the traffic will take.
  8300.  
  8301. 16.4.  Calculating AS external routes
  8302.  
  8303.    AS external routes are calculated by examining AS-external-LSAs.
  8304.    Each of the AS-external-LSAs is considered in turn.  Most AS-
  8305.    external-LSAs describe routes to specific IP destinations.  An AS-
  8306.    external-LSA can also describe a default route for the Autonomous
  8307.    System (Destination ID = DefaultDestination, network/subnet mask =
  8308.    0x00000000).  For each AS-external-LSA:
  8309.  
  8310.    (1) If the cost specified by the LSA is LSInfinity, or if the
  8311.        LSA's LS age is equal to MaxAge, then examine the next LSA.
  8312.  
  8313.    (2) If the LSA was originated by the calculating router itself,
  8314.        examine the next LSA.
  8315.  
  8316.    (3) Call the destination described by the LSA N.  N's address is
  8317.        obtained by masking the LSA's Link State ID with the
  8318.        network/subnet mask contained in the body of the LSA.  Look
  8319.        up the routing table entries (potentially one per attached
  8320.        area) for the AS boundary router (ASBR) that originated the
  8321.        LSA. If no entries exist for router ASBR (i.e., ASBR is
  8322.        unreachable), do nothing with this LSA and consider the next
  8323.        in the list.
  8324.  
  8325.        Else, this LSA describes an AS external path to destination
  8326.        N.  Examine the forwarding address specified in the AS-
  8327.        external-LSA.  This indicates the IP address to which
  8328.        packets for the destination should be forwarded.
  8329.  
  8330.        If the forwarding address is set to 0.0.0.0, packets should
  8331.        be sent to the ASBR itself. Among the multiple routing table
  8332.        entries for the ASBR, select the preferred entry as follows.
  8333.        If RFC1583Compatibility is set to "disabled", prune the set
  8334.        of routing table entries for the ASBR as described in
  8335.        Section 16.4.1. In any case, among the remaining routing
  8336.        table entries, select the routing table entry with the least
  8337.        cost; when there are multiple least cost routing table
  8338.        entries the entry whose associated area has the largest OSPF
  8339.        Area ID (when considered as an unsigned 32-bit integer) is
  8340.        chosen.
  8341.  
  8342.  
  8343.  
  8344.  
  8345.  
  8346. Moy                         Standards Track                   [Page 149]
  8347.  
  8348. RFC 2178                     OSPF Version 2                    July 1997
  8349.  
  8350.  
  8351.        If the forwarding address is non-zero, look up the
  8352.        forwarding address in the routing table.[24] The matching
  8353.        routing table entry must specify an intra-area or inter-area
  8354.        path; if no such path exists, do nothing with the LSA and
  8355.        consider the next in the list.
  8356.  
  8357.    (4) Let X be the cost specified by the preferred routing table
  8358.        entry for the ASBR/forwarding address, and Y the cost
  8359.        specified in the LSA.  X is in terms of the link state
  8360.        metric, and Y is a type 1 or 2 external metric.
  8361.  
  8362.    (5) Look up the routing table entry for the destination N.  If
  8363.        no entry exists for N, install the AS external path to N,
  8364.        with next hop equal to the list of next hops to the
  8365.        forwarding address, and advertising router equal to ASBR.
  8366.        If the external metric type is 1, then the path-type is set
  8367.        to type 1 external and the cost is equal to X+Y.  If the
  8368.        external metric type is 2, the path-type is set to type 2
  8369.        external, the link state component of the route's cost is X,
  8370.        and the type 2 cost is Y.
  8371.  
  8372.    (6) Compare the AS external path described by the LSA with the
  8373.        existing paths in N's routing table entry, as follows. If
  8374.        the new path is preferred, it replaces the present paths in
  8375.        N's routing table entry.  If the new path is of equal
  8376.        preference, it is added to N's routing table entry's list of
  8377.        paths.
  8378.  
  8379.        (a) Intra-area and inter-area paths are always preferred
  8380.            over AS external paths.
  8381.  
  8382.        (b) Type 1 external paths are always preferred over type 2
  8383.            external paths. When all paths are type 2 external
  8384.            paths, the paths with the smallest advertised type 2
  8385.            metric are always preferred.
  8386.  
  8387.        (c) If the new AS external path is still indistinguishable
  8388.            from the current paths in the N's routing table entry,
  8389.            and RFC1583Compatibility is set to "disabled", select
  8390.            the preferred paths based on the intra-AS paths to the
  8391.            ASBR/forwarding addresses, as specified in Section
  8392.            16.4.1.
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.  
  8400.  
  8401.  
  8402. Moy                         Standards Track                   [Page 150]
  8403.  
  8404. RFC 2178                     OSPF Version 2                    July 1997
  8405.  
  8406.  
  8407.        (d) If the new AS external path is still indistinguishable
  8408.            from the current paths in the N's routing table entry,
  8409.            select the preferred path based on a least cost
  8410.            comparison.  Type 1 external paths are compared by
  8411.            looking at the sum of the distance to the forwarding
  8412.            address and the advertised type 1 metric (X+Y).  Type 2
  8413.            external paths advertising equal type 2 metrics are
  8414.            compared by looking at the distance to the forwarding
  8415.            addresses.
  8416.  
  8417. 16.4.1.  External path preferences
  8418.  
  8419.    When multiple intra-AS paths are available to ASBRs/forwarding
  8420.    addresses, the following rules indicate which paths are preferred.
  8421.    These rules apply when the same ASBR is reachable through multiple
  8422.    areas, or when trying to decide which of several AS-external-LSAs
  8423.    should be preferred. In the former case the paths all terminate at
  8424.    the same ASBR, while in the latter the paths terminate at separate
  8425.    ASBRs/forwarding addresses. In either case, each path is represented
  8426.    by a separate routing table entry as defined in Section 11.
  8427.  
  8428.    This section only applies when RFC1583Compatibility is set to
  8429.    "disabled".
  8430.  
  8431.    The path preference rules, stated from highest to lowest preference,
  8432.    are as follows. Note that as a result of these rules, there may still
  8433.    be multiple paths of the highest preference. In this case, the path
  8434.    to use must be determined based on cost, as described in Section
  8435.    16.4.
  8436.  
  8437.     o   Intra-area paths using non-backbone areas are always the
  8438.         most preferred.
  8439.  
  8440.     o   Otherwise, intra-area backbone paths are preferred.
  8441.  
  8442.     o   Inter-area paths are the least preferred.
  8443.  
  8444. 16.5.  Incremental updates -- summary-LSAs
  8445.  
  8446.    When a new summary-LSA is received, it is not necessary to
  8447.    recalculate the entire routing table.  Call the destination described
  8448.    by the summary-LSA N (N's address is obtained by masking the LSA's
  8449.    Link State ID with the network/subnet mask contained in the body of
  8450.    the LSA), and let Area A be the area to which the LSA belongs. There
  8451.    are then two separate cases:
  8452.  
  8453.  
  8454.  
  8455.  
  8456.  
  8457.  
  8458. Moy                         Standards Track                   [Page 151]
  8459.  
  8460. RFC 2178                     OSPF Version 2                    July 1997
  8461.  
  8462.  
  8463.    Case 1: Area A is the backbone and/or the router is not an area
  8464.    border router.
  8465.       In this case, the following calculations must be performed.
  8466.       First, if there is presently an inter-area route to the
  8467.       destination N, N's routing table entry is invalidated, saving the
  8468.       entry's values for later comparisons. Then the calculation in
  8469.       Section 16.2 is run again for the single destination N. In this
  8470.       calculation, all of Area A's summary-LSAs that describe a route to
  8471.       N are examined.  In addition, if the router is an area border
  8472.       router attached to one or more transit areas, the calculation in
  8473.       Section 16.3 must be run again for the single destination.  If the
  8474.       results of these calculations have changed the cost/path to an AS
  8475.       boundary router (as would be the case for a Type 4 summary-LSA) or
  8476.       to any forwarding addresses, all AS- external-LSAs will have to be
  8477.       reexamined by rerunning the calculation in Section 16.4.
  8478.       Otherwise, if N is now newly unreachable, the calculation in
  8479.       Section 16.4 must be rerun for the single destination N, in case
  8480.       an alternate external route to N exists.
  8481.  
  8482.    Case 2: Area A is a transit area and the router is an area border
  8483.    router.
  8484.       In this case, the following calculations must be performed.
  8485.       First, if N's routing table entry presently contains one or more
  8486.       inter-area paths that utilize the transit area Area A, these paths
  8487.       should be removed. If this removes all paths from the routing
  8488.       table entry, the entry should be invalidated.  The entry's old
  8489.       values should be saved for later comparisons. Next the calculation
  8490.       in Section 16.3 must be run again for the single destination N. If
  8491.       the results of this calculation have caused the cost to N to
  8492.       increase, the complete routing table calculation must be rerun
  8493.       starting with the Dijkstra algorithm specified in Section 16.1.
  8494.       Otherwise, if the cost/path to an AS boundary router (as would be
  8495.       the case for a Type 4 summary-LSA) or to any forwarding addresses
  8496.       has changed, all AS-external-LSAs will have to be reexamined by
  8497.       rerunning the calculation in Section 16.4.  Otherwise, if N is now
  8498.       newly unreachable, the calculation in Section 16.4 must be rerun
  8499.       for the single destination N, in case an alternate external route
  8500.       to N exists.
  8501.  
  8502. 16.6.  Incremental updates -- AS-external-LSAs
  8503.  
  8504.    When a new AS-external-LSA is received, it is not necessary to
  8505.    recalculate the entire routing table.  Call the destination described
  8506.    by the AS-external-LSA N.  N's address is obtained by masking the
  8507.    LSA's Link State ID with the network/subnet mask contained in the
  8508.    body of the LSA. If there is already an intra- area or inter-area
  8509.    route to the destination, no recalculation is necessary (internal
  8510.    routes take precedence).
  8511.  
  8512.  
  8513.  
  8514. Moy                         Standards Track                   [Page 152]
  8515.  
  8516. RFC 2178                     OSPF Version 2                    July 1997
  8517.  
  8518.  
  8519.    Otherwise, the procedure in Section 16.4 will have to be performed,
  8520.    but only for those AS-external-LSAs whose destination is N.  Before
  8521.    this procedure is performed, the present routing table entry for N
  8522.    should be invalidated.
  8523.  
  8524. 16.7.  Events generated as a result of routing table changes
  8525.  
  8526.    Changes to routing table entries sometimes cause the OSPF area border
  8527.    routers to take additional actions.  These routers need to act on the
  8528.    following routing table changes:
  8529.  
  8530.    o   The cost or path type of a routing table entry has changed.
  8531.       If the destination described by this entry is a Network or AS
  8532.       boundary router, and this is not simply a change of AS external
  8533.       routes, new summary-LSAs may have to be generated (potentially one
  8534.       for each attached area, including the backbone). See Section
  8535.       12.4.3 for more information.  If a previously advertised entry has
  8536.       been deleted, or is no longer advertisable to a particular area,
  8537.       the LSA must be flushed from the routing domain by setting its LS
  8538.       age to MaxAge and reflooding (see Section 14.1).
  8539.  
  8540.    o   A routing table entry associated with a configured virtual
  8541.       link has changed.  The destination of such a routing table entry
  8542.       is an area border router.  The change indicates a modification to
  8543.       the virtual link's cost or viability.
  8544.  
  8545.       If the entry indicates that the area border router is newly
  8546.       reachable, the corresponding virtual link is now operational.  An
  8547.       InterfaceUp event should be generated for the virtual link, which
  8548.       will cause a virtual adjacency to begin to form (see Section
  8549.       10.3).  At this time the virtual link's IP interface address and
  8550.       the virtual neighbor's Neighbor IP address are also calculated.
  8551.  
  8552.       If the entry indicates that the area border router is no longer
  8553.       reachable, the virtual link and its associated adjacency should be
  8554.       destroyed.  This means an InterfaceDown event should be generated
  8555.       for the associated virtual link.
  8556.  
  8557.       If the cost of the entry has changed, and there is a fully
  8558.       established virtual adjacency, a new router-LSA for the backbone
  8559.       must be originated.  This in turn may cause further routing table
  8560.       changes.
  8561.  
  8562.  
  8563.  
  8564.  
  8565.  
  8566.  
  8567.  
  8568.  
  8569.  
  8570. Moy                         Standards Track                   [Page 153]
  8571.  
  8572. RFC 2178                     OSPF Version 2                    July 1997
  8573.  
  8574.  
  8575. 16.8.  Equal-cost multipath
  8576.  
  8577.    The OSPF protocol maintains multiple equal-cost routes to all
  8578.    destinations.  This can be seen in the steps used above to calculate
  8579.    the routing table, and in the definition of the routing table
  8580.    structure.
  8581.  
  8582.    Each one of the multiple routes will be of the same type (intra-area,
  8583.    inter-area, type 1 external or type 2 external), cost, and will have
  8584.    the same associated area.  However, each route specifies a separate
  8585.    next hop and Advertising router.
  8586.  
  8587.    There is no requirement that a router running OSPF keep track of all
  8588.    possible equal-cost routes to a destination.  An implementation may
  8589.    choose to keep only a fixed number of routes to any given
  8590.    destination.  This does not affect any of the algorithms presented in
  8591.    this specification.
  8592.  
  8593.  
  8594.  
  8595.  
  8596.  
  8597.  
  8598.  
  8599.  
  8600.  
  8601.  
  8602.  
  8603.  
  8604.  
  8605.  
  8606.  
  8607.  
  8608.  
  8609.  
  8610.  
  8611.  
  8612.  
  8613.  
  8614.  
  8615.  
  8616.  
  8617.  
  8618.  
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626. Moy                         Standards Track                   [Page 154]
  8627.  
  8628. RFC 2178                     OSPF Version 2                    July 1997
  8629.  
  8630.  
  8631. Footnotes
  8632.  
  8633.    [1]The graph's vertices represent either routers, transit networks,
  8634.    or stub networks.  Since routers may belong to multiple areas, it is
  8635.    not possible to color the graph's vertices.
  8636.  
  8637.    [2]It is possible for all of a router's interfaces to be unnumbered
  8638.    point-to-point links.  In this case, an IP address must be assigned
  8639.    to the router.  This address will then be advertised in the router's
  8640.    router-LSA as a host route.
  8641.  
  8642.    [3]Note that in these cases both interfaces, the non-virtual and the
  8643.    virtual, would have the same IP address.
  8644.  
  8645.    [4]Note that no host route is generated for, and no IP packets can be
  8646.    addressed to, interfaces to unnumbered point-to-point networks.  This
  8647.    is regardless of such an interface's state.
  8648.  
  8649.    [5]It is instructive to see what happens when the Designated Router
  8650.    for the network crashes.  Call the Designated Router for the network
  8651.    RT1, and the Backup Designated Router RT2. If Router RT1 crashes (or
  8652.    maybe its interface to the network dies), the other routers on the
  8653.    network will detect RT1's absence within RouterDeadInterval seconds.
  8654.    All routers may not detect this at precisely the same time; the
  8655.    routers that detect RT1's absence before RT2 does will, for a time,
  8656.    select RT2 to be both Designated Router and Backup Designated Router.
  8657.    When RT2 detects that RT1 is gone it will move itself to Designated
  8658.    Router.  At this time, the remaining router having highest Router
  8659.    Priority will be selected as Backup Designated Router.
  8660.  
  8661.    [6]On point-to-point networks, the lower level protocols indicate
  8662.    whether the neighbor is up and running.  Likewise, existence of the
  8663.    neighbor on virtual links is indicated by the routing table
  8664.    calculation.  However, in both these cases, the Hello Protocol is
  8665.    still used.  This ensures that communication between the neighbors is
  8666.    bidirectional, and that each of the neighbors has a functioning
  8667.    routing protocol layer.
  8668.  
  8669.    [7]When the identity of the Designated Router is changing, it may be
  8670.    quite common for a neighbor in this state to send the router a
  8671.    Database Description packet; this means that there is some momentary
  8672.    disagreement on the Designated Router's identity.
  8673.  
  8674.    [8]Note that it is possible for a router to resynchronize any of its
  8675.    fully established adjacencies by setting the adjacency's state back
  8676.    to ExStart.  This will cause the other end of the adjacency to
  8677.    process a SeqNumberMismatch event, and therefore to also go back to
  8678.    ExStart state.
  8679.  
  8680.  
  8681.  
  8682. Moy                         Standards Track                   [Page 155]
  8683.  
  8684. RFC 2178                     OSPF Version 2                    July 1997
  8685.  
  8686.  
  8687.    [9]The address space of IP networks and the address space of OSPF
  8688.    Router IDs may overlap.  That is, a network may have an IP address
  8689.    which is identical (when considered as a 32-bit number) to some
  8690.    router's Router ID.
  8691.  
  8692.    [10]"Discard" entries are necessary to ensure that route
  8693.    summarization at area boundaries will not cause packet looping.
  8694.  
  8695.    [11]It is assumed that, for two different address ranges matching the
  8696.    destination, one range is more specific than the other. Non-
  8697.    contiguous subnet masks can be configured to violate this assumption.
  8698.    Such subnet mask configurations cannot be handled by the OSPF
  8699.    protocol.
  8700.  
  8701.    [12]MaxAgeDiff is an architectural constant.  It indicates the
  8702.    maximum dispersion of ages, in seconds, that can occur for a single
  8703.    LSA instance as it is flooded throughout the routing domain.  If two
  8704.    LSAs differ by more than this, they are assumed to be different
  8705.    instances of the same LSA. This can occur when a router restarts and
  8706.    loses track of the LSA's previous LS sequence number.  See Section
  8707.    13.4 for more details.
  8708.  
  8709.    [13]When two LSAs have different LS checksums, they are assumed to be
  8710.    separate instances.  This can occur when a router restarts, and loses
  8711.    track of the LSA's previous LS sequence number.  In the case where
  8712.    the two LSAs have the same LS sequence number, it is not possible to
  8713.    determine which LSA is actually newer. However, if the wrong LSA is
  8714.    accepted as newer, the originating router will simply originate
  8715.    another instance.  See Section 13.4 for further details.
  8716.  
  8717.    [14]There is one instance where a lookup must be done based on
  8718.    partial information.  This is during the routing table calculation,
  8719.    when a network-LSA must be found based solely on its Link State ID.
  8720.    The lookup in this case is still well defined, since no two network-
  8721.    LSAs can have the same Link State ID.
  8722.  
  8723.    [15]This is the way RFC 1583 specified point-to-point representation.
  8724.    It has three advantages: a) it does not require allocating a subnet
  8725.    to the point-to-point link, b) it tends to bias the routing so that
  8726.    packets destined for the point-to-point interface will actually be
  8727.    received over the interface (which is useful for diagnostic purposes)
  8728.    and c) it allows network bootstrapping of a neighbor, without
  8729.    requiring that the bootstrap program contain an OSPF implementation.
  8730.  
  8731.    [16]This is the more traditional point-to-point representation used
  8732.    by protocols such as RIP.
  8733.  
  8734.  
  8735.  
  8736.  
  8737.  
  8738. Moy                         Standards Track                   [Page 156]
  8739.  
  8740. RFC 2178                     OSPF Version 2                    July 1997
  8741.  
  8742.  
  8743.    [17]This clause covers the case: Inter-area routes are not summarized
  8744.    to the backbone.  This is because inter-area routes are always
  8745.    associated with the backbone area.
  8746.  
  8747.    [18]This clause is only invoked when a non-backbone Area A supports
  8748.    transit data traffic (i.e., has TransitCapability set to TRUE).  For
  8749.    example, in the area configuration of Figure 6, Area 2 can support
  8750.    transit traffic due to the configured virtual link between Routers
  8751.    RT10 and RT11. As a result, Router RT11 need only originate a single
  8752.    summary-LSA into Area 2 (having the collapsed destination N9-N11,H1),
  8753.    since all of Router RT11's other eligible routes have next hops
  8754.    belonging to Area 2 itself (and as such only need be advertised by
  8755.    other area border routers; in this case, Routers RT10 and RT7).
  8756.  
  8757.    [19]By keeping more information in the routing table, it is possible
  8758.    for an implementation to recalculate the shortest path tree for only
  8759.    a single area.  In fact, there are incremental algorithms that allow
  8760.    an implementation to recalculate only a portion of a single area's
  8761.    shortest path tree [Ref1]. However, these algorithms are beyond the
  8762.    scope of this specification.
  8763.  
  8764.    [20]This is how the Link state request list is emptied, which
  8765.    eventually causes the neighbor state to transition to Full.  See
  8766.    Section 10.9 for more details.
  8767.  
  8768.    [21]It should be a relatively rare occurrence for an LSA's LS age to
  8769.    reach MaxAge in this fashion.  Usually, the LSA will be replaced by a
  8770.    more recent instance before it ages out.
  8771.  
  8772.    [22]Strictly speaking, because of equal-cost multipath, the algorithm
  8773.    does not create a tree.  We continue to use the "tree" terminology
  8774.    because that is what occurs most often in the existing literature.
  8775.  
  8776.    [23]Note that the presence of any link back to V is sufficient; it
  8777.    need not be the matching half of the link under consideration from V
  8778.    to W. This is enough to ensure that, before data traffic flows
  8779.    between a pair of neighboring routers, their link state databases
  8780.    will be synchronized.
  8781.  
  8782.    [24]When the forwarding address is non-zero, it should point to a
  8783.    router belonging to another Autonomous System.  See Section 12.4.4
  8784.    for more details.
  8785.  
  8786.  
  8787.  
  8788.  
  8789.  
  8790.  
  8791.  
  8792.  
  8793.  
  8794. Moy                         Standards Track                   [Page 157]
  8795.  
  8796. RFC 2178                     OSPF Version 2                    July 1997
  8797.  
  8798.  
  8799. References
  8800.  
  8801.    [Ref1]  McQuillan, J., I. Richer and E. Rosen, "ARPANET Routing
  8802.            Algorithm Improvements", BBN Technical Report 3803, April
  8803.            1978.
  8804.  
  8805.    [Ref2]  Digital Equipment Corporation, "Information processing
  8806.            systems -- Data communications -- Intermediate System to
  8807.            Intermediate System Intra-Domain Routing Protocol", October
  8808.            1987.
  8809.  
  8810.    [Ref3]  McQuillan, J. et.al., "The New Routing Algorithm for the
  8811.            ARPANET", IEEE Transactions on Communications, May 1980.
  8812.  
  8813.    [Ref4]  Perlman, R., "Fault-Tolerant Broadcast of Routing
  8814.            Information", Computer Networks, December 1983.
  8815.  
  8816.    [Ref5]  Postel, J., "Internet Protocol", STD 5, RFC 791,
  8817.            USC/Information Sciences Institute, September 1981.
  8818.  
  8819.    [Ref6]  McKenzie, A., "ISO Transport Protocol specification ISO DP
  8820.            8073", RFC 905, ISO, April 1984.
  8821.  
  8822.    [Ref7]  Deering, S., "Host extensions for IP multicasting", STD 5,
  8823.            RFC 1112, Stanford University, May 1988.
  8824.  
  8825.    [Ref8]  McCloghrie, K., and M. Rose, "Management Information Base
  8826.            for network management of TCP/IP-based internets: MIB-II",
  8827.            STD 17, RFC 1213, Hughes LAN Systems, Performance Systems
  8828.            International, March 1991.
  8829.  
  8830.    [Ref9]  Moy, J., "OSPF Version 2", RFC 1583, Proteon, Inc., March
  8831.            1994.
  8832.  
  8833.    [Ref10] Fuller, V., T. Li, J. Yu, and K. Varadhan, "Classless
  8834.            Inter-Domain Routing (CIDR): an Address Assignment and
  8835.            Aggregation Strategy", RFC1519, BARRNet, cisco, MERIT,
  8836.            OARnet, September 1993.
  8837.  
  8838.    [Ref11] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC
  8839.            1700, USC/Information Sciences Institute, October 1994.
  8840.  
  8841.    [Ref12] Almquist, P., "Type of Service in the Internet Protocol
  8842.            Suite", RFC 1349, July 1992.
  8843.  
  8844.    [Ref13] Leiner, B., et.al., "The DARPA Internet Protocol Suite", DDN
  8845.            Protocol Handbook, April 1985.
  8846.  
  8847.  
  8848.  
  8849.  
  8850. Moy                         Standards Track                   [Page 158]
  8851.  
  8852. RFC 2178                     OSPF Version 2                    July 1997
  8853.  
  8854.  
  8855.    [Ref14] Bradley, T., and C. Brown, "Inverse Address Resolution
  8856.            Protocol", RFC 1293, January 1992.
  8857.  
  8858.    [Ref15] deSouza, O., and M. Rodrigues, "Guidelines for Running OSPF
  8859.            Over Frame Relay Networks", RFC 1586, March 1994.
  8860.  
  8861.    [Ref16] Bellovin, S., "Security Problems in the TCP/IP Protocol
  8862.            Suite", ACM Computer Communications Review, Volume 19,
  8863.            Number 2, pp. 32-38, April 1989.
  8864.  
  8865.    [Ref17] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
  8866.            April 1992.
  8867.  
  8868.    [Ref18] Moy, J., "Multicast Extensions to OSPF", RFC 1584, Proteon,
  8869.            Inc., March 1994.
  8870.  
  8871.    [Ref19] Coltun, R. and V. Fuller, "The OSPF NSSA Option", RFC 1587,
  8872.            RainbowBridge Communications, Stanford University, March
  8873.            1994.
  8874.  
  8875.    [Ref20] Ferguson, D., "The OSPF External Attributes LSA", work in
  8876.            progress.
  8877.  
  8878.    [Ref21] Moy, J., "Extending OSPF to Support Demand Circuits", RFC
  8879.            1793, Cascade, April 1995.
  8880.  
  8881.    [Ref22] Mogul, J. and S. Deering, "Path MTU Discovery", RFC 1191,
  8882.            DECWRL, Stanford University, November 1990.
  8883.  
  8884.    [Ref23] Rekhter, Y. and T. Li, "A Border Gateway Protocol 4 (BGP-
  8885.            4)", RFC 1771, T.J. Watson Research Center, IBM Corp., cisco
  8886.            Systems, March 1995.
  8887.  
  8888.    [Ref24] Hinden, R., "Internet Routing Protocol Standardization
  8889.            Criteria", BBN, October 1991.
  8890.  
  8891.  
  8892.  
  8893.  
  8894.  
  8895.  
  8896.  
  8897.  
  8898.  
  8899.  
  8900.  
  8901.  
  8902.  
  8903.  
  8904.  
  8905.  
  8906. Moy                         Standards Track                   [Page 159]
  8907.  
  8908. RFC 2178                     OSPF Version 2                    July 1997
  8909.  
  8910.  
  8911. A. OSPF data formats
  8912.  
  8913.    This appendix describes the format of OSPF protocol packets and OSPF
  8914.    LSAs.  The OSPF protocol runs directly over the IP network layer.
  8915.    Before any data formats are described, the details of the OSPF
  8916.    encapsulation are explained.
  8917.  
  8918.    Next the OSPF Options field is described.  This field describes
  8919.    various capabilities that may or may not be supported by pieces of
  8920.    the OSPF routing domain. The OSPF Options field is contained in OSPF
  8921.    Hello packets, Database Description packets and in OSPF LSAs.
  8922.  
  8923.    OSPF packet formats are detailed in Section A.3.  A description of
  8924.    OSPF LSAs appears in Section A.4.
  8925.  
  8926. A.1 Encapsulation of OSPF packets
  8927.  
  8928.    OSPF runs directly over the Internet Protocol's network layer.  OSPF
  8929.    packets are therefore encapsulated solely by IP and local data-link
  8930.    headers.
  8931.  
  8932.    OSPF does not define a way to fragment its protocol packets, and
  8933.    depends on IP fragmentation when transmitting packets larger than the
  8934.    network MTU. If necessary, the length of OSPF packets can be up to
  8935.    65,535 bytes (including the IP header). The OSPF packet types that
  8936.    are likely to be large (Database Description Packets, Link State
  8937.    Request, Link State Update, and Link State Acknowledgment packets)
  8938.    can usually be split into several separate protocol packets, without
  8939.    loss of functionality.  This is recommended; IP fragmentation should
  8940.    be avoided whenever possible. Using this reasoning, an attempt should
  8941.    be made to limit the sizes of OSPF packets sent over virtual links to
  8942.    576 bytes unless Path MTU Discovery is being performed (see [Ref22]).
  8943.  
  8944.    The other important features of OSPF's IP encapsulation are:
  8945.  
  8946.    o  Use of IP multicast.  Some OSPF messages are multicast, when
  8947.       sent over broadcast networks.  Two distinct IP multicast addresses
  8948.       are used.  Packets sent to these multicast addresses should never
  8949.       be forwarded; they are meant to travel a single hop only.  To
  8950.       ensure that these packets will not travel multiple hops, their IP
  8951.       TTL must be set to 1.
  8952.  
  8953.  
  8954.  
  8955.  
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  
  8961.  
  8962. Moy                         Standards Track                   [Page 160]
  8963.  
  8964. RFC 2178                     OSPF Version 2                    July 1997
  8965.  
  8966.  
  8967.    AllSPFRouters
  8968.       This multicast address has been assigned the value 224.0.0.5. All
  8969.       routers running OSPF should be prepared to receive packets sent to
  8970.       this address.  Hello packets are always sent to this destination.
  8971.       Also, certain OSPF protocol packets are sent to this address
  8972.       during the flooding procedure.
  8973.  
  8974.    AllDRouters
  8975.       This multicast address has been assigned the value 224.0.0.6. Both
  8976.       the Designated Router and Backup Designated Router must be
  8977.       prepared to receive packets destined to this address.  Certain
  8978.       OSPF protocol packets are sent to this address during the flooding
  8979.       procedure.
  8980.  
  8981.    o   OSPF is IP protocol number 89.  This number has been registered
  8982.        with the Network Information Center.  IP protocol number
  8983.        assignments are documented in [Ref11].
  8984.  
  8985.    o   All OSPF routing protocol packets are sent using the normal
  8986.        service TOS value of binary 0000 defined in [Ref12].
  8987.  
  8988.    o   Routing protocol packets are sent with IP precedence set to
  8989.        Internetwork Control.  OSPF protocol packets should be given
  8990.        precedence over regular IP data traffic, in both sending and
  8991.        receiving.  Setting the IP precedence field in the IP header to
  8992.        Internetwork Control [Ref5] may help implement this objective.
  8993.  
  8994.  
  8995.  
  8996.  
  8997.  
  8998.  
  8999.  
  9000.  
  9001.  
  9002.  
  9003.  
  9004.  
  9005.  
  9006.  
  9007.  
  9008.  
  9009.  
  9010.  
  9011.  
  9012.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.  
  9018. Moy                         Standards Track                   [Page 161]
  9019.  
  9020. RFC 2178                     OSPF Version 2                    July 1997
  9021.  
  9022.  
  9023. A.2 The Options field
  9024.  
  9025.    The OSPF Options field is present in OSPF Hello packets, Database
  9026.    Description packets and all LSAs.  The Options field enables OSPF
  9027.    routers to support (or not support) optional capabilities, and to
  9028.    communicate their capability level to other OSPF routers.  Through
  9029.    this mechanism routers of differing capabilities can be mixed within
  9030.    an OSPF routing domain.
  9031.  
  9032.    When used in Hello packets, the Options field allows a router to
  9033.    reject a neighbor because of a capability mismatch.  Alternatively,
  9034.    when capabilities are exchanged in Database Description packets a
  9035.    router can choose not to forward certain LSAs to a neighbor because
  9036.    of its reduced functionality.  Lastly, listing capabilities in LSAs
  9037.    allows routers to forward traffic around reduced functionality
  9038.    routers, by excluding them from parts of the routing table
  9039.    calculation.
  9040.  
  9041.    Five bits of the OSPF Options field have been assigned, although only
  9042.    one (the E-bit) is described completely by this memo. Each bit is
  9043.    described briefly below. Routers should reset (i.e. clear)
  9044.    unrecognized bits in the Options field when sending Hello packets or
  9045.    Database Description packets and when originating LSAs. Conversely,
  9046.    routers encountering unrecognized Option bits in received Hello
  9047.    Packets, Database Description packets or LSAs should ignore the
  9048.    capability and process the packet/LSA normally.
  9049.  
  9050.                +------------------------------------+
  9051.                | * | * | DC | EA | N/P | MC | E | * |
  9052.                +------------------------------------+
  9053.  
  9054.                            The Options field
  9055.  
  9056.    E-bit
  9057.       This bit describes the way AS-external-LSAs are flooded, as
  9058.       described in Sections 3.6, 9.5, 10.8 and 12.1.2 of this memo.
  9059.  
  9060.    MC-bit
  9061.       This bit describes whether IP multicast datagrams are forwarded
  9062.       according to the specifications in [Ref18].
  9063.  
  9064.    N/P-bit
  9065.       This bit describes the handling of Type-7 LSAs, as specified in
  9066.       [Ref19].
  9067.  
  9068.    EA-bit
  9069.       This bit describes the router's willingness to receive and
  9070.       forward External-Attributes-LSAs, as specified in [Ref20].
  9071.  
  9072.  
  9073.  
  9074. Moy                         Standards Track                   [Page 162]
  9075.  
  9076. RFC 2178                     OSPF Version 2                    July 1997
  9077.  
  9078.  
  9079.    DC-bit
  9080.       This bit describes the router's handling of demand circuits, as
  9081.       specified in [Ref21].
  9082.  
  9083. A.3 OSPF Packet Formats
  9084.  
  9085.    There are five distinct OSPF packet types. All OSPF packet types
  9086.    begin with a standard 24 byte header.  This header is described
  9087.    first.  Each packet type is then described in a succeeding section.
  9088.    In these sections each packet's division into fields is displayed,
  9089.    and then the field definitions are enumerated.
  9090.  
  9091.    All OSPF packet types (other than the OSPF Hello packets) deal with
  9092.    lists of LSAs.  For example, Link State Update packets implement the
  9093.    flooding of LSAs throughout the OSPF routing domain.  Because of
  9094.    this, OSPF protocol packets cannot be parsed unless the format of
  9095.    LSAs is also understood.  The format of LSAs is described in Section
  9096.    A.4.
  9097.  
  9098.    The receive processing of OSPF packets is detailed in Section 8.2.
  9099.    The sending of OSPF packets is explained in Section 8.1.
  9100.  
  9101.  
  9102.  
  9103.  
  9104.  
  9105.  
  9106.  
  9107.  
  9108.  
  9109.  
  9110.  
  9111.  
  9112.  
  9113.  
  9114.  
  9115.  
  9116.  
  9117.  
  9118.  
  9119.  
  9120.  
  9121.  
  9122.  
  9123.  
  9124.  
  9125.  
  9126.  
  9127.  
  9128.  
  9129.  
  9130. Moy                         Standards Track                   [Page 163]
  9131.  
  9132. RFC 2178                     OSPF Version 2                    July 1997
  9133.  
  9134.  
  9135. A.3.1 The OSPF packet header
  9136.  
  9137.    Every OSPF packet starts with a standard 24 byte header.  This header
  9138.    contains all the information necessary to determine whether the
  9139.    packet should be accepted for further processing.  This determination
  9140.    is described in Section 8.2 of the specification.
  9141.  
  9142.         0                   1                   2                   3
  9143.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9144.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9145.        |   Version #   |     Type      |         Packet length         |
  9146.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9147.        |                          Router ID                            |
  9148.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9149.        |                           Area ID                             |
  9150.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9151.        |           Checksum            |             AuType            |
  9152.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9153.        |                       Authentication                          |
  9154.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9155.        |                       Authentication                          |
  9156.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9157.  
  9158.  
  9159.    Version #
  9160.       The OSPF version number.  This specification documents version 2
  9161.       of the protocol.
  9162.  
  9163.    Type
  9164.       The OSPF packet types are as follows. See Sections A.3.2 through
  9165.       A.3.6 for details.
  9166.  
  9167.                   Type   Description
  9168.                   ________________________________
  9169.                   1      Hello
  9170.                   2      Database Description
  9171.                   3      Link State Request
  9172.                   4      Link State Update
  9173.                   5      Link State Acknowledgment
  9174.  
  9175.  
  9176.    Packet length
  9177.       The length of the OSPF protocol packet in bytes.  This length
  9178.       includes the standard OSPF header.
  9179.  
  9180.    Router ID
  9181.       The Router ID of the packet's source.
  9182.  
  9183.  
  9184.  
  9185.  
  9186. Moy                         Standards Track                   [Page 164]
  9187.  
  9188. RFC 2178                     OSPF Version 2                    July 1997
  9189.  
  9190.  
  9191.    Area ID
  9192.       A 32 bit number identifying the area that this packet belongs
  9193.       to.  All OSPF packets are associated with a single area.  Most
  9194.       travel a single hop only.  Packets travelling over a virtual
  9195.       link are labelled with the backbone Area ID of 0.0.0.0.
  9196.  
  9197.    Checksum
  9198.       The standard IP checksum of the entire contents of the packet,
  9199.       starting with the OSPF packet header but excluding the 64-bit
  9200.       authentication field.  This checksum is calculated as the 16-bit
  9201.       one's complement of the one's complement sum of all the 16-bit
  9202.       words in the packet, excepting the authentication field.  If the
  9203.       packet's length is not an integral number of 16-bit words, the
  9204.       packet is padded with a byte of zero before checksumming.  The
  9205.       checksum is considered to be part of the packet authentication
  9206.       procedure; for some authentication types the checksum
  9207.       calculation is omitted.
  9208.  
  9209.    AuType
  9210.       Identifies the authentication procedure to be used for the
  9211.       packet.  Authentication is discussed in Appendix D of the
  9212.       specification.  Consult Appendix D for a list of the currently
  9213.       defined authentication types.
  9214.  
  9215.    Authentication
  9216.       A 64-bit field for use by the authentication scheme. See
  9217.       Appendix D for details.
  9218.  
  9219.  
  9220.  
  9221.  
  9222.  
  9223.  
  9224.  
  9225.  
  9226.  
  9227.  
  9228.  
  9229.  
  9230.  
  9231.  
  9232.  
  9233.  
  9234.  
  9235.  
  9236.  
  9237.  
  9238.  
  9239.  
  9240.  
  9241.  
  9242. Moy                         Standards Track                   [Page 165]
  9243.  
  9244. RFC 2178                     OSPF Version 2                    July 1997
  9245.  
  9246.  
  9247. A.3.2 The Hello packet
  9248.  
  9249.    Hello packets are OSPF packet type 1.  These packets are sent
  9250.    periodically on all interfaces (including virtual links) in order to
  9251.    establish and maintain neighbor relationships.  In addition, Hello
  9252.    Packets are multicast on those physical networks having a multicast
  9253.    or broadcast capability, enabling dynamic discovery of neighboring
  9254.    routers.
  9255.  
  9256.    All routers connected to a common network must agree on certain
  9257.    parameters (Network mask, HelloInterval and RouterDeadInterval).
  9258.    These parameters are included in Hello packets, so that differences
  9259.    can inhibit the forming of neighbor relationships. A detailed
  9260.    explanation of the receive processing for Hello packets is presented
  9261.    in Section 10.5.  The sending of Hello packets is covered in Section
  9262.    9.5.
  9263.  
  9264.  
  9265.         0                   1                   2                   3
  9266.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9267.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9268.        |   Version #   |       1       |         Packet length         |
  9269.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9270.        |                          Router ID                            |
  9271.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9272.        |                           Area ID                             |
  9273.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9274.        |           Checksum            |             AuType            |
  9275.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9276.        |                       Authentication                          |
  9277.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9278.        |                       Authentication                          |
  9279.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9280.        |                        Network Mask                           |
  9281.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9282.        |         HelloInterval         |    Options    |    Rtr Pri    |
  9283.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9284.        |                     RouterDeadInterval                        |
  9285.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9286.        |                      Designated Router                        |
  9287.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9288.        |                   Backup Designated Router                    |
  9289.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9290.        |                          Neighbor                             |
  9291.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9292.        |                              ...                              |
  9293.  
  9294.  
  9295.  
  9296.  
  9297.  
  9298. Moy                         Standards Track                   [Page 166]
  9299.  
  9300. RFC 2178                     OSPF Version 2                    July 1997
  9301.  
  9302.  
  9303.    Network mask
  9304.       The network mask associated with this interface.  For example,
  9305.       if the interface is to a class B network whose third byte is
  9306.       used for subnetting, the network mask is 0xffffff00.
  9307.  
  9308.    Options
  9309.       The optional capabilities supported by the router, as documented
  9310.       in Section A.2.
  9311.  
  9312.    HelloInterval
  9313.       The number of seconds between this router's Hello packets.
  9314.  
  9315.    Rtr Pri
  9316.       This router's Router Priority.  Used in (Backup) Designated
  9317.       Router election.  If set to 0, the router will be ineligible to
  9318.       become (Backup) Designated Router.
  9319.  
  9320.    RouterDeadInterval
  9321.       The number of seconds before declaring a silent router down.
  9322.  
  9323.    Designated Router
  9324.       The identity of the Designated Router for this network, in the
  9325.       view of the sending router.  The Designated Router is identified
  9326.       here by its IP interface address on the network.  Set to 0.0.0.0
  9327.       if there is no Designated Router.
  9328.  
  9329.    Backup Designated Router
  9330.       The identity of the Backup Designated Router for this network,
  9331.       in the view of the sending router.  The Backup Designated Router
  9332.       is identified here by its IP interface address on the network.
  9333.       Set to 0.0.0.0 if there is no Backup Designated Router.
  9334.  
  9335.    Neighbor
  9336.       The Router IDs of each router from whom valid Hello packets have
  9337.       been seen recently on the network.  Recently means in the last
  9338.       RouterDeadInterval seconds.
  9339.  
  9340.  
  9341.  
  9342.  
  9343.  
  9344.  
  9345.  
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.  
  9352.  
  9353.  
  9354. Moy                         Standards Track                   [Page 167]
  9355.  
  9356. RFC 2178                     OSPF Version 2                    July 1997
  9357.  
  9358.  
  9359. A.3.3 The Database Description packet
  9360.  
  9361.    Database Description packets are OSPF packet type 2.  These packets
  9362.    are exchanged when an adjacency is being initialized.  They describe
  9363.    the contents of the link-state database.  Multiple packets may be
  9364.    used to describe the database.  For this purpose a poll-response
  9365.    procedure is used. One of the routers is designated to be the master,
  9366.    the other the slave.  The master sends Database Description packets
  9367.    (polls) which are acknowledged by Database Description packets sent
  9368.    by the slave (responses).  The responses are linked to the polls via
  9369.    the packets' DD sequence numbers.
  9370.  
  9371.         0                   1                   2                   3
  9372.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9373.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9374.        |   Version #   |       2       |         Packet length         |
  9375.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9376.        |                          Router ID                            |
  9377.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9378.        |                           Area ID                             |
  9379.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9380.        |           Checksum            |             AuType            |
  9381.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9382.        |                       Authentication                          |
  9383.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9384.        |                       Authentication                          |
  9385.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9386.        |         Interface MTU         |    Options    |0|0|0|0|0|I|M|MS
  9387.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9388.        |                     DD sequence number                        |
  9389.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9390.        |                                                               |
  9391.        +-                                                             -+
  9392.        |                                                               |
  9393.        +-                      An LSA Header                          -+
  9394.        |                                                               |
  9395.        +-                                                             -+
  9396.        |                                                               |
  9397.        +-                                                             -+
  9398.        |                                                               |
  9399.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9400.        |                              ...                              |
  9401.  
  9402.  
  9403.    The format of the Database Description packet is very similar to both
  9404.    the Link State Request and Link State Acknowledgment packets.  The
  9405.    main part of all three is a list of items, each item describing a
  9406.    piece of the link-state database.  The sending of Database
  9407.  
  9408.  
  9409.  
  9410. Moy                         Standards Track                   [Page 168]
  9411.  
  9412. RFC 2178                     OSPF Version 2                    July 1997
  9413.  
  9414.  
  9415.    Description Packets is documented in Section 10.8. The reception of
  9416.    Database Description packets is documented in Section 10.6.
  9417.  
  9418.    Interface MTU
  9419.       The size in bytes of the largest IP datagram that can be sent out
  9420.       the associated interface, without fragmentation.  The MTUs of
  9421.       common Internet link types can be found in Table 7-1 of [Ref22].
  9422.       Interface MTU should be set to 0 in Database Description packets
  9423.       sent over virtual links.
  9424.  
  9425.    Options
  9426.       The optional capabilities supported by the router, as documented
  9427.       in Section A.2.
  9428.  
  9429.    I-bit
  9430.       The Init bit.  When set to 1, this packet is the first in the
  9431.       sequence of Database Description Packets.
  9432.  
  9433.    M-bit
  9434.       The More bit.  When set to 1, it indicates that more Database
  9435.       Description Packets are to follow.
  9436.  
  9437.    MS-bit
  9438.       The Master/Slave bit.  When set to 1, it indicates that the router
  9439.       is the master during the Database Exchange process.  Otherwise,
  9440.       the router is the slave.
  9441.  
  9442.    DD sequence number
  9443.       Used to sequence the collection of Database Description Packets.
  9444.       The initial value (indicated by the Init bit being set) should be
  9445.       unique.  The DD sequence number then increments until the complete
  9446.       database description has been sent.
  9447.  
  9448.    The rest of the packet consists of a (possibly partial) list of the
  9449.    link-state database's pieces.  Each LSA in the database is described
  9450.    by its LSA header. The LSA header is documented in Section A.4.1.  It
  9451.    contains all the information required to uniquely identify both the
  9452.    LSA and the LSA's current instance.
  9453.  
  9454.  
  9455.  
  9456.  
  9457.  
  9458.  
  9459.  
  9460.  
  9461.  
  9462.  
  9463.  
  9464.  
  9465.  
  9466. Moy                         Standards Track                   [Page 169]
  9467.  
  9468. RFC 2178                     OSPF Version 2                    July 1997
  9469.  
  9470.  
  9471. A.3.4 The Link State Request packet
  9472.  
  9473.    Link State Request packets are OSPF packet type 3. After exchanging
  9474.    Database Description packets with a neighboring router, a router may
  9475.    find that parts of its link-state database are out-of-date.  The Link
  9476.    State Request packet is used to request the pieces of the neighbor's
  9477.    database that are more up-to-date.  Multiple Link State Request
  9478.    packets may need to be used.
  9479.  
  9480.    A router that sends a Link State Request packet has in mind the
  9481.    precise instance of the database pieces it is requesting. Each
  9482.    instance is defined by its LS sequence number, LS checksum, and LS
  9483.    age, although these fields are not specified in the Link State
  9484.    Request Packet itself.  The router may receive even more recent
  9485.    instances in response.
  9486.  
  9487.    The sending of Link State Request packets is documented in Section
  9488.    10.9.  The reception of Link State Request packets is documented in
  9489.    Section 10.7.
  9490.  
  9491.         0                   1                   2                   3
  9492.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9493.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9494.        |   Version #   |       3       |         Packet length         |
  9495.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9496.        |                          Router ID                            |
  9497.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9498.        |                           Area ID                             |
  9499.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9500.        |           Checksum            |             AuType            |
  9501.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9502.        |                       Authentication                          |
  9503.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9504.        |                       Authentication                          |
  9505.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9506.        |                          LS type                              |
  9507.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9508.        |                       Link State ID                           |
  9509.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9510.        |                     Advertising Router                        |
  9511.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9512.        |                              ...                              |
  9513.  
  9514.    Each LSA requested is specified by its LS type, Link State ID, and
  9515.    Advertising Router.  This uniquely identifies the LSA, but not its
  9516.    instance.  Link State Request packets are understood to be requests
  9517.    for the most recent instance (whatever that might be).
  9518.  
  9519.  
  9520.  
  9521.  
  9522. Moy                         Standards Track                   [Page 170]
  9523.  
  9524. RFC 2178                     OSPF Version 2                    July 1997
  9525.  
  9526.  
  9527. A.3.5 The Link State Update packet
  9528.  
  9529.    Link State Update packets are OSPF packet type 4.  These packets
  9530.    implement the flooding of LSAs.  Each Link State Update packet
  9531.    carries a collection of LSAs one hop further from their origin.
  9532.    Several LSAs may be included in a single packet.
  9533.  
  9534.    Link State Update packets are multicast on those physical networks
  9535.    that support multicast/broadcast.  In order to make the flooding
  9536.    procedure reliable, flooded LSAs are acknowledged in Link State
  9537.    Acknowledgment packets.  If retransmission of certain LSAs is
  9538.    necessary, the retransmitted LSAs are always carried by unicast Link
  9539.    State Update packets.  For more information on the reliable flooding
  9540.    of LSAs, consult Section 13.
  9541.  
  9542.         0                   1                   2                   3
  9543.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9544.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9545.        |   Version #   |       4       |         Packet length         |
  9546.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9547.        |                          Router ID                            |
  9548.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9549.        |                           Area ID                             |
  9550.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9551.        |           Checksum            |             AuType            |
  9552.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9553.        |                       Authentication                          |
  9554.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9555.        |                       Authentication                          |
  9556.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9557.        |                            # LSAs                             |
  9558.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9559.        |                                                               |
  9560.        +-                                                            +-+
  9561.        |                             LSAs                              |
  9562.        +-                                                            +-+
  9563.        |                              ...                              |
  9564.  
  9565.  
  9566.  
  9567.    # LSAs
  9568.       The number of LSAs included in this update.
  9569.  
  9570.    The body of the Link State Update packet consists of a list of LSAs.
  9571.    Each LSA begins with a common 20 byte header, described in Section
  9572.    A.4.1. Detailed formats of the different types of LSAs are described
  9573.    in Section A.4.
  9574.  
  9575.  
  9576.  
  9577.  
  9578. Moy                         Standards Track                   [Page 171]
  9579.  
  9580. RFC 2178                     OSPF Version 2                    July 1997
  9581.  
  9582.  
  9583. A.3.6 The Link State Acknowledgment packet
  9584.  
  9585.    Link State Acknowledgment Packets are OSPF packet type 5.  To make
  9586.    the flooding of LSAs reliable, flooded LSAs are explicitly
  9587.    acknowledged.  This acknowledgment is accomplished through the
  9588.    sending and receiving of Link State Acknowledgment packets.  Multiple
  9589.    LSAs can be acknowledged in a single Link State Acknowledgment
  9590.    packet.
  9591.  
  9592.    Depending on the state of the sending interface and the sender of the
  9593.    corresponding Link State Update packet, a Link State Acknowledgment
  9594.    packet is sent either to the multicast address AllSPFRouters, to the
  9595.    multicast address AllDRouters, or as a unicast.  The sending of Link
  9596.    State Acknowledgment packets is documented in Section 13.5.  The
  9597.    reception of Link State Acknowledgment packets is documented in
  9598.    Section 13.7.
  9599.  
  9600.    The format of this packet is similar to that of the Data Description
  9601.    packet.  The body of both packets is simply a list of LSA headers.
  9602.  
  9603.         0                   1                   2                   3
  9604.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9605.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9606.        |   Version #   |       5       |         Packet length         |
  9607.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9608.        |                          Router ID                            |
  9609.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9610.        |                           Area ID                             |
  9611.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9612.        |           Checksum            |             AuType            |
  9613.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9614.        |                       Authentication                          |
  9615.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9616.        |                       Authentication                          |
  9617.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9618.        |                                                               |
  9619.        +-                                                             -+
  9620.        |                                                               |
  9621.        +-                         An LSA Header                       -+
  9622.        |                                                               |
  9623.        +-                                                             -+
  9624.        |                                                               |
  9625.        +-                                                             -+
  9626.        |                                                               |
  9627.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9628.        |                              ...                              |
  9629.  
  9630.  
  9631.  
  9632.  
  9633.  
  9634. Moy                         Standards Track                   [Page 172]
  9635.  
  9636. RFC 2178                     OSPF Version 2                    July 1997
  9637.  
  9638.  
  9639.    Each acknowledged LSA is described by its LSA header.  The LSA header
  9640.    is documented in Section A.4.1.  It contains all the information
  9641.    required to uniquely identify both the LSA and the LSA's current
  9642.    instance.
  9643.  
  9644. A.4 LSA formats
  9645.  
  9646.    This memo defines five distinct types of LSAs.  Each LSA begins with
  9647.    a standard 20 byte LSA header.  This header is explained in Section
  9648.    A.4.1.  Succeeding sections then diagram the separate LSA types.
  9649.  
  9650.    Each LSA describes a piece of the OSPF routing domain.  Every router
  9651.    originates a router-LSA.  In addition, whenever the router is elected
  9652.    Designated Router, it originates a network-LSA.  Other types of LSAs
  9653.    may also be originated (see Section 12.4). All LSAs are then flooded
  9654.    throughout the OSPF routing domain.  The flooding algorithm is
  9655.    reliable, ensuring that all routers have the same collection of LSAs.
  9656.    (See Section 13 for more information concerning the flooding
  9657.    algorithm).  This collection of LSAs is called the link-state
  9658.    database.
  9659.  
  9660.    From the link state database, each router constructs a shortest path
  9661.    tree with itself as root.  This yields a routing table (see Section
  9662.    11).  For the details of the routing table build process, see Section
  9663.    16.
  9664.  
  9665.  
  9666.  
  9667.  
  9668.  
  9669.  
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.  
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.  
  9690. Moy                         Standards Track                   [Page 173]
  9691.  
  9692. RFC 2178                     OSPF Version 2                    July 1997
  9693.  
  9694.  
  9695. A.4.1 The LSA header
  9696.  
  9697.    All LSAs begin with a common 20 byte header.  This header contains
  9698.    enough information to uniquely identify the LSA (LS type, Link State
  9699.    ID, and Advertising Router).  Multiple instances of the LSA may exist
  9700.    in the routing domain at the same time.  It is then necessary to
  9701.    determine which instance is more recent.  This is accomplished by
  9702.    examining the LS age, LS sequence number and LS checksum fields that
  9703.    are also contained in the LSA header.
  9704.  
  9705.         0                   1                   2                   3
  9706.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9707.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9708.        |            LS age             |    Options    |    LS type    |
  9709.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9710.        |                        Link State ID                          |
  9711.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9712.        |                     Advertising Router                        |
  9713.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9714.        |                     LS sequence number                        |
  9715.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9716.        |         LS checksum           |             length            |
  9717.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9718.  
  9719.  
  9720.    LS age
  9721.       The time in seconds since the LSA was originated.
  9722.  
  9723.    Options
  9724.       The optional capabilities supported by the described portion of
  9725.       the routing domain.  OSPF's optional capabilities are documented
  9726.       in Section A.2.
  9727.  
  9728.    LS type
  9729.       The type of the LSA.  Each LSA type has a separate advertisement
  9730.       format.  The LSA types defined in this memo are as follows (see
  9731.       Section 12.1.3 for further explanation):
  9732.  
  9733.  
  9734.         LS Type   Description
  9735.         ___________________________________
  9736.         1         Router-LSAs
  9737.         2         Network-LSAs
  9738.         3         Summary-LSAs (IP network)
  9739.         4         Summary-LSAs (ASBR)
  9740.         5         AS-external-LSAs
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746. Moy                         Standards Track                   [Page 174]
  9747.  
  9748. RFC 2178                     OSPF Version 2                    July 1997
  9749.  
  9750.  
  9751.    Link State ID
  9752.       This field identifies the portion of the internet environment
  9753.       that is being described by the LSA.  The contents of this field
  9754.       depend on the LSA's LS type.  For example, in network-LSAs the
  9755.       Link State ID is set to the IP interface address of the
  9756.       network's Designated Router (from which the network's IP address
  9757.       can be derived).  The Link State ID is further discussed in
  9758.       Section 12.1.4.
  9759.  
  9760.    Advertising Router
  9761.       The Router ID of the router that originated the LSA.  For
  9762.       example, in network-LSAs this field is equal to the Router ID of
  9763.       the network's Designated Router.
  9764.  
  9765.    LS sequence number
  9766.       Detects old or duplicate LSAs.  Successive instances of an LSA
  9767.       are given successive LS sequence numbers.  See Section 12.1.6
  9768.       for more details.
  9769.  
  9770.    LS checksum
  9771.       The Fletcher checksum of the complete contents of the LSA,
  9772.       including the LSA header but excluding the LS age field. See
  9773.       Section 12.1.7 for more details.
  9774.  
  9775.    length
  9776.       The length in bytes of the LSA.  This includes the 20 byte LSA
  9777.       header.
  9778.  
  9779.  
  9780.  
  9781.  
  9782.  
  9783.  
  9784.  
  9785.  
  9786.  
  9787.  
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.  
  9794.  
  9795.  
  9796.  
  9797.  
  9798.  
  9799.  
  9800.  
  9801.  
  9802. Moy                         Standards Track                   [Page 175]
  9803.  
  9804. RFC 2178                     OSPF Version 2                    July 1997
  9805.  
  9806.  
  9807. A.4.2 Router-LSAs
  9808.  
  9809.    Router-LSAs are the Type 1 LSAs.  Each router in an area originates a
  9810.    router-LSA.  The LSA describes the state and cost of the router's
  9811.    links (i.e., interfaces) to the area.  All of the router's links to
  9812.    the area must be described in a single router-LSA. For details
  9813.    concerning the construction of router-LSAs, see Section 12.4.1.
  9814.  
  9815.         0                   1                   2                   3
  9816.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9817.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9818.        |            LS age             |     Options   |       1       |
  9819.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9820.        |                        Link State ID                          |
  9821.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9822.        |                     Advertising Router                        |
  9823.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9824.        |                     LS sequence number                        |
  9825.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9826.        |         LS checksum           |             length            |
  9827.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9828.        |    0    |V|E|B|        0      |            # links            |
  9829.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9830.        |                          Link ID                              |
  9831.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9832.        |                         Link Data                             |
  9833.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9834.        |     Type      |     # TOS     |            metric             |
  9835.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9836.        |                              ...                              |
  9837.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9838.        |      TOS      |        0      |          TOS  metric          |
  9839.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9840.        |                          Link ID                              |
  9841.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9842.        |                         Link Data                             |
  9843.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9844.        |                              ...                              |
  9845.  
  9846.  
  9847.    In router-LSAs, the Link State ID field is set to the router's OSPF
  9848.    Router ID. Router-LSAs are flooded throughout a single area only.
  9849.  
  9850.    bit V
  9851.       When set, the router is an endpoint of one or more fully adjacent
  9852.       virtual links having the described area as Transit area (V is for
  9853.       virtual link endpoint).
  9854.  
  9855.  
  9856.  
  9857.  
  9858. Moy                         Standards Track                   [Page 176]
  9859.  
  9860. RFC 2178                     OSPF Version 2                    July 1997
  9861.  
  9862.  
  9863.    bit E
  9864.       When set, the router is an AS boundary router (E is for external).
  9865.  
  9866.    bit B
  9867.       When set, the router is an area border router (B is for border).
  9868.  
  9869.    # links
  9870.       The number of router links described in this LSA.  This must be
  9871.       the total collection of router links (i.e., interfaces) to the
  9872.       area.
  9873.  
  9874.    The following fields are used to describe each router link (i.e.,
  9875.    interface). Each router link is typed (see the below Type field).
  9876.    The Type field indicates the kind of link being described. It may be
  9877.    a link to a transit network, to another router or to a stub network.
  9878.    The values of all the other fields describing a router link depend on
  9879.    the link's Type.  For example, each link has an associated 32-bit
  9880.    Link Data field. For links to stub networks this field specifies the
  9881.    network's IP address mask.  For other link types the Link Data field
  9882.    specifies the router interface's IP address.
  9883.  
  9884.    Type
  9885.       A quick description of the router link.  One of the following.
  9886.       Note that host routes are classified as links to stub networks
  9887.       with network mask of 0xffffffff.
  9888.  
  9889.          Type   Description
  9890.          __________________________________________________
  9891.          1      Point-to-point connection to another router
  9892.          2      Connection to a transit network
  9893.          3      Connection to a stub network
  9894.          4      Virtual link
  9895.  
  9896.    Link ID
  9897.       Identifies the object that this router link connects to.  Value
  9898.       depends on the link's Type.  When connecting to an object that
  9899.       also originates an LSA (i.e., another router or a transit
  9900.       network) the Link ID is equal to the neighboring LSA's Link
  9901.       State ID.  This provides the key for looking up the neighboring
  9902.       LSA in the link state database during the routing table
  9903.       calculation. See Section 12.2 for more details.
  9904.  
  9905.  
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.  
  9912.  
  9913.  
  9914. Moy                         Standards Track                   [Page 177]
  9915.  
  9916. RFC 2178                     OSPF Version 2                    July 1997
  9917.  
  9918.  
  9919.        Type   Link ID
  9920.        ______________________________________
  9921.        1      Neighboring router's Router ID
  9922.        2      IP address of Designated Router
  9923.        3      IP network/subnet number
  9924.        4      Neighboring router's Router ID
  9925.  
  9926.    Link Data
  9927.       Value again depends on the link's Type field. For connections to
  9928.       stub networks, Link Data specifies the network's IP address
  9929.       mask. For unnumbered point-to-point connections, it specifies
  9930.       the interface's MIB-II [Ref8] ifIndex value. For the other link
  9931.       types it specifies the router interface's IP address. This
  9932.       latter piece of information is needed during the routing table
  9933.       build process, when calculating the IP address of the next hop.
  9934.       See Section 16.1.1 for more details.
  9935.  
  9936.    # TOS
  9937.       The number of different TOS metrics given for this link, not
  9938.       counting the required link metric (referred to as the TOS 0
  9939.       metric in [Ref9]).  For example, if no additional TOS metrics
  9940.       are given, this field is set to 0.
  9941.  
  9942.    metric
  9943.       The cost of using this router link.
  9944.  
  9945.    Additional TOS-specific information may also be included, for
  9946.    backward compatibility with previous versions of the OSPF
  9947.    specification ([Ref9]). Within each link, and for each desired TOS,
  9948.    TOS TOS-specific link information may be encoded as follows:
  9949.  
  9950.    TOS IP  Type of Service that this metric refers to. The encoding of
  9951.       TOS in OSPF LSAs is described in Section 12.3.
  9952.  
  9953.    TOS metric
  9954.       TOS-specific metric information.
  9955.  
  9956.  
  9957.  
  9958.  
  9959.  
  9960.  
  9961.  
  9962.  
  9963.  
  9964.  
  9965.  
  9966.  
  9967.  
  9968.  
  9969.  
  9970. Moy                         Standards Track                   [Page 178]
  9971.  
  9972. RFC 2178                     OSPF Version 2                    July 1997
  9973.  
  9974.  
  9975. A.4.3 Network-LSAs
  9976.  
  9977.    Network-LSAs are the Type 2 LSAs.  A network-LSA is originated for
  9978.    each broadcast and NBMA network in the area which supports two or
  9979.    more routers.  The network-LSA is originated by the network's
  9980.    Designated Router. The LSA describes all routers attached to the
  9981.    network, including the Designated Router itself.  The LSA's Link
  9982.    State ID field lists the IP interface address of the Designated
  9983.    Router.
  9984.  
  9985.    The distance from the network to all attached routers is zero.  This
  9986.    is why metric fields need not be specified in the network-LSA.  For
  9987.    details concerning the construction of network-LSAs, see Section
  9988.    12.4.2.
  9989.  
  9990.         0                   1                   2                   3
  9991.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  9992.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9993.        |            LS age             |      Options  |      2        |
  9994.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9995.        |                        Link State ID                          |
  9996.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9997.        |                     Advertising Router                        |
  9998.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  9999.        |                     LS sequence number                        |
  10000.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10001.        |         LS checksum           |             length            |
  10002.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10003.        |                         Network Mask                          |
  10004.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10005.        |                        Attached Router                        |
  10006.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10007.        |                              ...                              |
  10008.  
  10009.  
  10010.    Network Mask
  10011.       The IP address mask for the network.  For example, a class A
  10012.       network would have the mask 0xff000000.
  10013.  
  10014.    Attached Router
  10015.       The Router IDs of each of the routers attached to the network.
  10016.       Actually, only those routers that are fully adjacent to the
  10017.       Designated Router are listed.  The Designated Router includes
  10018.       itself in this list.  The number of routers included can be
  10019.       deduced from the LSA header's length field.
  10020.  
  10021.  
  10022.  
  10023.  
  10024.  
  10025.  
  10026. Moy                         Standards Track                   [Page 179]
  10027.  
  10028. RFC 2178                     OSPF Version 2                    July 1997
  10029.  
  10030.  
  10031. A.4.4 Summary-LSAs
  10032.  
  10033.    Summary-LSAs are the Type 3 and 4 LSAs.  These LSAs are originated by
  10034.    area border routers. Summary-LSAs describe inter-area destinations.
  10035.    For details concerning the construction of summary-LSAs, see Section
  10036.    12.4.3.
  10037.  
  10038.    Type 3 summary-LSAs are used when the destination is an IP network.
  10039.    In this case the LSA's Link State ID field is an IP network number
  10040.    (if necessary, the Link State ID can also have one or more of the
  10041.    network's "host" bits set; see Appendix E for details). When the
  10042.    destination is an AS boundary router, a Type 4 summary-LSA is used,
  10043.    and the Link State ID field is the AS boundary router's OSPF Router
  10044.    ID.  (To see why it is necessary to advertise the location of each
  10045.    ASBR, consult Section 16.4.)  Other than the difference in the Link
  10046.    State ID field, the format of Type 3 and 4 summary-LSAs is identical.
  10047.  
  10048.         0                   1                   2                   3
  10049.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  10050.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10051.        |            LS age             |     Options   |    3 or 4     |
  10052.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10053.        |                        Link State ID                          |
  10054.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10055.        |                     Advertising Router                        |
  10056.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10057.        |                     LS sequence number                        |
  10058.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10059.        |         LS checksum           |             length            |
  10060.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10061.        |                         Network Mask                          |
  10062.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10063.        |      0        |                  metric                       |
  10064.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10065.        |     TOS       |                TOS  metric                    |
  10066.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10067.        |                              ...                              |
  10068.  
  10069.  
  10070.    For stub areas, Type 3 summary-LSAs can also be used to describe a
  10071.    (per-area) default route.  Default summary routes are used in stub
  10072.    areas instead of flooding a complete set of external routes.  When
  10073.    describing a default summary route, the summary-LSA's Link State ID
  10074.    is always set to DefaultDestination (0.0.0.0) and the Network Mask is
  10075.    set to 0.0.0.0.
  10076.  
  10077.  
  10078.  
  10079.  
  10080.  
  10081.  
  10082. Moy                         Standards Track                   [Page 180]
  10083.  
  10084. RFC 2178                     OSPF Version 2                    July 1997
  10085.  
  10086.  
  10087.    Network Mask
  10088.       For Type 3 summary-LSAs, this indicates the destination network's
  10089.       IP address mask.  For example, when advertising the location of a
  10090.       class A network the value 0xff000000 would be used.  This field is
  10091.       not meaningful and must be zero for Type 4 summary-LSAs.
  10092.  
  10093.    metric
  10094.       The cost of this route.  Expressed in the same units as the
  10095.       interface costs in the router-LSAs.
  10096.  
  10097.    Additional TOS-specific information may also be included, for
  10098.    backward compatibility with previous versions of the OSPF
  10099.    specification ([Ref9]). For each desired TOS, TOS-specific
  10100.    information is encoded as follows:
  10101.  
  10102.    TOS IP Type of Service that this metric refers to. The encoding of
  10103.       TOS in OSPF LSAs is described in Section 12.3.
  10104.  
  10105.    TOS metric
  10106.       TOS-specific metric information.
  10107.  
  10108.  
  10109.  
  10110.  
  10111.  
  10112.  
  10113.  
  10114.  
  10115.  
  10116.  
  10117.  
  10118.  
  10119.  
  10120.  
  10121.  
  10122.  
  10123.  
  10124.  
  10125.  
  10126.  
  10127.  
  10128.  
  10129.  
  10130.  
  10131.  
  10132.  
  10133.  
  10134.  
  10135.  
  10136.  
  10137.  
  10138. Moy                         Standards Track                   [Page 181]
  10139.  
  10140. RFC 2178                     OSPF Version 2                    July 1997
  10141.  
  10142.  
  10143. A.4.5 AS-external-LSAs
  10144.  
  10145.    AS-external-LSAs are the Type 5 LSAs.  These LSAs are originated by
  10146.    AS boundary routers, and describe destinations external to the AS.
  10147.    For details concerning the construction of AS-external-LSAs, see
  10148.    Section 12.4.3.
  10149.  
  10150.    AS-external-LSAs usually describe a particular external destination.
  10151.    For these LSAs the Link State ID field specifies an IP network number
  10152.    (if necessary, the Link State ID can also have one or more of the
  10153.    network's "host" bits set; see Appendix E for details).  AS-
  10154.    external-LSAs are also used to describe a default route.  Default
  10155.    routes are used when no specific route exists to the destination.
  10156.    When describing a default route, the Link State ID is always set to
  10157.    DefaultDestination (0.0.0.0) and the Network Mask is set to 0.0.0.0.
  10158.  
  10159.         0                   1                   2                   3
  10160.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  10161.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10162.        |            LS age             |     Options   |      5        |
  10163.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10164.        |                        Link State ID                          |
  10165.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10166.        |                     Advertising Router                        |
  10167.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10168.        |                     LS sequence number                        |
  10169.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10170.        |         LS checksum           |             length            |
  10171.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10172.        |                         Network Mask                          |
  10173.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10174.        |E|     0       |                  metric                       |
  10175.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10176.        |                      Forwarding address                       |
  10177.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10178.        |                      External Route Tag                       |
  10179.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10180.        |E|    TOS      |                TOS  metric                    |
  10181.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10182.        |                      Forwarding address                       |
  10183.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10184.        |                      External Route Tag                       |
  10185.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10186.        |                              ...                              |
  10187.  
  10188.  
  10189.  
  10190.  
  10191.  
  10192.  
  10193.  
  10194. Moy                         Standards Track                   [Page 182]
  10195.  
  10196. RFC 2178                     OSPF Version 2                    July 1997
  10197.  
  10198.  
  10199.    Network Mask
  10200.       The IP address mask for the advertised destination.  For
  10201.       example, when advertising a class A network the mask 0xff000000
  10202.       would be used.
  10203.  
  10204.    bit E
  10205.       The type of external metric.  If bit E is set, the metric
  10206.       specified is a Type 2 external metric.  This means the metric is
  10207.       considered larger than any link state path.  If bit E is zero,
  10208.       the specified metric is a Type 1 external metric.  This means
  10209.       that it is expressed in the same units as the link state metric
  10210.       (i.e., the same units as interface cost).
  10211.  
  10212.    metric
  10213.       The cost of this route.  Interpretation depends on the external
  10214.       type indication (bit E above).
  10215.  
  10216.    Forwarding address
  10217.       Data traffic for the advertised destination will be forwarded to
  10218.       this address.  If the Forwarding address is set to 0.0.0.0, data
  10219.       traffic will be forwarded instead to the LSA's originator (i.e.,
  10220.       the responsible AS boundary router).
  10221.  
  10222.    External Route Tag
  10223.        A 32-bit field attached to each external route.  This is not
  10224.        used by the OSPF protocol itself.  It may be used to communicate
  10225.        information between AS boundary routers; the precise nature of
  10226.        such information is outside the scope of this specification.
  10227.  
  10228.    Additional TOS-specific information may also be included, for
  10229.    backward compatibility with previous versions of the OSPF
  10230.    specification ([Ref9]). For each desired TOS, TOS-specific
  10231.    information is encoded as follows:
  10232.  
  10233.    TOS The Type of Service that the following fields concern. The
  10234.       encoding of TOS in OSPF LSAs is described in Section 12.3.
  10235.  
  10236.    bit E
  10237.       For backward-compatibility with [Ref9].
  10238.  
  10239.    TOS metric
  10240.       TOS-specific metric information.
  10241.  
  10242.    Forwarding address
  10243.       For backward-compatibility with [Ref9].
  10244.  
  10245.    External Route Tag
  10246.       For backward-compatibility with [Ref9].
  10247.  
  10248.  
  10249.  
  10250. Moy                         Standards Track                   [Page 183]
  10251.  
  10252. RFC 2178                     OSPF Version 2                    July 1997
  10253.  
  10254.  
  10255. B. Architectural Constants
  10256.  
  10257.    Several OSPF protocol parameters have fixed architectural values.
  10258.    These parameters have been referred to in the text by names such as
  10259.    LSRefreshTime.  The same naming convention is used for the
  10260.    configurable protocol parameters.  They are defined in Appendix C.
  10261.  
  10262.    The name of each architectural constant follows, together with its
  10263.    value and a short description of its function.
  10264.  
  10265.    LSRefreshTime
  10266.       The maximum time between distinct originations of any particular
  10267.       LSA.  If the LS age field of one of the router's self-originated
  10268.       LSAs reaches the value LSRefreshTime, a new instance of the LSA is
  10269.       originated, even though the contents of the LSA (apart from the
  10270.       LSA header) will be the same.  The value of LSRefreshTime is set
  10271.       to 30 minutes.
  10272.  
  10273.    MinLSInterval
  10274.       The minimum time between distinct originations of any particular
  10275.       LSA.  The value of MinLSInterval is set to 5 seconds.
  10276.  
  10277.    MinLSArrival
  10278.       For any particular LSA, the minimum time that must elapse
  10279.       between reception of new LSA instances during flooding. LSA
  10280.       instances received at higher frequencies are discarded. The value
  10281.       of MinLSArrival is set to 1 second.
  10282.  
  10283.    MaxAge
  10284.       The maximum age that an LSA can attain. When an LSA's LS age field
  10285.       reaches MaxAge, it is reflooded in an attempt to flush the LSA
  10286.       from the routing domain (See Section 14). LSAs of age MaxAge are
  10287.       not used in the routing table calculation.  The value of MaxAge is
  10288.       set to 1 hour.
  10289.  
  10290.    CheckAge
  10291.       When the age of an LSA in the link state database hits a multiple
  10292.       of CheckAge, the LSA's checksum is verified.  An incorrect
  10293.       checksum at this time indicates a serious error.  The value of
  10294.       CheckAge is set to 5 minutes.
  10295.  
  10296.    MaxAgeDiff
  10297.       The maximum time dispersion that can occur, as an LSA is flooded
  10298.       throughout the AS.  Most of this time is accounted for by the LSAs
  10299.       sitting on router output queues (and therefore not aging) during
  10300.       the flooding process.  The value of MaxAgeDiff is set to 15
  10301.       minutes.
  10302.  
  10303.  
  10304.  
  10305.  
  10306. Moy                         Standards Track                   [Page 184]
  10307.  
  10308. RFC 2178                     OSPF Version 2                    July 1997
  10309.  
  10310.  
  10311.    LSInfinity
  10312.       The metric value indicating that the destination described by an
  10313.       LSA is unreachable. Used in summary-LSAs and AS-external-LSAs as
  10314.       an alternative to premature aging (see Section 14.1). It is
  10315.       defined to be the 24-bit binary value of all ones: 0xffffff.
  10316.  
  10317.    DefaultDestination
  10318.       The Destination ID that indicates the default route.  This route
  10319.       is used when no other matching routing table entry can be found.
  10320.       The default destination can only be advertised in AS-external-
  10321.       LSAs and in stub areas' type 3 summary-LSAs.  Its value is the IP
  10322.       address 0.0.0.0. Its associated Network Mask is also always
  10323.       0.0.0.0.
  10324.  
  10325.    InitialSequenceNumber
  10326.       The value used for LS Sequence Number when originating the first
  10327.       instance of any LSA. Its value is the signed 32-bit integer
  10328.       0x80000001.
  10329.  
  10330.    MaxSequenceNumber
  10331.       The maximum value that LS Sequence Number can attain.  Its value
  10332.       is the signed 32-bit integer 0x7fffffff.
  10333.  
  10334.  
  10335.  
  10336.  
  10337.  
  10338.  
  10339.  
  10340.  
  10341.  
  10342.  
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362. Moy                         Standards Track                   [Page 185]
  10363.  
  10364. RFC 2178                     OSPF Version 2                    July 1997
  10365.  
  10366.  
  10367. C. Configurable Constants
  10368.  
  10369.    The OSPF protocol has quite a few configurable parameters. These
  10370.    parameters are listed below.  They are grouped into general
  10371.    functional categories (area parameters, interface parameters, etc.).
  10372.    Sample values are given for some of the parameters.
  10373.  
  10374.    Some parameter settings need to be consistent among groups of
  10375.    routers.  For example, all routers in an area must agree on that
  10376.    area's parameters, and all routers attached to a network must agree
  10377.    on that network's IP network number and mask.
  10378.  
  10379.    Some parameters may be determined by router algorithms outside of
  10380.    this specification (e.g., the address of a host connected to the
  10381.    router via a SLIP line).  From OSPF's point of view, these items are
  10382.    still configurable.
  10383.  
  10384. C.1 Global parameters
  10385.  
  10386.    In general, a separate copy of the OSPF protocol is run for each
  10387.    area.  Because of this, most configuration parameters are defined on
  10388.    a per-area basis.  The few global configuration parameters are listed
  10389.    below.
  10390.  
  10391.    Router ID
  10392.        This is a 32-bit number that uniquely identifies the router in
  10393.        the Autonomous System.  One algorithm for Router ID assignment is
  10394.        to choose the largest or smallest IP address assigned to the
  10395.        router.  If a router's OSPF Router ID is changed, the router's
  10396.        OSPF software should be restarted before the new Router ID takes
  10397.        effect. Before restarting in order to change its Router ID, the
  10398.        router should flush its self-originated LSAs from the routing
  10399.        domain (see Section 14.1), or they will persist for up to MaxAge
  10400.        minutes.
  10401.  
  10402.    RFC1583Compatibility
  10403.        Controls the preference rules used in Section 16.4 when choosing
  10404.        among multiple AS-external-LSAs advertising the same destination.
  10405.        When set to "enabled", the preference rules remain those
  10406.        specified by RFC 1583 ([Ref9]). When set to "disabled", the
  10407.        preference rules are those stated in Section 16.4.1, which
  10408.        prevent routing loops when AS- external-LSAs for the same
  10409.        destination have been originated from different areas (see
  10410.        Section G.7). Set to "enabled" by default.
  10411.  
  10412.  
  10413.  
  10414.  
  10415.  
  10416.  
  10417.  
  10418. Moy                         Standards Track                   [Page 186]
  10419.  
  10420. RFC 2178                     OSPF Version 2                    July 1997
  10421.  
  10422.  
  10423.        In order to minimize the chance of routing loops, all OSPF
  10424.        routers in an OSPF routing domain should have
  10425.        RFC1583Compatibility set identically. When there are routers
  10426.        present that have not been updated with the functionality
  10427.        specified in Section 16.4.1 of this memo, all routers should have
  10428.        RFC1583Compatibility set to "enabled". Otherwise, all routers
  10429.        should have RFC1583Compatibility set to "disabled", preventing
  10430.        all routing loops.
  10431.  
  10432. C.2 Area parameters
  10433.  
  10434.    All routers belonging to an area must agree on that area's
  10435.    configuration.  Disagreements between two routers will lead to an
  10436.    inability for adjacencies to form between them, with a resulting
  10437.    hindrance to the flow of routing protocol and data traffic.  The
  10438.    following items must be configured for an area:
  10439.  
  10440.    Area ID
  10441.        This is a 32-bit number that identifies the area.  The Area ID of
  10442.        0.0.0.0 is reserved for the backbone.  If the area represents a
  10443.        subnetted network, the IP network number of the subnetted network
  10444.        may be used for the Area ID.
  10445.  
  10446.    List of address ranges
  10447.        An OSPF area is defined as a list of address ranges. Each address
  10448.        range consists of the following items:
  10449.  
  10450.        [IP address, mask]
  10451.            Describes the collection of IP addresses contained in the
  10452.            address range. Networks and hosts are assigned to an area
  10453.            depending on whether their addresses fall into one of the
  10454.            area's defining address ranges.  Routers are viewed as
  10455.            belonging to multiple areas, depending on their attached
  10456.            networks' area membership.
  10457.  
  10458.        Status  Set to either Advertise or DoNotAdvertise. Routing
  10459.            information is condensed at area boundaries.  External to the
  10460.            area, at most a single route is advertised (via a summary-
  10461.            LSA) for each address range. The route is advertised if and
  10462.            only if the address range's Status is set to Advertise.
  10463.            Unadvertised ranges allow the existence of certain networks
  10464.            to be intentionally hidden from other areas. Status is set to
  10465.            Advertise by default.
  10466.  
  10467.  
  10468.  
  10469.  
  10470.  
  10471.  
  10472.  
  10473.  
  10474. Moy                         Standards Track                   [Page 187]
  10475.  
  10476. RFC 2178                     OSPF Version 2                    July 1997
  10477.  
  10478.  
  10479.            As an example, suppose an IP subnetted network is to be its
  10480.            own OSPF area.  The area would be configured as a single
  10481.            address range, whose IP address is the address of the
  10482.            subnetted network, and whose mask is the natural class A, B,
  10483.            or C address mask. A single route would be advertised
  10484.            external to the area, describing the entire subnetted
  10485.            network.
  10486.  
  10487.        ExternalRoutingCapability
  10488.            Whether AS-external-LSAs will be flooded into/throughout the
  10489.            area.  If AS-external-LSAs are excluded from the area, the
  10490.            area is called a "stub".  Internal to stub areas, routing to
  10491.            external destinations will be based solely on a default
  10492.            summary route.  The backbone cannot be configured as a stub
  10493.            area.  Also, virtual links cannot be configured through stub
  10494.            areas.  For more information, see Section 3.6.
  10495.  
  10496.        StubDefaultCost
  10497.            If the area has been configured as a stub area, and the
  10498.            router itself is an area border router, then the
  10499.            StubDefaultCost indicates the cost of the default summary-LSA
  10500.            that the router should advertise into the area.
  10501.  
  10502. C.3 Router interface parameters
  10503.  
  10504.    Some of the configurable router interface parameters (such as IP
  10505.    interface address and subnet mask) actually imply properties of the
  10506.    attached networks, and therefore must be consistent across all the
  10507.    routers attached to that network.  The parameters that must be
  10508.    configured for a router interface are:
  10509.  
  10510.    IP interface address
  10511.        The IP protocol address for this interface.  This uniquely
  10512.        identifies the router over the entire internet.  An IP address is
  10513.        not required on point-to-point networks.  Such a point-to-point
  10514.        network is called "unnumbered".
  10515.  
  10516.    IP interface mask
  10517.        Also referred to as the subnet/network mask, this indicates the
  10518.        portion of the IP interface address that identifies the attached
  10519.        network.  Masking the IP interface address with the IP interface
  10520.        mask yields the IP network number of the attached network.  On
  10521.        point-to-point networks and virtual links, the IP interface mask
  10522.        is not defined. On these networks, the link itself is not
  10523.        assigned an IP network number, and so the addresses of each side
  10524.        of the link are assigned independently, if they are assigned at
  10525.        all.
  10526.  
  10527.  
  10528.  
  10529.  
  10530. Moy                         Standards Track                   [Page 188]
  10531.  
  10532. RFC 2178                     OSPF Version 2                    July 1997
  10533.  
  10534.  
  10535.    Area ID
  10536.        The OSPF area to which the attached network belongs.
  10537.  
  10538.    Interface output cost
  10539.        The cost of sending a packet on the interface, expressed in the
  10540.        link state metric.  This is advertised as the link cost for this
  10541.        interface in the router's router-LSA. The interface output cost
  10542.        must always be greater than 0.
  10543.  
  10544.    RxmtInterval
  10545.        The number of seconds between LSA retransmissions, for
  10546.        adjacencies belonging to this interface.  Also used when
  10547.        retransmitting Database Description and Link State Request
  10548.        Packets.  This should be well over the expected round-trip delay
  10549.        between any two routers on the attached network.  The setting of
  10550.        this value should be conservative or needless retransmissions
  10551.        will result.  Sample value for a local area network: 5 seconds.
  10552.  
  10553.    InfTransDelay
  10554.        The estimated number of seconds it takes to transmit a Link State
  10555.        Update Packet over this interface.  LSAs contained in the update
  10556.        packet must have their age incremented by this amount before
  10557.        transmission.  This value should take into account the
  10558.        transmission and propagation delays of the interface. It must be
  10559.        greater than 0.  Sample value for a local area network: 1 second.
  10560.  
  10561.    Router Priority
  10562.        An 8-bit unsigned integer. When two routers attached to a network
  10563.        both attempt to become Designated Router, the one with the
  10564.        highest Router Priority takes precedence. If there is still a
  10565.        tie, the router with the highest Router ID takes precedence.  A
  10566.        router whose Router Priority is set to 0 is ineligible to become
  10567.        Designated Router on the attached network.  Router Priority is
  10568.        only configured for interfaces to broadcast and NBMA networks.
  10569.  
  10570.    HelloInterval
  10571.        The length of time, in seconds, between the Hello Packets that
  10572.        the router sends on the interface.  This value is advertised in
  10573.        the router's Hello Packets.  It must be the same for all routers
  10574.        attached to a common network. The smaller the HelloInterval, the
  10575.        faster topological changes will be detected; however, more OSPF
  10576.        routing protocol traffic will ensue.  Sample value for a X.25 PDN
  10577.        network: 30 seconds.  Sample value for a local area network: 10
  10578.        seconds.
  10579.  
  10580.  
  10581.  
  10582.  
  10583.  
  10584.  
  10585.  
  10586. Moy                         Standards Track                   [Page 189]
  10587.  
  10588. RFC 2178                     OSPF Version 2                    July 1997
  10589.  
  10590.  
  10591.    RouterDeadInterval
  10592.        After ceasing to hear a router's Hello Packets, the number of
  10593.        seconds before its neighbors declare the router down.  This is
  10594.        also advertised in the router's Hello Packets in their
  10595.        RouterDeadInterval field.  This should be some multiple of the
  10596.        HelloInterval (say 4).  This value again must be the same for all
  10597.        routers attached to a common network.
  10598.  
  10599.    AuType
  10600.        Identifies the authentication procedure to be used on the
  10601.        attached network.  This value must be the same for all routers
  10602.        attached to the network.  See Appendix D for a discussion of the
  10603.        defined authentication types.
  10604.  
  10605.    Authentication key
  10606.        This configured data allows the authentication procedure to
  10607.        verify OSPF protocol packets received over the interface.  For
  10608.        example, if the AuType indicates simple password, the
  10609.        Authentication key would be a clear 64-bit password.
  10610.        Authentication keys associated with the other OSPF authentication
  10611.        types are discussed in Appendix D.
  10612.  
  10613. C.4 Virtual link parameters
  10614.  
  10615.    Virtual links are used to restore/increase connectivity of the
  10616.    backbone.  Virtual links may be configured between any pair of area
  10617.    border routers having interfaces to a common (non-backbone) area.
  10618.    The virtual link appears as an unnumbered point-to-point link in the
  10619.    graph for the backbone.  The virtual link must be configured in both
  10620.    of the area border routers.
  10621.  
  10622.    A virtual link appears in router-LSAs (for the backbone) as if it
  10623.    were a separate router interface to the backbone.  As such, it has
  10624.    all of the parameters associated with a router interface (see Section
  10625.    C.3).  Although a virtual link acts like an unnumbered point-to-point
  10626.    link, it does have an associated IP interface address.  This address
  10627.    is used as the IP source in OSPF protocol packets it sends along the
  10628.    virtual link, and is set dynamically during the routing table build
  10629.    process.  Interface output cost is also set dynamically on virtual
  10630.    links to be the cost of the intra-area path between the two routers.
  10631.    The parameter RxmtInterval must be configured, and should be well
  10632.    over the expected round-trip delay between the two routers.  This may
  10633.    be hard to estimate for a virtual link; it is better to err on the
  10634.    side of making it too large.  Router Priority is not used on virtual
  10635.    links.
  10636.  
  10637.  
  10638.  
  10639.  
  10640.  
  10641.  
  10642. Moy                         Standards Track                   [Page 190]
  10643.  
  10644. RFC 2178                     OSPF Version 2                    July 1997
  10645.  
  10646.  
  10647.    A virtual link is defined by the following two configurable
  10648.    parameters: the Router ID of the virtual link's other endpoint, and
  10649.    the (non-backbone) area through which the virtual link runs (referred
  10650.    to as the virtual link's Transit area).  Virtual links cannot be
  10651.    configured through stub areas.
  10652.  
  10653. C.5 NBMA network parameters
  10654.  
  10655.    OSPF treats an NBMA network much like it treats a broadcast network.
  10656.    Since there may be many routers attached to the network, a Designated
  10657.    Router is selected for the network.  This Designated Router then
  10658.    originates a network-LSA, which lists all routers attached to the
  10659.    NBMA network.
  10660.  
  10661.    However, due to the lack of broadcast capabilities, it may be
  10662.    necessary to use configuration parameters in the Designated Router
  10663.    selection.  These parameters will only need to be configured in those
  10664.    routers that are themselves eligible to become Designated Router
  10665.    (i.e., those router's whose Router Priority for the network is non-
  10666.    zero), and then only if no automatic procedure for discovering
  10667.    neighbors exists:
  10668.  
  10669.    List of all other attached routers
  10670.        The list of all other routers attached to the NBMA network.  Each
  10671.        router is listed by its IP interface address on the network.
  10672.        Also, for each router listed, that router's eligibility to become
  10673.        Designated Router must be defined.  When an interface to a NBMA
  10674.        network comes up, the router sends Hello Packets only to those
  10675.        neighbors eligible to become Designated Router, until the
  10676.        identity of the Designated Router is discovered.
  10677.  
  10678.    PollInterval
  10679.        If a neighboring router has become inactive (Hello Packets have
  10680.        not been seen for RouterDeadInterval seconds), it may still be
  10681.        necessary to send Hello Packets to the dead neighbor.  These
  10682.        Hello Packets will be sent at the reduced rate PollInterval,
  10683.        which should be much larger than HelloInterval.  Sample value for
  10684.        a PDN X.25 network: 2 minutes.
  10685.  
  10686. C.6 Point-to-MultiPoint network parameters
  10687.  
  10688.    On Point-to-MultiPoint networks, it may be necessary to configure the
  10689.    set of neighbors that are directly reachable over the Point-to-
  10690.    MultiPoint network. Each neighbor is identified by its IP address on
  10691.    the Point-to-MultiPoint network. Designated Routers are not elected
  10692.    on Point-to-MultiPoint networks, so the Designated Router eligibility
  10693.    of configured neighbors is undefined.
  10694.  
  10695.  
  10696.  
  10697.  
  10698. Moy                         Standards Track                   [Page 191]
  10699.  
  10700. RFC 2178                     OSPF Version 2                    July 1997
  10701.  
  10702.  
  10703.    Alternatively, neighbors on Point-to-MultiPoint networks may be
  10704.    dynamically discovered by lower-level protocols such as Inverse ARP
  10705.    ([Ref14]).
  10706.  
  10707. C.7 Host route parameters
  10708.  
  10709.    Host routes are advertised in router-LSAs as stub networks with mask
  10710.    0xffffffff.  They indicate either router interfaces to point-to-point
  10711.    networks, looped router interfaces, or IP hosts that are directly
  10712.    connected to the router (e.g., via a SLIP line). For each host
  10713.    directly connected to the router, the following items must be
  10714.    configured:
  10715.  
  10716.    Host IP address
  10717.        The IP address of the host.
  10718.  
  10719.    Cost of link to host
  10720.        The cost of sending a packet to the host, in terms of the link
  10721.        state metric. However, since the host probably has only a single
  10722.        connection to the internet, the actual configured cost in many
  10723.        cases is unimportant (i.e., will have no effect on routing).
  10724.  
  10725.    Area ID
  10726.        The OSPF area to which the host belongs.
  10727.  
  10728.  
  10729.  
  10730.  
  10731.  
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754. Moy                         Standards Track                   [Page 192]
  10755.  
  10756. RFC 2178                     OSPF Version 2                    July 1997
  10757.  
  10758.  
  10759. D. Authentication
  10760.  
  10761.    All OSPF protocol exchanges are authenticated.  The OSPF packet
  10762.    header (see Section A.3.1) includes an authentication type field, and
  10763.    64-bits of data for use by the appropriate authentication scheme
  10764.    (determined by the type field).
  10765.  
  10766.    The authentication type is configurable on a per-interface (or
  10767.    equivalently, on a per-network/subnet) basis.  Additional
  10768.    authentication data is also configurable on a per-interface basis.
  10769.  
  10770.    Authentication types 0, 1 and 2 are defined by this specification.
  10771.    All other authentication types are reserved for definition by the
  10772.    IANA (iana@ISI.EDU).  The current list of authentication types is
  10773.    described below in Table 20.
  10774.  
  10775.           AuType       Description
  10776.           ___________________________________________
  10777.           0            Null authentication
  10778.           1            Simple password
  10779.           2            Cryptographic authentication
  10780.           All others   Reserved for assignment by the
  10781.                        IANA (iana@ISI.EDU)
  10782.  
  10783.  
  10784.                   Table 20: OSPF authentication types.
  10785.  
  10786.  
  10787. D.1 Null authentication
  10788.  
  10789.    Use of this authentication type means that routing exchanges over the
  10790.    network/subnet are not authenticated. The 64-bit authentication field
  10791.    in the OSPF header can contain anything; it is not examined on packet
  10792.    reception. When employing Null authentication, the entire contents of
  10793.    each OSPF packet (other than the 64-bit authentication field) are
  10794.    checksummed in order to detect data corruption.
  10795.  
  10796. D.2 Simple password authentication
  10797.  
  10798.    Using this authentication type, a 64-bit field is configured on a
  10799.    per-network basis.  All packets sent on a particular network must
  10800.    have this configured value in their OSPF header 64-bit authentication
  10801.    field.  This essentially serves as a "clear" 64- bit password. In
  10802.    addition, the entire contents of each OSPF packet (other than the
  10803.    64-bit authentication field) are checksummed in order to detect data
  10804.    corruption.
  10805.  
  10806.  
  10807.  
  10808.  
  10809.  
  10810. Moy                         Standards Track                   [Page 193]
  10811.  
  10812. RFC 2178                     OSPF Version 2                    July 1997
  10813.  
  10814.  
  10815.    Simple password authentication guards against routers inadvertently
  10816.    joining the routing domain; each router must first be configured with
  10817.    its attached networks' passwords before it can participate in
  10818.    routing.  However, simple password authentication is vulnerable to
  10819.    passive attacks currently widespread in the Internet (see [Ref16]).
  10820.    Anyone with physical access to the network can learn the password and
  10821.    compromise the security of the OSPF routing domain.
  10822.  
  10823. D.3 Cryptographic authentication
  10824.  
  10825.    Using this authentication type, a shared secret key is configured in
  10826.    all routers attached to a common network/subnet.  For each OSPF
  10827.    protocol packet, the key is used to generate/verify a "message
  10828.    digest" that is appended to the end of the OSPF packet. The message
  10829.    digest is a one-way function of the OSPF protocol packet and the
  10830.    secret key. Since the secret key is never sent over the network in
  10831.    the clear, protection is provided against passive attacks.
  10832.  
  10833.    The algorithms used to generate and verify the message digest are
  10834.    specified implicitly by the secret key. This specification completely
  10835.    defines the use of OSPF Cryptographic authentication when the MD5
  10836.    algorithm is used.
  10837.  
  10838.    In addition, a non-decreasing sequence number is included in each
  10839.    OSPF protocol packet to protect against replay attacks.  This
  10840.    provides long term protection; however, it is still possible to
  10841.    replay an OSPF packet until the sequence number changes. To implement
  10842.    this feature, each neighbor data structure
  10843.  
  10844.         0                   1                   2                   3
  10845.         0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  10846.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10847.        |              0                |    Key ID     | Auth Data Len |
  10848.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10849.        |                 Cryptographic sequence number                 |
  10850.        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10851.  
  10852.               Figure 18: Usage of the Authentication field
  10853.               in the OSPF packet header when Cryptographic
  10854.                        Authentication is employed
  10855.  
  10856.    contains a new field called the "cryptographic sequence number".
  10857.    This field is initialized to zero, and is also set to zero whenever
  10858.    the neighbor's state transitions to "Down". Whenever an OSPF packet
  10859.    is accepted as authentic, the cryptographic sequence number is set to
  10860.    the received packet's sequence number.
  10861.  
  10862.  
  10863.  
  10864.  
  10865.  
  10866. Moy                         Standards Track                   [Page 194]
  10867.  
  10868. RFC 2178                     OSPF Version 2                    July 1997
  10869.  
  10870.  
  10871.    This specification does not provide a rollover procedure for the
  10872.    cryptographic sequence number. When the cryptographic sequence number
  10873.    that the router is sending hits the maximum value, the router should
  10874.    reset the cryptographic sequence number that it is sending back to 0.
  10875.    After this is done, the router's neighbors will reject the router's
  10876.    OSPF packets for a period of RouterDeadInterval, and then the router
  10877.    will be forced to reestablish all adjacencies over the interface.
  10878.    However, it is expected that many implementations will use "seconds
  10879.    since reboot" (or "seconds since 1960", etc.) as the cryptographic
  10880.    sequence number. Such a choice will essentially prevent rollover,
  10881.    since the cryptographic sequence number field is 32 bits in length.
  10882.  
  10883.    The OSPF Cryptographic authentication option does not provide
  10884.    confidentiality.
  10885.  
  10886.    When cryptographic authentication is used, the 64-bit Authentication
  10887.    field in the standard OSPF packet header is redefined as shown in
  10888.    Figure 18. The new field definitions are as follows:
  10889.  
  10890.    Key ID
  10891.        This field identifies the algorithm and secret key used to create
  10892.        the message digest appended to the OSPF packet. Key Identifiers
  10893.        are unique per-interface (or equivalently, per- subnet).
  10894.  
  10895.    Auth Data Len
  10896.        The length in bytes of the message digest appended to the OSPF
  10897.        packet.
  10898.  
  10899.    Cryptographic sequence number
  10900.        An unsigned 32-bit non-decreasing sequence number. Used to guard
  10901.        against replay attacks.
  10902.  
  10903.    The message digest appended to the OSPF packet is not actually
  10904.    considered part of the OSPF protocol packet: the message digest is
  10905.    not included in the OSPF header's packet length, although it is
  10906.    included in the packet's IP header length field.
  10907.  
  10908.    Each key is identified by the combination of interface and Key ID. An
  10909.    interface may have multiple keys active at any one time.  This
  10910.    enables smooth transition from one key to another. Each key has four
  10911.    time constants associated with it. These time constants can be
  10912.    expressed in terms of a time-of-day clock, or in terms of a router's
  10913.    local clock (e.g., number of seconds since last reboot):
  10914.  
  10915.    KeyStartAccept
  10916.        The time that the router will start accepting packets that
  10917.        have been created with the given key.
  10918.  
  10919.  
  10920.  
  10921.  
  10922. Moy                         Standards Track                   [Page 195]
  10923.  
  10924. RFC 2178                     OSPF Version 2                    July 1997
  10925.  
  10926.  
  10927.    KeyStartGenerate
  10928.        The time that the router will start using the key for packet
  10929.        generation.
  10930.  
  10931.    KeyStopGenerate
  10932.        The time that the router will stop using the key for packet
  10933.        generation.
  10934.  
  10935.    KeyStopAccept
  10936.        The time that the router will stop accepting packets that
  10937.        have been created with the given key.
  10938.  
  10939.    In order to achieve smooth key transition, KeyStartAccept should be
  10940.    less than KeyStartGenerate and KeyStopGenerate should be less than
  10941.    KeyStopAccept. If KeyStopGenerate and KeyStopAccept are left
  10942.    unspecified, the key's lifetime is infinite. When a new key replaces
  10943.    an old, the KeyStartGenerate time for the new key must be less than
  10944.    or equal to the KeyStopGenerate time of the old key.
  10945.  
  10946.    Key storage should persist across a system restart, warm or cold, to
  10947.    avoid operational issues. In the event that the last key associated
  10948.    with an interface expires, it is unacceptable to revert to an
  10949.    unauthenticated condition, and not advisable to disrupt routing.
  10950.    Therefore, the router should send a "last authentication key
  10951.    expiration" notification to the network manager and treat the key as
  10952.    having an infinite lifetime until the lifetime is extended, the key
  10953.    is deleted by network management, or a new key is configured.
  10954.  
  10955. D.4 Message generation
  10956.  
  10957.    After building the contents of an OSPF packet, the authentication
  10958.    procedure indicated by the sending interface's Autype value is called
  10959.    before the packet is sent. The authentication procedure modifies the
  10960.    OSPF packet as follows.
  10961.  
  10962. D.4.1 Generating Null authentication
  10963.  
  10964.    When using Null authentication, the packet is modified as follows:
  10965.  
  10966.    (1) The Autype field in the standard OSPF header is set to
  10967.        0.
  10968.  
  10969.  
  10970.  
  10971.  
  10972.  
  10973.  
  10974.  
  10975.  
  10976.  
  10977.  
  10978. Moy                         Standards Track                   [Page 196]
  10979.  
  10980. RFC 2178                     OSPF Version 2                    July 1997
  10981.  
  10982.  
  10983.    (2) The checksum field in the standard OSPF header is set to
  10984.        the standard IP checksum of the entire contents of the packet,
  10985.        starting with the OSPF packet header but excluding the 64-bit
  10986.        authentication field.  This checksum is calculated as the 16-bit
  10987.        one's complement of the one's complement sum of all the 16-bit
  10988.        words in the packet, excepting the authentication field.  If the
  10989.        packet's length is not an integral number of 16-bit words, the
  10990.        packet is padded with a byte of zero before checksumming.
  10991.  
  10992. D.4.2 Generating Simple password authentication
  10993.  
  10994.    When using Simple password authentication, the packet is modified as
  10995.    follows:
  10996.  
  10997.    (1) The Autype field in the standard OSPF header is set to 1.
  10998.  
  10999.    (2) The checksum field in the standard OSPF header is set to the
  11000.        standard IP checksum of the entire contents of the packet,
  11001.        starting with the OSPF packet header but excluding the 64-bit
  11002.        authentication field.  This checksum is calculated as the 16-bit
  11003.        one's complement of the one's complement sum of all the 16-bit
  11004.        words in the packet, excepting the authentication field.  If the
  11005.        packet's length is not an integral number of 16-bit words, the
  11006.        packet is padded with a byte of zero before checksumming.
  11007.  
  11008.    (3) The 64-bit authentication field in the OSPF packet header
  11009.        is set to the 64-bit password (i.e., authentication key) that has
  11010.        been configured for the interface.
  11011.  
  11012. D.4.3 Generating Cryptographic authentication
  11013.  
  11014.    When using Cryptographic authentication, there may be multiple keys
  11015.    configured for the interface. In this case, among the keys that are
  11016.    valid for message generation (i.e, that have KeyStartGenerate <=
  11017.    current time < KeyStopGenerate) choose the one with the most recent
  11018.    KeyStartGenerate time. Using this key, modify the packet as follows:
  11019.  
  11020.    (1) The Autype field in the standard OSPF header is set to
  11021.        2.
  11022.  
  11023.    (2) The checksum field in the standard OSPF header is not
  11024.        calculated, but is instead set to 0.
  11025.  
  11026.    (3) The Key ID (see Figure 18) is set to the chosen key's
  11027.        Key ID.
  11028.  
  11029.  
  11030.  
  11031.  
  11032.  
  11033.  
  11034. Moy                         Standards Track                   [Page 197]
  11035.  
  11036. RFC 2178                     OSPF Version 2                    July 1997
  11037.  
  11038.  
  11039.    (4) The Auth Data Len field is set to the length in bytes of
  11040.        the message digest that will be appended to the OSPF packet. When
  11041.        using MD5 as the authentication algorithm, Auth Data Len will be
  11042.        16.
  11043.  
  11044.    (5) The 32-bit Cryptographic sequence number (see Figure 18)
  11045.        is set to a non-decreasing value (i.e., a value at least as large
  11046.        as the last value sent out the interface).  The precise values to
  11047.        use in the cryptographic sequence number field are
  11048.        implementation-specific.  For example, it may be based on a
  11049.        simple counter, or be based on the system's clock.
  11050.  
  11051.    (6) The message digest is then calculated and appended to
  11052.        the OSPF packet.  The authentication algorithm to be used in
  11053.        calculating the digest is indicated by the key itself.  Input to
  11054.        the authentication algorithm consists of the OSPF packet and the
  11055.        secret key. When using MD5 as the authentication algorithm, the
  11056.        message digest calculation proceeds as follows:
  11057.  
  11058.           (a) The 16 byte MD5 key is appended to the OSPF packet.
  11059.  
  11060.           (b) Trailing pad and length fields are added, as specified in
  11061.               [Ref17].
  11062.  
  11063.           (c) The MD5 authentication algorithm is run over the
  11064.               concatenation of the OSPF packet, secret key, pad and
  11065.               length fields, producing a 16 byte message digest (see
  11066.               [Ref17]).
  11067.  
  11068.           (d) The MD5 digest is written over the OSPF key (i.e.,
  11069.               appended to the original OSPF packet). The digest is not
  11070.               counted in the OSPF packet's length field, but is included
  11071.               in the packet's IP length field. Any trailing pad or
  11072.               length fields beyond the digest are not counted or
  11073.               transmitted.
  11074.  
  11075. D.5 Message verification
  11076.  
  11077.    When an OSPF packet has been received on an interface, it must be
  11078.    authenticated. The authentication procedure is indicated by the
  11079.    setting of Autype in the standard OSPF packet header, which matches
  11080.    the setting of Autype for the receiving OSPF interface.
  11081.  
  11082.    If an OSPF protocol packet is accepted as authentic, processing of
  11083.    the packet continues as specified in Section 8.2. Packets which fail
  11084.    authentication are discarded.
  11085.  
  11086.  
  11087.  
  11088.  
  11089.  
  11090. Moy                         Standards Track                   [Page 198]
  11091.  
  11092. RFC 2178                     OSPF Version 2                    July 1997
  11093.  
  11094.  
  11095. D.5.1 Verifying Null authentication
  11096.  
  11097.    When using Null authentication, the checksum field in the OSPF header
  11098.    must be verified. It must be set to the 16-bit one's complement of
  11099.    the one's complement sum of all the 16-bit words in the packet,
  11100.    excepting the authentication field.  (If the packet's length is not
  11101.    an integral number of 16-bit words, the packet is padded with a byte
  11102.    of zero before checksumming.)
  11103.  
  11104. D.5.2 Verifying Simple password authentication
  11105.  
  11106.    When using Simple password authentication, the received OSPF packet
  11107.    is authenticated as follows:
  11108.  
  11109.        (1) The checksum field in the OSPF header must be verified.
  11110.            It must be set to the 16-bit one's complement of the
  11111.            one's complement sum of all the 16-bit words in the
  11112.            packet, excepting the authentication field.  (If the
  11113.            packet's length is not an integral number of 16-bit
  11114.            words, the packet is padded with a byte of zero before
  11115.            checksumming.)
  11116.  
  11117.        (2) The 64-bit authentication field in the OSPF packet
  11118.            header must be equal to the 64-bit password (i.e.,
  11119.            authentication key) that has been configured for the
  11120.            interface.
  11121.  
  11122. D.5.3 Verifying Cryptographic authentication
  11123.  
  11124.    When using Cryptographic authentication, the received OSPF packet is
  11125.    authenticated as follows:
  11126.  
  11127.        (1) Locate the receiving interface's configured key having
  11128.            Key ID equal to that specified in the received OSPF
  11129.            packet (see Figure 18). If the key is not found, or if
  11130.            the key is not valid for reception (i.e., current time <
  11131.            KeyStartAccept or current time >= KeyStopAccept), the
  11132.            OSPF packet is discarded.
  11133.  
  11134.        (2) If the cryptographic sequence number found in the OSPF
  11135.            header (see Figure 18) is less than the cryptographic
  11136.            sequence number recorded in the sending neighbor's data
  11137.            structure, the OSPF packet is discarded.
  11138.  
  11139.        (3) Verify the appended message digest in the following
  11140.            steps:
  11141.  
  11142.       (a) The received digest is set aside.
  11143.  
  11144.  
  11145.  
  11146. Moy                         Standards Track                   [Page 199]
  11147.  
  11148. RFC 2178                     OSPF Version 2                    July 1997
  11149.  
  11150.  
  11151.       (b) A new digest is calculated, as specified in Step 6
  11152.           of Section D.4.3.
  11153.  
  11154.       (c) The calculated and received digests are compared. If
  11155.           they do not match, the OSPF packet is discarded. If
  11156.           they do match, the OSPF protocol packet is accepted
  11157.           as authentic, and the "cryptographic sequence
  11158.           number" in the neighbor's data structure is set to
  11159.           the sequence number found in the packet's OSPF
  11160.           header.
  11161.  
  11162.  
  11163.  
  11164.  
  11165.  
  11166.  
  11167.  
  11168.  
  11169.  
  11170.  
  11171.  
  11172.  
  11173.  
  11174.  
  11175.  
  11176.  
  11177.  
  11178.  
  11179.  
  11180.  
  11181.  
  11182.  
  11183.  
  11184.  
  11185.  
  11186.  
  11187.  
  11188.  
  11189.  
  11190.  
  11191.  
  11192.  
  11193.  
  11194.  
  11195.  
  11196.  
  11197.  
  11198.  
  11199.  
  11200.  
  11201.  
  11202. Moy                         Standards Track                   [Page 200]
  11203.  
  11204. RFC 2178                     OSPF Version 2                    July 1997
  11205.  
  11206.  
  11207. E. An algorithm for assigning Link State IDs
  11208.  
  11209.    The Link State ID in AS-external-LSAs and summary-LSAs is usually set
  11210.    to the described network's IP address. However, if necessary one or
  11211.    more of the network's host bits may be set in the Link State ID.
  11212.    This allows the router to originate separate LSAs for networks having
  11213.    the same address, yet different masks. Such networks can occur in the
  11214.    presence of supernetting and subnet 0s (see [Ref10]).
  11215.  
  11216.    This appendix gives one possible algorithm for setting the host bits
  11217.    in Link State IDs. The choice of such an algorithm is a local
  11218.    decision. Separate routers are free to use different algorithms,
  11219.    since the only LSAs affected are the ones that the router itself
  11220.    originates. The only requirement on the algorithms used is that the
  11221.    network's IP address should be used as the Link State ID whenever
  11222.    possible; this maximizes interoperability with OSPF implementations
  11223.    predating RFC 1583.
  11224.  
  11225.    The algorithm below is stated for AS-external-LSAs.  This is only for
  11226.    clarity; the exact same algorithm can be used for summary-LSAs.
  11227.    Suppose that the router wishes to originate an AS-external-LSA for a
  11228.    network having address NA and mask NM1. The following steps are then
  11229.    used to determine the LSA's Link State ID:
  11230.  
  11231.     (1) Determine whether the router is already originating an AS-
  11232.         external-LSA with Link State ID equal to NA (in such an LSA the
  11233.         router itself will be listed as the LSA's Advertising Router).
  11234.         If not, the Link State ID is set equal to NA and the algorithm
  11235.         terminates. Otherwise,
  11236.  
  11237.     (2) Obtain the network mask from the body of the already existing
  11238.         AS-external-LSA. Call this mask NM2. There are then two cases:
  11239.  
  11240.         o   NM1 is longer (i.e., more specific) than NM2. In this case,
  11241.             set the Link State ID in the new LSA to be the network
  11242.             [NA,NM1] with all the host bits set (i.e., equal to NA or'ed
  11243.             together with all the bits that are not set in NM1, which is
  11244.             network [NA,NM1]'s broadcast address).
  11245.  
  11246.         o   NM2 is longer than NM1. In this case, change the existing
  11247.             LSA (having Link State ID of NA) to reference the new
  11248.             network [NA,NM1] by incrementing the sequence number,
  11249.             changing the mask in the body to NM1 and inserting the cost
  11250.             of the new network. Then originate a new LSA for the old
  11251.             network [NA,NM2], with Link State ID equal to NA or'ed
  11252.             together with the bits that are not set in NM2 (i.e.,
  11253.             network [NA,NM2]'s broadcast address).
  11254.  
  11255.  
  11256.  
  11257.  
  11258. Moy                         Standards Track                   [Page 201]
  11259.  
  11260. RFC 2178                     OSPF Version 2                    July 1997
  11261.  
  11262.  
  11263.    The above algorithm assumes that all masks are contiguous; this
  11264.    ensures that when two networks have the same address, one mask is
  11265.    more specific than the other. The algorithm also assumes that no
  11266.    network exists having an address equal to another network's broadcast
  11267.    address. Given these two assumptions, the above algorithm always
  11268.    produces unique Link State IDs. The above algorithm can also be
  11269.    reworded as follows: When originating an AS-external-LSA, try to use
  11270.    the network number as the Link State ID.  If that produces a
  11271.    conflict, examine the two networks in conflict. One will be a subset
  11272.    of the other. For the less specific network, use the network number
  11273.    as the Link State ID and for the more specific use the network's
  11274.    broadcast address instead (i.e., flip all the "host" bits to 1).  If
  11275.    the most specific network was originated first, this will cause you
  11276.    to originate two LSAs at once.
  11277.  
  11278.    As an example of the algorithm, consider its operation when the
  11279.    following sequence of events occurs in a single router (Router A).
  11280.  
  11281.     (1) Router A wants to originate an AS-external-LSA for
  11282.         [10.0.0.0,255.255.255.0]:
  11283.  
  11284.         (a) A Link State ID of 10.0.0.0 is used.
  11285.  
  11286.     (2) Router A then wants to originate an AS-external-LSA for
  11287.         [10.0.0.0,255.255.0.0]:
  11288.  
  11289.         (a) The LSA for [10.0.0,0,255.255.255.0] is reoriginated using a
  11290.             new Link State ID of 10.0.0.255.
  11291.  
  11292.         (b) A Link State ID of 10.0.0.0 is used for
  11293.             [10.0.0.0,255.255.0.0].
  11294.  
  11295.     (3) Router A then wants to originate an AS-external-LSA for
  11296.         [10.0.0.0,255.0.0.0]:
  11297.  
  11298.         (a) The LSA for [10.0.0.0,255.255.0.0] is reoriginated using a
  11299.             new Link State ID of 10.0.255.255.
  11300.  
  11301.         (b) A Link State ID of 10.0.0.0 is used for
  11302.             [10.0.0.0,255.0.0.0].
  11303.  
  11304.         (c) The network [10.0.0.0,255.255.255.0] keeps its Link State ID
  11305.             of 10.0.0.255.
  11306.  
  11307.  
  11308.  
  11309.  
  11310.  
  11311.  
  11312.  
  11313.  
  11314. Moy                         Standards Track                   [Page 202]
  11315.  
  11316. RFC 2178                     OSPF Version 2                    July 1997
  11317.  
  11318.  
  11319. F. Multiple interfaces to the same network/subnet
  11320.  
  11321.    There are at least two ways to support multiple physical interfaces
  11322.    to the same IP subnet. Both methods will interoperate with
  11323.    implementations of RFC 1583 (and of course this memo). The two
  11324.    methods are sketched briefly below. An assumption has been made that
  11325.    each interface has been assigned a separate IP address (otherwise,
  11326.    support for multiple interfaces is more of a link-level or ARP issue
  11327.    than an OSPF issue).
  11328.  
  11329.    Method 1:
  11330.      Run the entire OSPF functionality over both interfaces, sending and
  11331.      receiving hellos, flooding, supporting separate interface and
  11332.      neighbor FSMs for each interface, etc. When doing this all other
  11333.      routers on the subnet will treat the two interfaces as separate
  11334.      neighbors, since neighbors are identified (on broadcast and NBMA
  11335.      networks) by their IP address.
  11336.  
  11337.      Method 1 has the following disadvantages:
  11338.  
  11339.      (1) You increase the total number of neighbors and adjacencies.
  11340.  
  11341.      (2) You lose the bidirectionality test on both interfaces, since
  11342.          bidirectionality is based on Router ID.
  11343.  
  11344.      (3) You have to consider both interfaces together during the
  11345.          Designated Router election, since if you declare both to be
  11346.          DR simultaneously you can confuse the tie-breaker (which is
  11347.          Router ID).
  11348.  
  11349.    Method 2:
  11350.      Run OSPF over only one interface (call it the primary interface),
  11351.      but include both the primary and secondary interfaces in your
  11352.      Router-LSA.
  11353.  
  11354.      Method 2 has the following disadvantages:
  11355.  
  11356.      (1) You lose the bidirectionality test on the secondary
  11357.          interface.
  11358.  
  11359.      (2) When the primary interface fails, you need to promote the
  11360.          secondary interface to primary status.
  11361.  
  11362.  
  11363.  
  11364.  
  11365.  
  11366.  
  11367.  
  11368.  
  11369.  
  11370. Moy                         Standards Track                   [Page 203]
  11371.  
  11372. RFC 2178                     OSPF Version 2                    July 1997
  11373.  
  11374.  
  11375. G. Differences from RFC 1583
  11376.  
  11377.    This section documents the differences between this memo and RFC
  11378.    1583.  All differences are backward-compatible. Implementations of
  11379.    this memo and of RFC 1583 will interoperate.
  11380.  
  11381. G.1 Enhancements to OSPF authentication
  11382.  
  11383.    An additional OSPF authentication type has been added: the
  11384.    Cryptographic authentication type. This has been defined so that any
  11385.    arbitrary "Keyed Message Digest" algorithm can be used for packet
  11386.    authentication. Operation using the MD5 algorithm is completely
  11387.    specified (see Appendix D).
  11388.  
  11389.    A number of other changes were also made to OSPF packet
  11390.    authentication, affecting the following Sections:
  11391.  
  11392.    o   The authentication type is now specified per-interface,
  11393.        rather than per-area (Sections 6, 9, C.2 and C.3).
  11394.  
  11395.    o   The OSPF packet header checksum is now considered part of
  11396.        the authentication procedure, and so has been moved out of the
  11397.        packet send and receive logic (Sections 8.1 and 8.2) and into the
  11398.        description of authentication types (Appendix D).
  11399.  
  11400.    o   In Appendix D, sections detailing message generation and
  11401.        message verification have been added.
  11402.  
  11403.    o   For the OSPF Cryptographic authentication type, a discussion
  11404.        of key management, including the requirement for simultaneous
  11405.        support of multiple keys, key lifetimes and smooth key
  11406.        transition, has been added to Appendix D.
  11407.  
  11408. G.2 Addition of Point-to-MultiPoint interface
  11409.  
  11410.    This memo adds an additional method for running OSPF over non-
  11411.    broadcast networks: the Point-to-Multipoint network. To implement
  11412.    this addition, the language of RFC 1583 has been altered slightly.
  11413.    References to "multi-access" networks have been deleted. The term
  11414.    "non-broadcast networks" is now used to describe networks which can
  11415.    connect many routers, but which do not natively support
  11416.    broadcast/multicast (such as a public Frame relay network).  Over
  11417.    non-broadcast networks, there are two options for running OSPF:
  11418.    modelling them as "NBMA networks" or as "Point-to-MultiPoint
  11419.    networks".  NBMA networks require full mesh connectivity between
  11420.    routers; when employing NBMA networks in the presence of partial mesh
  11421.    connectivity, multiple NBMA networks must be configured, as described
  11422.    in [Ref15].  In contrast, Point-to-Multipoint networks have been
  11423.  
  11424.  
  11425.  
  11426. Moy                         Standards Track                   [Page 204]
  11427.  
  11428. RFC 2178                     OSPF Version 2                    July 1997
  11429.  
  11430.  
  11431.    designed to work simply and naturally when faced with partial mesh
  11432.    connectivity.
  11433.  
  11434.    The addition of Point-to-MultiPoint networks has impacted the text in
  11435.    many places, which are briefly summarized below:
  11436.  
  11437.    o   Section 2 describing the OSPF link-state database has been
  11438.        split into additional subsections, with one of the subsections
  11439.        (Section 2.1.1) describing the differing map representations of
  11440.        the two non-broadcast network options.  This subsection also
  11441.        contrasts the NBMA network and Point- to-MultiPoint network
  11442.        options, and describes the situations when one is preferable to
  11443.        the other.
  11444.  
  11445.    o   In contrast to NBMA networks, Point-to-MultiPoint networks
  11446.        have the following properties. Adjacencies are established
  11447.        between all neighboring routers (Sections 4, 7.1, 7.5, 9.5 and
  11448.        10.4). There is no Designated Router or Backup Designated Router
  11449.        for a Point-to-MultiPoint network (Sections 7.3 and 7.4). No
  11450.        network-LSA is originated for Point-to-MultiPoint networks
  11451.        (Sections 12.4.2 and A.4.3).  Router Priority is not configured
  11452.        for Point-to-MultiPoint interfaces, nor for neighbors on Point-
  11453.        to-MultiPoint networks (Sections C.3 and C.6).
  11454.  
  11455.    o   The Interface FSM for a Point-to-MultiPoint interface is
  11456.        identical to that used for point-to-point interfaces. Two states
  11457.        are possible: "Down" and "Point-to-Point" (Section 9.3).
  11458.  
  11459.    o   When originating a router-LSA, and Point-to-MultiPoint
  11460.        interface is reported as a collection of "point-to-point links"
  11461.        to all of the interface's adjacent neighbors, together with a
  11462.        single stub link advertising the interface's IP address with a
  11463.        cost of 0 (Section 12.4.1.4).
  11464.  
  11465.    o   When flooding out a non-broadcast interface (when either in
  11466.        NBMA or Point-to-MultiPoint mode) the Link State Update or Link
  11467.        State Acknowledgment packet must be replicated in order to be
  11468.        sent to each of the interface's neighbors (see Sections 13.3 and
  11469.        13.5).
  11470.  
  11471. G.3 Support for overlapping area ranges
  11472.  
  11473.    RFC 1583 requires that all networks falling into a given area range
  11474.    actually belong to a single area. This memo relaxes that restriction.
  11475.    This is useful in the following example. Suppose that [10.0.0.0,
  11476.    255.0.0.0] is carved up into subnets. Most of these subnets are
  11477.    assigned to a single OSPF area (call it Area X), while a few subnets
  11478.    are assigned to other areas. In order to get this configuration to
  11479.  
  11480.  
  11481.  
  11482. Moy                         Standards Track                   [Page 205]
  11483.  
  11484. RFC 2178                     OSPF Version 2                    July 1997
  11485.  
  11486.  
  11487.    work with RFC 1583, you must not summarize the subnets of Area X with
  11488.    the single range [10.0.0.0, 255.0.0.0], because then the subnets of
  11489.    10.0.0.0 belonging to other areas would become unreachable. However,
  11490.    with this memo you can summarize the subnets in Area X, provided that
  11491.    the subnets belonging to other areas are not summarized.
  11492.  
  11493.    Implementation details for this change can be found in Sections 11.1
  11494.    and 16.2.
  11495.  
  11496. G.4 A modification to the flooding algorithm
  11497.  
  11498.    The OSPF flooding algorithm has been modified as follows. When a Link
  11499.    State Update Packet is received that contains an LSA instance which
  11500.    is actually less recent than the the router's current database copy,
  11501.    the router will now in most cases respond by flooding back its
  11502.    database copy. This is in contrast to the RFC 1583 behavior, which
  11503.    was to simply throw the received LSA away.
  11504.  
  11505.    Detailed description of the change can be found in Step 8 of Section
  11506.    13.
  11507.  
  11508.    This change improves MaxAge processing. There are times when MaxAge
  11509.    LSAs stay in a router's database for extended intervals: 1) when they
  11510.    are stuck in a retransmission queue on a slow link or 2) when a
  11511.    router is not properly flushing them from its database, due to
  11512.    software bugs. The prolonged existence of these MaxAge LSAs can
  11513.    inhibit the flooding of new instances of the LSA. New instances
  11514.    typically start with LS sequence number equal to
  11515.    InitialSequenceNumber, and are treated as less recent (and hence were
  11516.    discarded according to RFC 1583) by routers still holding MaxAge
  11517.    instances. However, with the above change to flooding, a router
  11518.    holding a MaxAge instance will flood back the MaxAge instance. When
  11519.    this flood reaches the LSA's originator, it will then pick the next
  11520.    highest LS sequence number and reflood, overwriting the MaxAge
  11521.    instance.
  11522.  
  11523. G.5 Introduction of the MinLSArrival constant
  11524.  
  11525.    OSPF limits the frequency that new instances of any particular LSA
  11526.    can be accepted during flooding. This is extra protection, just in
  11527.    case a neighboring router is violating the mandated limit on LSA
  11528.    (re)originations (namely, one per LSA in any MinLSInterval).
  11529.  
  11530.  
  11531.  
  11532.  
  11533.  
  11534.  
  11535.  
  11536.  
  11537.  
  11538. Moy                         Standards Track                   [Page 206]
  11539.  
  11540. RFC 2178                     OSPF Version 2                    July 1997
  11541.  
  11542.  
  11543.    In RFC 1583, the frequency at which new LSA instances were accepted
  11544.    was also set equal to once every MinLSInterval seconds.  However, in
  11545.    some circumstances this led to unwanted link state retransmissions,
  11546.    even when the LSA originator was obeying the MinLSInterval limit on
  11547.    originations. This was due to either 1) choice of clock granularity
  11548.    in some OSPF implementations or 2) differing clock speed in
  11549.    neighboring routers.
  11550.  
  11551.    To alleviate this problem, the frequency at which new LSA instances
  11552.    are accepted during flooding has now been increased to once every
  11553.    MinLSArrival seconds, whose value is set to 1.  This change is
  11554.    reflected in Steps 5a and 5d of Section 13, and in Appendix B.
  11555.  
  11556. G.6 Optionally advertising point-to-point links as subnets
  11557.  
  11558.    When describing a point-to-point interface in its router-LSA, a
  11559.    router may now advertise a stub link to the point-to-point network's
  11560.    subnet. This is specified as an alternative to the RFC 1583 behavior,
  11561.    which is to advertise a stub link to the neighbor's IP address. See
  11562.    Sections 12.4.1 and 12.4.1.1 for details.
  11563.  
  11564. G.7 Advertising same external route from multiple areas
  11565.  
  11566.    This document fixes routing loops which can occur in RFC 1583 when
  11567.    the same external destination is advertised by AS boundary routers in
  11568.    separate areas. There are two manifestations of this problem. The
  11569.    first, discovered by Dennis Ferguson, occurs when an aggregated
  11570.    forwarding address is in use. In this case, the desirability of the
  11571.    forwarding address can change for the worse as a packet crosses an
  11572.    area aggregation boundary on the way to the forwarding address, which
  11573.    in turn can cause the preference of AS-external-LSAs to change,
  11574.    resulting in a routing loop.
  11575.  
  11576.    The second manifestation was discovered by Richard Woundy. It is
  11577.    caused by an incomplete application of OSPF's preference of intra-
  11578.    area routes over inter-area routes: paths to any given
  11579.    ASBR/forwarding address are selected first based on intra-area
  11580.    preference, while the comparison between separate ASBRs/forwarding
  11581.    addresses is driven only by cost, ignoring intra-area preference. His
  11582.    example is replicated in Figure 19.  Both router A3 and router B3 are
  11583.    originating an AS-external-LSA for 10.0.0.0/8, with the same type 2
  11584.    metric. Router A1 selects B1 as its next hop towards 10.0.0.0/8,
  11585.    based on shorter cost to ASBR B3 (via B1->B2->B3). However, the
  11586.    shorter route to B3 is not available to B1, due to B1's preference
  11587.    for the (higher cost) intra-area route to B3 through Area A. This
  11588.    leads B1 to select A1 as its next hop to 10.0.0.0/8, resulting in a
  11589.    routing loop.
  11590.  
  11591.  
  11592.  
  11593.  
  11594. Moy                         Standards Track                   [Page 207]
  11595.  
  11596. RFC 2178                     OSPF Version 2                    July 1997
  11597.  
  11598.  
  11599.    The following two changes have been made to prevent these routing
  11600.    loops:
  11601.  
  11602.    o   When originating a type 3 summary-LSA for a configured area
  11603.        address range, the cost of the summary-LSA is now set to the
  11604.        maximum cost of the range's component networks (instead of the
  11605.        previous algorithm which set the cost to the minimum component
  11606.        cost).  This change affects Sections 3.5 and 12.4.3, Figures 7
  11607.        and 8, and Tables 6 and 13.
  11608.  
  11609.    o   The preference rules for choosing among multiple AS-
  11610.        external-LSAs have been changed. Where previously cost was the
  11611.        only determining factor, now the preference is driven first by
  11612.        type of path (intra-area or inter-area, through non-backbone area
  11613.        or through backbone) to the ASBR/forwarding address, using cost
  11614.        only to break ties. This change affects Sections 16.4 and 16.4.1.
  11615.  
  11616.    After implementing this change, the example in Figure 19 is modified
  11617.    as follows. Router A1 now chooses A3 as the next
  11618.  
  11619.                               10.0.0.0/8
  11620.                               ----------
  11621.                                    |
  11622.                                 +----+
  11623.                                 | XX |
  11624.                                 +----+
  11625.                    RIP          /    \        RIP
  11626.            ---------------------      --------------------
  11627.            !                                             !
  11628.            !                                             !
  11629.          +----+      +----+       1       +----+......+----+....
  11630.          | A3 |------| A1 |---------------| B1 |------| B3 |   .
  11631.          +----+   6  +----+               +----+  8   +----+   .
  11632.                                            1|  .         /     .
  11633.                        OSPF backbone        |  .        /      .
  11634.                                           +----+  2    /       .
  11635.                                           | B2 |-------  Area A.
  11636.                                           +----+................
  11637.  
  11638.                 Figure 19: Example routing loop when the
  11639.             same external route is advertised from multiple
  11640.                                  areas
  11641.  
  11642.    hop to 10.0.0.0/8, while B1 chooses B3 as next hop. The reason for
  11643.    both choices is that ASBRs/forwarding addresses are now chosen based
  11644.    first on intra-area preference, and then by cost.
  11645.  
  11646.  
  11647.  
  11648.  
  11649.  
  11650. Moy                         Standards Track                   [Page 208]
  11651.  
  11652. RFC 2178                     OSPF Version 2                    July 1997
  11653.  
  11654.  
  11655.    Unfortunately, this change is not backward compatible. While the
  11656.    change prevents routing loops when all routers run the new preference
  11657.    rules, it can actually create routing loops when some routers are
  11658.    running the new preference rules and other routers implement RFC
  11659.    1583.  For this reason, a new configuration parameter has been added:
  11660.    RFC1583Compatibility. Only when RFC1583Compatibility is set to
  11661.    "disabled" will the new preference rules take effect. See Appendix C
  11662.    for more details.
  11663.  
  11664. G.8 Retransmission of initial Database Description packets
  11665.  
  11666.    This memo allows retransmission of initial Database Description
  11667.    packets, without resetting the state of the adjacency. In some
  11668.    environments, retransmission of the initial Database Description
  11669.    packet may be unavoidable. For example, the link delay incurred by a
  11670.    satellite link may exceed the value configured for an interface's
  11671.    RxmtInterval. In RFC 1583 such an environment prevents a full
  11672.    adjacency from ever forming.
  11673.  
  11674.    In this memo, changes have been made in the reception of Database
  11675.    Description packets so that retransmitted initial Database
  11676.    Description packets are treated identically to any other
  11677.    retransmitted Database Description packets. See Section 10.6 for
  11678.    details.
  11679.  
  11680. G.9 Detecting interface MTU mismatches
  11681.  
  11682.    When two neighboring routers have a different interface MTU for their
  11683.    common network segment, serious problems can ensue: large packets are
  11684.    prevented from being successfully transferred from one router to the
  11685.    other, impairing OSPF's flooding algorithm and possibly creating
  11686.    "black holes" for user data traffic.
  11687.  
  11688.    This memo provides a fix for the interface MTU mismatch problem by
  11689.    advertising the interface MTU in Database Description packets. When a
  11690.    router receives a Database description packet advertising an MTU
  11691.    larger than the router can receive, the router drops the Database
  11692.    Description packet. This prevents an adjacency from forming, telling
  11693.    OSPF flooding and user data traffic to avoid the connection between
  11694.    the two routers. For more information, see Sections 10.6, 10.8, and
  11695.    A.3.3.
  11696.  
  11697. G.10 Deleting the TOS routing option
  11698.  
  11699.    The TOS routing option has been deleted from OSPF. This action was
  11700.    required by the Internet standards process ([Ref24]), due to lack of
  11701.    implementation experience with OSPF's TOS routing.  However, for
  11702.    backward compatibility the formats of OSPF's various LSAs remain
  11703.  
  11704.  
  11705.  
  11706. Moy                         Standards Track                   [Page 209]
  11707.  
  11708. RFC 2178                     OSPF Version 2                    July 1997
  11709.  
  11710.  
  11711.    unchanged, maintaining the ability to specify TOS metrics in router-
  11712.    LSAs, summary-LSAs, ASBR-summary-LSAs, and AS-external-LSAs (see
  11713.    Sections 12.3, A.4.2, A.4.4, and A.4.5).
  11714.  
  11715.    To see OSPF's original TOS routing design, consult [Ref9].
  11716.  
  11717. Security Considerations
  11718.  
  11719.    All OSPF protocol exchanges are authenticated. OSPF supports multiple
  11720.    types of authentication; the type of authentication in use can be
  11721.    configured on a per network segment basis. One of OSPF's
  11722.    authentication types, namely the Cryptographic authentication option,
  11723.    is believed to be secure against passive attacks and provide
  11724.    significant protection against active attacks. When using the
  11725.    Cryptographic authentication option, each router appends a "message
  11726.    digest" to its transmitted OSPF packets. Receivers then use the
  11727.    shared secret key and received digest to verify that each received
  11728.    OSPF packet is authentic.
  11729.  
  11730.    The quality of the security provided by the Cryptographic
  11731.    authentication option depends completely on the strength of the
  11732.    message digest algorithm (MD5 is currently the only message digest
  11733.    algorithm specified), the strength of the key being used, and the
  11734.    correct implementation of the security mechanism in all communicating
  11735.    OSPF implementations. It also requires that all parties maintain the
  11736.    secrecy of the shared secret key.
  11737.  
  11738.    None of the OSPF authentication types provide confidentiality. Nor do
  11739.    they protect against traffic analysis. Key management is also not
  11740.    addressed by this memo.
  11741.  
  11742.    For more information, see Sections 8.1, 8.2, and Appendix D.
  11743.  
  11744.  
  11745.  
  11746.  
  11747.  
  11748.  
  11749.  
  11750.  
  11751.  
  11752.  
  11753.  
  11754.  
  11755.  
  11756.  
  11757.  
  11758.  
  11759.  
  11760.  
  11761.  
  11762. Moy                         Standards Track                   [Page 210]
  11763.  
  11764. RFC 2178                     OSPF Version 2                    July 1997
  11765.  
  11766.  
  11767. Author's Address
  11768.  
  11769.    John Moy
  11770.    Cascade Communications Corp.
  11771.    5 Carlisle Road
  11772.    Westford, MA 01886
  11773.  
  11774.    Phone: 508-952-1367
  11775.    Fax:   508-692-9214
  11776.    Email: jmoy@casc.com
  11777.  
  11778.  
  11779.  
  11780.  
  11781.  
  11782.  
  11783.  
  11784.  
  11785.  
  11786.  
  11787.  
  11788.  
  11789.  
  11790.  
  11791.  
  11792.  
  11793.  
  11794.  
  11795.  
  11796.  
  11797.  
  11798.  
  11799.  
  11800.  
  11801.  
  11802.  
  11803.  
  11804.  
  11805.  
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.  
  11812.  
  11813.  
  11814.  
  11815.  
  11816.  
  11817.  
  11818. Moy                         Standards Track                   [Page 211]
  11819.  
  11820.