home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 1100s / rfc1163.txt < prev    next >
Text File  |  1990-06-19  |  68KB  |  1,627 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                        K. Lougheed
  8. Request for Comments: 1163                                 cisco Systems
  9. Obsoletes: RFC 1105                                           Y. Rekhter
  10.                                    T.J. Watson Research Center, IBM Corp
  11.                                                                June 1990
  12.  
  13.  
  14.                     A Border Gateway Protocol (BGP)
  15.  
  16. Status of this Memo
  17.  
  18.    This RFC, together with its companion RFC-1164, "Application of the
  19.    Border Gateway Protocol in the Internet", define a Proposed Standard
  20.    for an inter-autonomous system routing protocol for the Internet.
  21.  
  22.    This protocol, like any other at this initial stage, may undergo
  23.    modifications before reaching full Internet Standard status as a
  24.    result of deployment experience.  Implementers are encouraged to
  25.    track the progress of this or any protocol as it moves through the
  26.    standardization process, and to report their own experience with the
  27.    protocol.
  28.  
  29.    This protocol is being considered by the Interconnectivity Working
  30.    Group (IWG) of the Internet Engineering Task Force (IETF).
  31.    Information about the progress of BGP can be monitored and/or
  32.    reported on the IWG mailing list (IWG@nri.reston.va.us).
  33.  
  34.    Please refer to the latest edition of the "IAB Official Protocol
  35.    Standards" RFC for current information on the state and status of
  36.    standard Internet protocols.
  37.  
  38.    Distribution of this memo is unlimited.
  39.  
  40. Table of Contents
  41.  
  42.       1.  Acknowledgements......................................    2
  43.       2.  Introduction..........................................    2
  44.       3.  Summary of Operation..................................    4
  45.       4.  Message Formats.......................................    5
  46.       4.1 Message Header Format.................................    5
  47.       4.2 OPEN Message Format...................................    6
  48.       4.3 UPDATE Message Format.................................    8
  49.       4.4 KEEPALIVE Message Format..............................   10
  50.       4.5 NOTIFICATION Message Format...........................   10
  51.       5.  Path Attributes.......................................   12
  52.       6.  BGP Error Handling....................................   14
  53.       6.1 Message Header error handling.........................   14
  54.       6.2 OPEN message error handling...........................   15
  55.  
  56.  
  57.  
  58. Lougheed & Rekhter                                              [Page 1]
  59.  
  60. RFC 1163                          BGP                          June 1990
  61.  
  62.  
  63.       6.3 UPDATE message error handling.........................   16
  64.       6.4 NOTIFICATION message error handling...................   17
  65.       6.5 Hold Timer Expired error handling.....................   17
  66.       6.6 Finite State Machine error handling...................   18
  67.       6.7 Cease.................................................   18
  68.       7.  BGP Version Negotiation...............................   18
  69.       8.  BGP Finite State machine..............................   18
  70.       9.  UPDATE Message Handling...............................   22
  71.       10. Detection of Inter-AS Policy Contradictions...........   23
  72.       Appendix 1.  BGP FSM State Transitions and Actions........   25
  73.       Appendix 2.  Comparison with RFC 1105.....................   28
  74.       Appendix 3.  TCP options that may be used with BGP........   28
  75.       References................................................   29
  76.       Security Considerations...................................   29
  77.       Authors' Addresses........................................   29
  78.  
  79. 1.  Acknowledgements
  80.  
  81.    We would like to express our thanks to Guy Almes (Rice University),
  82.    Len Bosack (cisco Systems), Jeffrey C. Honig (Cornell Theory Center)
  83.    and all members of the Interconnectivity Working Group of the
  84.    Internet Engineering Task Force, chaired by Guy Almes, for their
  85.    contributions to this document.
  86.  
  87.    We would also like to thank Bob Hinden, Director for Routing of the
  88.    Internet Engineering Steering Group, and the team of reviewers he
  89.    assembled to review earlier versions of this document.  This team,
  90.    consisting of Deborah Estrin, Milo Medin, John Moy, Radia Perlman,
  91.    Martha Steenstrup, Mike St. Johns, and Paul Tsuchiya, acted with a
  92.    strong combination of toughness, professionalism, and courtesy.
  93.  
  94. 2.  Introduction
  95.  
  96.    The Border Gateway Protocol (BGP) is an inter-Autonomous System
  97.    routing protocol.  It is built on experience gained with EGP as
  98.    defined in RFC 904 [1] and EGP usage in the NSFNET Backbone as
  99.    described in RFC 1092 [2] and RFC 1093 [3].
  100.  
  101.    The primary function of a BGP speaking system is to exchange network
  102.    reachability information with other BGP systems.  This network
  103.    reachability information includes information on the full path of
  104.    Autonomous Systems (ASs) that traffic must transit to reach these
  105.    networks.  This information is sufficient to construct a graph of AS
  106.    connectivity from which routing loops may be pruned and some policy
  107.    decisions at the AS level may be enforced.
  108.  
  109.    To characterize the set of policy decisions that can be enforced
  110.    using BGP, one must focus on the rule that an AS advertize to its
  111.  
  112.  
  113.  
  114. Lougheed & Rekhter                                              [Page 2]
  115.  
  116. RFC 1163                          BGP                          June 1990
  117.  
  118.  
  119.    neighbor ASs only those routes that it itself uses.  This rule
  120.    reflects the "hop-by-hop" routing paradigm generally used throughout
  121.    the current Internet.  Note that some policies cannot be supported by
  122.    the "hop-by-hop" routing paradigm and thus require techniques such as
  123.    source routing to enforce.  For example, BGP does not enable one AS
  124.    to send traffic to a neighbor AS intending that that traffic take a
  125.    different route from that taken by traffic originating in the
  126.    neighbor AS.  On the other hand, BGP can support any policy
  127.    conforming to the "hop-by-hop" routing paradigm.  Since the current
  128.    Internet uses only the "hop-by-hop" routing paradigm and since BGP
  129.    can support any policy that conforms to that paradigm, BGP is highly
  130.    applicable as an inter-AS routing protocol for the current Internet.
  131.  
  132.    A more complete discussion of what policies can and cannot be
  133.    enforced with BGP is outside the scope of this document (but refer to
  134.    the companion document discussing BGP usage [5]).
  135.  
  136.    BGP runs over a reliable transport protocol.  This eliminates the
  137.    need to implement explicit update fragmentation, retransmission,
  138.    acknowledgement, and sequencing.  Any authentication scheme used by
  139.    the transport protocol may be used in addition to BGP's own
  140.    authentication mechanisms.  The error notification mechanism used in
  141.    BGP assumes that the transport protocol supports a "graceful" close,
  142.    i.e., that all outstanding data will be delivered before the
  143.    connection is closed.
  144.  
  145.    BGP uses TCP [4] as its transport protocol.  TCP meets BGP's
  146.    transport requirements and is present in virtually all commercial
  147.    routers and hosts.  In the following descriptions the phrase
  148.    "transport protocol connection" can be understood to refer to a TCP
  149.    connection.  BGP uses TCP port 179 for establishing its connections.
  150.  
  151.    This memo uses the term `Autonomous System' (AS) throughout.  The
  152.    classic definition of an Autonomous System is a set of routers under
  153.    a single technical administration, using an interior gateway protocol
  154.    and common metrics to route packets within the AS, and using an
  155.    exterior gateway protocol to route packets to other ASs.  Since this
  156.    classic definition was developed, it has become common for a single
  157.    AS to use several interior gateway protocols and sometimes several
  158.    sets of metrics within an AS.  The use of the term Autonomous System
  159.    here stresses the fact that, even when multiple IGPs and metrics are
  160.    used, the administration of an AS appears to other ASs to have a
  161.    single coherent interior routing plan and presents a consistent
  162.    picture of what networks are reachable through it.  From the
  163.    standpoint of exterior routing, an AS can be viewed as monolithic:
  164.    reachability to networks directly connected to the AS must be
  165.    equivalent from all border gateways of the AS.
  166.  
  167.  
  168.  
  169.  
  170. Lougheed & Rekhter                                              [Page 3]
  171.  
  172. RFC 1163                          BGP                          June 1990
  173.  
  174.  
  175.    The planned use of BGP in the Internet environment, including such
  176.    issues as topology, the interaction between BGP and IGPs, and the
  177.    enforcement of routing policy rules is presented in a companion
  178.    document [5].  This document is the first of a series of documents
  179.    planned to explore various aspects of BGP application.
  180.  
  181. 3.  Summary of Operation
  182.  
  183.    Two systems form a transport protocol connection between one another.
  184.    They exchange messages to open and confirm the connection parameters.
  185.    The initial data flow is the entire BGP routing table.  Incremental
  186.    updates are sent as the routing tables change.  BGP does not require
  187.    periodic refresh of the entire BGP routing table.  Therefore, a BGP
  188.    speaker must retain the current version of the entire BGP routing
  189.    tables of all of its peers for the duration of the connection.
  190.    KeepAlive messages are sent periodically to ensure the liveness of
  191.    the connection.  Notification messages are sent in response to errors
  192.    or special conditions.  If a connection encounters an error
  193.    condition, a notification message is sent and the connection is
  194.    closed.
  195.  
  196.    The hosts executing the Border Gateway Protocol need not be routers.
  197.    A non-routing host could exchange routing information with routers
  198.    via EGP or even an interior routing protocol.  That non-routing host
  199.    could then use BGP to exchange routing information with a border
  200.    router in another Autonomous System.  The implications and
  201.    applications of this architecture are for further study.
  202.  
  203.    If a particular AS has multiple BGP speakers and is providing transit
  204.    service for other ASs, then care must be taken to ensure a consistent
  205.    view of routing within the AS.  A consistent view of the interior
  206.    routes of the AS is provided by the interior routing protocol.  A
  207.    consistent view of the routes exterior to the AS can be provided by
  208.    having all BGP speakers within the AS maintain direct BGP connections
  209.    with each other.  Using a common set of policies, the BGP speakers
  210.    arrive at an agreement as to which border routers will serve as
  211.    exit/entry points for particular networks outside the AS.  This
  212.    information is communicated to the AS's internal routers, possibly
  213.    via the interior routing protocol.  Care must be taken to ensure that
  214.    the interior routers have all been updated with transit information
  215.    before the BGP speakers announce to other ASs that transit service is
  216.    being provided.
  217.  
  218.    Connections between BGP speakers of different ASs are referred to as
  219.    "external" links.  BGP connections between BGP speakers within the
  220.    same AS are referred to as "internal" links.
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Lougheed & Rekhter                                              [Page 4]
  227.  
  228. RFC 1163                          BGP                          June 1990
  229.  
  230.  
  231. 4.  Message Formats
  232.  
  233.    This section describes message formats used by BGP.
  234.  
  235.    Messages are sent over a reliable transport protocol connection.  A
  236.    message is processed only after it is entirely received.  The maximum
  237.    message size is 4096 octets.  All implementations are required to
  238.    support this maximum message size.  The smallest message that may be
  239.    sent consists of a BGP header without a data portion, or 19 octets.
  240.  
  241. 4.1 Message Header Format
  242.  
  243.    Each message has a fixed-size header.  There may or may not be a data
  244.    portion following the header, depending on the message type.  The
  245.    layout of these fields is shown below:
  246.  
  247.     0                   1                   2                   3
  248.     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
  249.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  250.    |                                                               |
  251.    +                                                               +
  252.    |                                                               |
  253.    +                                                               +
  254.    |                           Marker                              |
  255.    +                                                               +
  256.    |                                                               |
  257.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  258.    |          Length               |      Type     |
  259.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  260.  
  261.    Marker:
  262.  
  263.       This 16-octet field contains a value that the receiver of the
  264.       message can predict.  If the Type of the message is OPEN, or if
  265.       the Authentication Code used in the OPEN message of the connection
  266.       is zero, then the Marker must be all ones.  Otherwise, the value
  267.       of the marker can be predicted by some a computation specified as
  268.       part of the authentication mechanism used.  The Marker can be used
  269.       to detect loss of synchronization between a pair of BGP peers, and
  270.       to authenticate incoming BGP messages.
  271.  
  272.    Length:
  273.  
  274.       This 2-octet unsigned integer indicates the total length of the
  275.       message, including the header, in octets.  Thus, e.g., it allows
  276.       one to locate in the transport-level stream the (Marker field of
  277.       the) next message.  The value of the Length field must always be
  278.       at least 19 and no greater than 4096, and may be further
  279.  
  280.  
  281.  
  282. Lougheed & Rekhter                                              [Page 5]
  283.  
  284. RFC 1163                          BGP                          June 1990
  285.  
  286.  
  287.       constrained, depending on the message type.  No "padding" of extra
  288.       data after the message is allowed, so the Length field must have
  289.       the smallest value required given the rest of the message.
  290.  
  291.    Type:
  292.  
  293.       This 1-octet unsigned integer indicates the type code of the
  294.       message.  The following type codes are defined:
  295.  
  296.                            1 - OPEN
  297.                            2 - UPDATE
  298.                            3 - NOTIFICATION
  299.                            4 - KEEPALIVE
  300.  
  301. 4.2 OPEN Message Format
  302.  
  303.    After a transport protocol connection is established, the first
  304.    message sent by each side is an OPEN message.  If the OPEN message is
  305.    acceptable, a KEEPALIVE message confirming the OPEN is sent back.
  306.    Once the OPEN is confirmed, UPDATE, KEEPALIVE, and NOTIFICATION
  307.    messages may be exchanged.
  308.  
  309.    In addition to the fixed-size BGP header, the OPEN message contains
  310.    the following fields:
  311.  
  312.      0                   1                   2                   3
  313.      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
  314.     +-+-+-+-+-+-+-+-+
  315.     |    Version    |
  316.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  317.     |     My Autonomous System      |
  318.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  319.     |           Hold Time           |
  320.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  321.     |  Auth. Code   |
  322.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  323.     |                                                               |
  324.     |                       Authentication Data                     |
  325.     |                                                               |
  326.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  327.  
  328.    Version:
  329.  
  330.       This 1-octet unsigned integer indicates the protocol version
  331.       number of the message.  The current BGP version number is 2.
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Lougheed & Rekhter                                              [Page 6]
  339.  
  340. RFC 1163                          BGP                          June 1990
  341.  
  342.  
  343.    My Autonomous System:
  344.  
  345.       This 2-octet unsigned integer indicates the Autonomous System
  346.       number of the sender.
  347.  
  348.    Hold Time:
  349.  
  350.       This 2-octet unsigned integer indicates the maximum number of
  351.       seconds that may elapse between the receipt of successive
  352.       KEEPALIVE and/or UPDATE and/or NOTIFICATION messages.
  353.  
  354.    Authentication Code:
  355.  
  356.       This 1-octet unsigned integer indicates the authentication
  357.       mechanism being used.  Whenever an authentication mechanism is
  358.       specified for use within BGP, three things must be included in the
  359.       specification:
  360.          - the value of the Authentication Code which indicates use of
  361.          the mechanism,
  362.          - the form and meaning of the Authentication Data, and
  363.          - the algorithm for computing values of Marker fields.
  364.       Only one authentication mechanism is specified as part of this
  365.       memo:
  366.          - its Authentication Code is zero,
  367.          - its Authentication Data must be empty (of zero length), and
  368.          - the Marker fields of all messages must be all ones.
  369.       The semantics of non-zero Authentication Codes lies outside the
  370.       scope of this memo.
  371.  
  372.       Note that a separate authentication mechanism may be used in
  373.       establishing the transport level connection.
  374.  
  375.    Authentication Data:
  376.  
  377.       The form and meaning of this field is a variable-length field
  378.       depend on the Authentication Code.  If the value of Authentication
  379.       Code field is zero, the Authentication Data field must have zero
  380.       length.  The semantics of the non-zero length Authentication Data
  381.       field is outside the scope of this memo.
  382.  
  383.       Note that the length of the Authentication Data field can be
  384.       determined from the message Length field by the formula:
  385.  
  386.          Message Length = 25 + Authentication Data Length
  387.  
  388.       The minimum length of the OPEN message is 25 octets (including
  389.       message header).
  390.  
  391.  
  392.  
  393.  
  394. Lougheed & Rekhter                                              [Page 7]
  395.  
  396. RFC 1163                          BGP                          June 1990
  397.  
  398.  
  399. 4.3 UPDATE Message Format
  400.  
  401.    UPDATE messages are used to transfer routing information between BGP
  402.    peers.  The information in the UPDATE packet can be used to construct
  403.    a graph describing the relationships of the various Autonomous
  404.    Systems.  By applying rules to be discussed, routing information
  405.    loops and some other anomalies may be detected and removed from
  406.    inter-AS routing.
  407.  
  408.    In addition to the fixed-size BGP header, the UPDATE message contains
  409.    the following fields (note that all fields may have arbitrary
  410.    alignment):
  411.  
  412.      0                   1                   2                   3
  413.      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
  414.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  415.     |  Total Path Attributes Length |
  416.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  417.     |                                                               |
  418.     /                      Path Attributes                          /
  419.     /                                                               /
  420.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  421.     |                       Network 1                               |
  422.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  423.     /                                                               /
  424.     /                                                               /
  425.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  426.     |                       Network n                               |
  427.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  428.  
  429.    Total Path Attribute Length:
  430.  
  431.       This 2-octet unsigned integer indicates the total length of the
  432.       Path Attributes field in octets.  Its value must allow the (non-
  433.       negative integer) number of Network fields to be determined as
  434.       specified below.
  435.  
  436.    Path Attributes:
  437.  
  438.       A variable length sequence of path attributes is present in every
  439.       UPDATE.  Each path attribute is a triple <attribute type,
  440.       attribute length, attribute value> of variable length.
  441.  
  442.       Attribute Type is a two-octet field that consists of the Attribute
  443.       Flags octet followed by the Attribute Type Code octet.
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Lougheed & Rekhter                                              [Page 8]
  451.  
  452. RFC 1163                          BGP                          June 1990
  453.  
  454.  
  455.        0                   1
  456.        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  457.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  458.       |  Attr. Flags  |Attr. Type Code|
  459.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  460.  
  461.       The high-order bit (bit 0) of the Attribute Flags octet is the
  462.       Optional bit.  It defines whether the attribute is optional (if
  463.       set to 1) or well-known (if set to 0).
  464.  
  465.       The second high-order bit (bit 1) of the Attribute Flags octet is
  466.       the Transitive bit.  It defines whether an optional attribute is
  467.       transitive (if set to 1) or non-transitive (if set to 0).  For
  468.       well-known attributes, the Transitive bit must be set to 1.  (See
  469.       Section 5 for a discussion of transitive attributes.)
  470.  
  471.       The third high-order bit (bit 2) of the Attribute Flags octet is
  472.       the Partial bit.  It defines whether the information contained in
  473.       the optional transitive attribute is partial (if set to 1) or
  474.       complete (if set to 0).  For well-known attributes and for
  475.       optional non-transitive attributes the Partial bit must be set to
  476.       0.
  477.  
  478.       The fourth high-order bit (bit 3) of the Attribute Flags octet is
  479.       the Extended Length bit.  It defines whether the Attribute Length
  480.       is one octet (if set to 0) or two octets (if set to 1).  Extended
  481.       Length may be used only if the length of the attribute value is
  482.       greater than 255 octets.
  483.  
  484.       The lower-order four bits of the Attribute Flags octet are unused.
  485.       They must be zero (and should be ignored when received).
  486.  
  487.       The Attribute Type Code octet contains the Attribute Type Code.
  488.       Currently defined Attribute Type Codes are discussed in Section 5.
  489.  
  490.       If the Extended Length bit of the Attribute Flags octet is set to
  491.       0, the third octet of the Path Attribute contains the length of
  492.       the attribute data in octets.
  493.  
  494.       If the Extended Length bit of the Attribute Flags octet is set to
  495.       1, then the third and the fourth octets of the path attribute
  496.       contain the length of the attribute data in octets.
  497.  
  498.       The remaining octets of the Path Attribute represent the attribute
  499.       value and are interpreted according to the Attribute Flags and the
  500.       Attribute Type Code.
  501.  
  502.       The meaning and handling of Path Attributes is discussed in
  503.  
  504.  
  505.  
  506. Lougheed & Rekhter                                              [Page 9]
  507.  
  508. RFC 1163                          BGP                          June 1990
  509.  
  510.  
  511.       Section 5.
  512.  
  513.    Network:
  514.  
  515.       Each 4-octet Internet network number indicates one network whose
  516.       Inter-Autonomous System routing is described by the Path
  517.       Attributes.  Subnets and host addresses are specifically not
  518.       allowed.  The total number of Network fields in the UPDATE message
  519.       can be determined by the formula:
  520.  
  521.          Message Length = 19 + Total Path Attribute Length + 4 * #Nets
  522.  
  523.       The message Length field of the message header and the Path
  524.       Attributes Length field of the UPDATE message must be such that
  525.       the formula results in a non-negative integer number of Network
  526.       fields.
  527.  
  528.    The minimum length of the UPDATE message is 37 octets (including
  529.    message header).
  530.  
  531. 4.4 KEEPALIVE Message Format
  532.  
  533.    BGP does not use any transport protocol-based keep-alive mechanism to
  534.    determine if peers are reachable.  Instead, KEEPALIVE messages are
  535.    exchanged between peers often enough as not to cause the hold time
  536.    (as advertised in the OPEN message) to expire.  A reasonable maximum
  537.    time between KEEPALIVE messages would be one third of the Hold Time
  538.    interval.
  539.  
  540.    KEEPALIVE message consists of only message header and has a length of
  541.    19 octets.
  542.  
  543. 4.5 NOTIFICATION Message Format
  544.  
  545.    A NOTIFICATION message is sent when an error condition is detected.
  546.    The BGP connection is closed immediately after sending it.
  547.  
  548.    In addition to the fixed-size BGP header, the NOTIFICATION message
  549.    contains the following fields:
  550.  
  551.      0                   1                   2                   3
  552.      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
  553.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  554.     | Error code    | Error subcode |           Data                |
  555.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
  556.     |                                                               |
  557.     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  558.  
  559.  
  560.  
  561.  
  562. Lougheed & Rekhter                                             [Page 10]
  563.  
  564. RFC 1163                          BGP                          June 1990
  565.  
  566.  
  567.    Error Code:
  568.  
  569.       This 1-octet unsigned integer indicates the type of NOTIFICATION.
  570.       The following Error Codes have been defined:
  571.  
  572.            Error Code       Symbolic Name               Reference
  573.  
  574.              1         Message Header Error             Section 6.1
  575.              2         OPEN Message Error               Section 6.2
  576.              3         UPDATE Message Error             Section 6.3
  577.              4         Hold Timer Expired               Section 6.5
  578.              5         Finite State Machine Error       Section 6.6
  579.              6         Cease                            Section 6.7
  580.  
  581.    Error subcode:
  582.  
  583.       This 1-octet unsigned integer provides more specific information
  584.       about the nature of the reported error.  Each Error Code may have
  585.       one or more Error Subcodes associated with it.  If no appropriate
  586.       Error Subcode is defined, then a zero (Unspecific) value is used
  587.       for the Error Subcode field.
  588.  
  589.       Message Header Error subcodes:
  590.  
  591.                       1  - Connection Not Synchronized.
  592.                       2  - Bad Message Length.
  593.                       3  - Bad Message Type.
  594.  
  595.       OPEN Message Error subcodes:
  596.  
  597.                       1  - Unsupported Version Number.
  598.                       2  - Bad Peer AS.
  599.                       3  - Unsupported Authentication Code.
  600.                       4  - Authentication Failure.
  601.  
  602.       UPDATE Message Error subcodes:
  603.  
  604.                       1 - Malformed Attribute List.
  605.                       2 - Unrecognized Well-known Attribute.
  606.                       3 - Missing Well-known Attribute.
  607.                       4 - Attribute Flags Error.
  608.                       5 - Attribute Length Error.
  609.                       6 - Invalid ORIGIN Attribute
  610.                       7 - AS Routing Loop.
  611.                       8 - Invalid NEXT_HOP Attribute.
  612.                       9 - Optional Attribute Error.
  613.                      10 - Invalid Network Field.
  614.  
  615.  
  616.  
  617.  
  618. Lougheed & Rekhter                                             [Page 11]
  619.  
  620. RFC 1163                          BGP                          June 1990
  621.  
  622.  
  623.    Data:
  624.  
  625.       This variable-length field is used to diagnose the reason for the
  626.       NOTIFICATION.  The contents of the Data field depend upon the
  627.       Error Code and Error Subcode.  See Section 6 below for more
  628.       details.
  629.  
  630.       Note that the length of the Data field can be determined from the
  631.       message Length field by the formula:
  632.  
  633.          Message Length = 21 + Data Length
  634.  
  635.    The minimum length of the NOTIFICATION message is 21 octets
  636.    (including message header).
  637.  
  638. 5.  Path Attributes
  639.  
  640.    This section discusses the path attributes of the UPDATE message.
  641.  
  642.    Path attributes fall into four separate categories:
  643.  
  644.          1. Well-known mandatory.
  645.          2. Well-known discretionary.
  646.          3. Optional transitive.
  647.          4. Optional non-transitive.
  648.  
  649.    Well-known attributes must be recognized by all BGP implementations.
  650.    Some of these attributes are mandatory and must be included in every
  651.    UPDATE message.  Others are discretionary and may or may not be sent
  652.    in a particular UPDATE message.  Which well-known attributes are
  653.    mandatory or discretionary is noted in the table below.
  654.  
  655.    All well-known attributes must be passed along (after proper
  656.    updating, if necessary) to other BGP peers.
  657.  
  658.    In addition to well-known attributes, each path may contain one or
  659.    more optional attributes.  It is not required or expected that all
  660.    BGP implementations support all optional attributes.  The handling of
  661.    an unrecognized optional attribute is determined by the setting of
  662.    the Transitive bit in the attribute flags octet.  Unrecognized
  663.    transitive optional attributes should be accepted and passed along to
  664.    other BGP peers.  If a path with unrecognized transitive optional
  665.    attribute is accepted and passed along to other BGP peers, the
  666.    Partial bit in the Attribute Flags octet is set to 1.  If a path with
  667.    recognized transitive optional attribute is accepted and passed along
  668.    to other BGP peers and the Partial bit in the Attribute Flags octet
  669.    is set to 1 by some previous AS, it is not set back to 0 by the
  670.    current AS.  Unrecognized non-transitive optional attributes should
  671.  
  672.  
  673.  
  674. Lougheed & Rekhter                                             [Page 12]
  675.  
  676. RFC 1163                          BGP                          June 1990
  677.  
  678.  
  679.    be quietly ignored and not passed along to other BGP peers.
  680.  
  681.    New transitive optional attributes may be attached to the path by the
  682.    originator or by any other AS in the path.  If they are not attached
  683.    by the originator, the Partial bit in the Attribute Flags octet is
  684.    set to 1.  The rules for attaching new non-transitive optional
  685.    attributes will depend on the nature of the specific attribute.  The
  686.    documentation of each new non-transitive optional attribute will be
  687.    expected to include such rules.  (The description of the INTER-AS
  688.    METRIC attribute gives an example.)  All optional attributes (both
  689.    transitive and non-transitive) may be updated (if appropriate) by ASs
  690.    in the path.
  691.  
  692.    The order of attributes within the Path Attributes field of a
  693.    particular UPDATE message is irrelevant.
  694.  
  695.    The same attribute cannot appear more than once within the Path
  696.    Attributes field of a particular UPDATE message.
  697.  
  698.    Following table specifies attribute type code, attribute length, and
  699.    attribute category for path attributes defined in this document:
  700.  
  701.    Attribute Name     Type Code    Length     Attribute category
  702.       ORIGIN              1          1        well-known, mandatory
  703.       AS_PATH             2       variable    well-known, mandatory
  704.       NEXT_HOP            3          4        well-known, mandatory
  705.       UNREACHABLE         4          0        well-known, discretionary
  706.       INTER-AS METRIC     5          2        optional, non-transitive
  707.  
  708.    ORIGIN:
  709.  
  710.       The ORIGIN path attribute defines the origin of the path
  711.       information.  The data octet can assume the following values:
  712.  
  713.          Value    Meaning
  714.            0       IGP - network(s) are interior to the originating AS
  715.            1       EGP - network(s) learned via EGP
  716.            2       INCOMPLETE - network(s) learned by some other means
  717.  
  718.    AS_PATH:
  719.  
  720.       The AS_PATH attribute enumerates the ASs that must be traversed to
  721.       reach the networks listed in the UPDATE message.  Since an AS
  722.       identifier is 2 octets, the length of an AS_PATH attribute is
  723.       twice the number of ASs in the path.  Rules for constructing an
  724.       AS_PATH attribute are discussed in Section 9.
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Lougheed & Rekhter                                             [Page 13]
  731.  
  732. RFC 1163                          BGP                          June 1990
  733.  
  734.  
  735.    NEXT_HOP:
  736.  
  737.       The NEXT_HOP path attribute defines the IP address of the border
  738.       router that should be used as the next hop to the networks listed
  739.       in the UPDATE message.  This border router must belong to the same
  740.       AS as the BGP peer that advertises it.
  741.  
  742.    UNREACHABLE:
  743.  
  744.       The UNREACHABLE attribute is used to notify a BGP peer that some
  745.       of the previously advertised routes have become unreachable.
  746.  
  747.    INTER-AS METRIC:
  748.  
  749.       The INTER-AS METRIC attribute may be used on external (inter-AS)
  750.       links to discriminate between multiple exit or entry points to the
  751.       same neighboring AS.  The value of the INTER-AS METRIC attribute
  752.       is a 2-octet unsigned number which is called a metric.  All other
  753.       factors being equal, the exit or entry point with lower metric
  754.       should be preferred.  If received over external links, the INTER-
  755.       AS METRIC attribute may be propagated over internal links to other
  756.       BGP speaker within the same AS.  The INTER-AS METRIC attribute is
  757.       never propagated to other BGP speakers in neighboring AS's.
  758.  
  759. 6.  BGP Error Handling.
  760.  
  761.    This section describes actions to be taken when errors are detected
  762.    while processing BGP messages.
  763.  
  764.    When any of the conditions described here are detected, a
  765.    NOTIFICATION message with the indicated Error Code, Error Subcode,
  766.    and Data fields is sent, and the BGP connection is closed.  If no
  767.    Error Subcode is specified, then a zero should be used.
  768.  
  769.    The phrase "the BGP connection is closed" means that the transport
  770.    protocol connection has been closed and that all resources for that
  771.    BGP connection have been deallocated.  Routing table entries
  772.    associated with the remote peer are marked as invalid.  The fact that
  773.    the routes have become invalid is passed to other BGP peers before
  774.    the routes are deleted from the system.
  775.  
  776.    Unless specified explicitly, the Data field of the NOTIFICATION
  777.    message that is sent to indicate an error is empty.
  778.  
  779. 6.1 Message Header error handling.
  780.  
  781.    All errors detected while processing the Message Header are indicated
  782.    by sending the NOTIFICATION message with Error Code Message Header
  783.  
  784.  
  785.  
  786. Lougheed & Rekhter                                             [Page 14]
  787.  
  788. RFC 1163                          BGP                          June 1990
  789.  
  790.  
  791.    Error.  The Error Subcode elaborates on the specific nature of the
  792.    error.
  793.  
  794.    The expected value of the Marker field of the message header is all
  795.    ones if the message type is OPEN.  The expected value of the Marker
  796.    field for all other types of BGP messages determined based on the
  797.    Authentication Code in the BGP OPEN message and the actual
  798.    authentication mechanism (if the Authentication Code in the BGP OPEN
  799.    message is non-zero). If the Marker field of the message header is
  800.    not the expected one, then a synchronization error has occurred and
  801.    the Error Subcode is set to Connection Not Synchronized.
  802.  
  803.    If the Length field of the message header is less than 19 or greater
  804.    than 4096, or if the Length field of an OPEN message is less  than
  805.    the minimum length of the OPEN message, or if the Length field of an
  806.    UPDATE message is less than the minimum length of the UPDATE message,
  807.    or if the Length field of a KEEPALIVE message is not equal to 19, or
  808.    if the Length field of a NOTIFICATION message is less than the
  809.    minimum length of the NOTIFICATION message, then the Error Subcode is
  810.    set to Bad Message Length.  The Data field contains the erroneous
  811.    Length field.
  812.  
  813.    If the Type field of the message header is not recognized, then the
  814.    Error Subcode is set to Bad Message Type.  The Data field contains
  815.    the erroneous Type field.
  816.  
  817. 6.2 OPEN message error handling.
  818.  
  819.    All errors detected while processing the OPEN message are indicated
  820.    by sending the NOTIFICATION message with Error Code OPEN Message
  821.    Error.  The Error Subcode elaborates on the specific nature of the
  822.    error.
  823.  
  824.    If the version number contained in the Version field of the received
  825.    OPEN message is not supported, then the Error Subcode is set to
  826.    Unsupported Version Number.  The Data field is a 2-octet unsigned
  827.    integer, which indicates the largest locally supported version number
  828.    less than the version the remote BGP peer bid (as indicated in the
  829.    received OPEN message).
  830.  
  831.    If the Autonomous System field of the OPEN message is unacceptable,
  832.    then the Error Subcode is set to Bad Peer AS.  The determination of
  833.    acceptable Autonomous System numbers is outside the scope of this
  834.    protocol.
  835.  
  836.    If the Authentication Code of the OPEN message is not recognized,
  837.    then the Error Subcode is set to Unsupported Authentication Code.
  838.  
  839.  
  840.  
  841.  
  842. Lougheed & Rekhter                                             [Page 15]
  843.  
  844. RFC 1163                          BGP                          June 1990
  845.  
  846.  
  847.    If the Authentication Code is zero, then the Authentication Data must
  848.    be of zero length.  Otherwise, the Error Subcode is set to
  849.    Authentication Failure.
  850.  
  851.    If the Authentication Code is non-zero, then the corresponding
  852.    authentication procedure is invoked.  If the authentication procedure
  853.    (based on Authentication Code and Authentication Data) fails, then
  854.    the Error Subcode is set to Authentication Failure.
  855.  
  856. 6.3 UPDATE message error handling.
  857.  
  858.    All errors detected while processing the UPDATE message are indicated
  859.    by sending the NOTIFICATION message with Error Code UPDATE Message
  860.    Error.  The error subcode elaborates on the specific nature of the
  861.    error.
  862.  
  863.    Error checking of an UPDATE message begins by examining the path
  864.    attributes.  If the Total Attribute Length is too large (i.e., if
  865.    Total Attribute Length + 21 exceeds the message Length), or if the
  866.    (non-negative integer) Number of Network fields cannot be computed as
  867.    in Section 4.3, then the Error Subcode is set to Malformed Attribute
  868.    List.
  869.  
  870.    If any recognized attribute has Attribute Flags that conflict with
  871.    the Attribute Type Code, then the Error Subcode is set to Attribute
  872.    Flags Error.  The Data field contains the erroneous attribute (type,
  873.    length and value).
  874.  
  875.    If any recognized attribute has Attribute Length that conflicts with
  876.    the expected length (based on the attribute type code), then the
  877.    Error Subcode is set to Attribute Length Error.  The Data field
  878.    contains the erroneous attribute (type, length and value).
  879.  
  880.    If any of the mandatory well-known attributes are not present, then
  881.    the Error Subcode is set to Missing Well-known Attribute.  The Data
  882.    field contains the Attribute Type Code of the missing well-known
  883.    attribute.
  884.  
  885.    If any of the mandatory well-known attributes are not recognized,
  886.    then the Error Subcode is set to Unrecognized Well-known Attribute.
  887.    The Data field contains the unrecognized attribute (type, length and
  888.    value).
  889.  
  890.    If the ORIGIN attribute has an undefined value, then the Error
  891.    Subcode is set to Invalid Origin Attribute.  The Data field contains
  892.    the unrecognized attribute (type, length and value).
  893.  
  894.    If the NEXT_HOP attribute field is syntactically incorrect, then the
  895.  
  896.  
  897.  
  898. Lougheed & Rekhter                                             [Page 16]
  899.  
  900. RFC 1163                          BGP                          June 1990
  901.  
  902.  
  903.    Error Subcode is set to Invalid NEXT_HOP Attribute.  The Data field
  904.    contains the incorrect attribute (type, length and value).  Syntactic
  905.    correctness means that the NEXT_HOP attribute represents a valid IP
  906.    host address.
  907.  
  908.    The AS route specified by the AS_PATH attribute is checked for AS
  909.    loops.  AS loop detection is done by scanning the full AS route (as
  910.    specified in the AS_PATH attribute) and checking that each AS occurs
  911.    at most once.  If a loop is detected, then the Error Subcode is set
  912.    to AS Routing Loop.  The Data field contains the incorrect attribute
  913.    (type, length and value).
  914.  
  915.    If an optional attribute is recognized, then the value of this
  916.    attribute is checked.  If an error is detected, the attribute is
  917.    discarded, and the Error Subcode is set to Optional Attribute Error.
  918.    The Data field contains the attribute (type, length and value).
  919.  
  920.    If any attribute appears more than once in the UPDATE message, then
  921.    the Error Subcode is set to Malformed Attribute List.
  922.  
  923.    Each Network field in the UPDATE message is checked for syntactic
  924.    validity.  If the Network field is syntactically incorrect, or
  925.    contains a subnet or a host address, then the Error Subcode is set to
  926.    Invalid Network Field.
  927.  
  928. 6.4 NOTIFICATION message error handling.
  929.  
  930.    If a peer sends a NOTIFICATION message, and there is an error in that
  931.    message, there is unfortunately no means of reporting this error via
  932.    a subsequent NOTIFICATION message.  Any such error, such as an
  933.    unrecognized Error Code or Error Subcode, should be noticed, logged
  934.    locally, and brought to the attention of the administration of the
  935.    peer.  The means to do this, however, lies outside the scope of this
  936.    document.
  937.  
  938. 6.5 Hold Timer Expired error handling.
  939.  
  940.    If a system does not receive successive KEEPALIVE and/or UPDATE
  941.    and/or NOTIFICATION messages within the period specified in the Hold
  942.    Time field of the OPEN message, then the NOTIFICATION message with
  943.    Hold Timer Expired Error Code should be sent and the BGP connection
  944.    closed.
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954. Lougheed & Rekhter                                             [Page 17]
  955.  
  956. RFC 1163                          BGP                          June 1990
  957.  
  958.  
  959. 6.6 Finite State Machine error handling.
  960.  
  961.    Any error detected by the BGP Finite State Machine (e.g., receipt of
  962.    an unexpected event) is indicated by sending the NOTIFICATION message
  963.    with Error Code Finite State Machine Error.
  964.  
  965. 6.7 Cease.
  966.  
  967.    In absence of any fatal errors (that are indicated in this section),
  968.    a BGP peer may choose at any given time to close its BGP connection
  969.    by sending the NOTIFICATION message with Error Code Cease.  However,
  970.    the Cease NOTIFICATION message should not be used when a fatal error
  971.    indicated by this section does exist.
  972.  
  973. 7.  BGP Version Negotiation.
  974.  
  975.    BGP speakers may negotiate the version of the protocol by making
  976.    multiple attempts to open a BGP connection, starting with the highest
  977.    version number each supports.  If an open attempt fails with an Error
  978.    Code OPEN Message Error, and an Error Subcode Unsupported Version
  979.    Number, then the BGP speaker has available the version number it
  980.    tried, the version number its peer tried, the version number passed
  981.    by its peer in the NOTIFICATION message, and the version numbers that
  982.    it supports.  If the two peers do support one or more common
  983.    versions, then this will allow them to rapidly determine the highest
  984.    common version. In order to support BGP version negotiation, future
  985.    versions of BGP must retain the format of the OPEN and NOTIFICATION
  986.    messages.
  987.  
  988. 8.  BGP Finite State machine.
  989.  
  990.    This section specifies BGP operation in terms of a Finite State
  991.    Machine (FSM).  Following is a brief summary and overview of BGP
  992.    operations by state as determined by this FSM.  A condensed version
  993.    of the BGP FSM is found in Appendix 1.
  994.  
  995.    Initially BGP is in the Idle state.
  996.  
  997.       Idle state:
  998.  
  999.          In this state BGP refuses all incoming BGP connections.  No
  1000.          resources are allocated to the BGP neighbor.  In response to
  1001.          the Start event (initiated by either system or operator) the
  1002.          local system initializes all BGP resources, starts the
  1003.          ConnectRetry timer, initiates a transport connection to other
  1004.          BGP peer, while listening for connection that may be initiated
  1005.          by the remote BGP peer, and changes its state to Connect.
  1006.  
  1007.  
  1008.  
  1009.  
  1010. Lougheed & Rekhter                                             [Page 18]
  1011.  
  1012. RFC 1163                          BGP                          June 1990
  1013.  
  1014.  
  1015.          The exact value of the ConnectRetry timer is a local matter,
  1016.          but should be sufficiently large to allow TCP initialization.
  1017.  
  1018.          Any other event received in the Idle state is ignored.
  1019.  
  1020.       Connect state:
  1021.  
  1022.          In this state BGP is waiting for the transport protocol
  1023.          connection to be completed.
  1024.  
  1025.          If the transport protocol connection succeeds, the local system
  1026.          clears the ConnectRetry timer, completes initialization, sends
  1027.          an OPEN message to its peer, and changes its state to OpenSent.
  1028.  
  1029.          If the transport protocol connect fails (e.g., retransmission
  1030.          timeout), the local system restarts the ConnectRetry timer,
  1031.          continues to listen for a connection that may be initiated by
  1032.          the remote BGP peer, and changes its state to Active state.
  1033.  
  1034.          In response to the ConnectRetry timer expired event, the local
  1035.          system restarts the ConnectRetry timer, initiates a transport
  1036.          connection to other BGP peer, continues to listen for a
  1037.          connection that may be initiated by the remote BGP peer, and
  1038.          stays in the Connect state.
  1039.  
  1040.          Start event is ignored in the Active state.
  1041.  
  1042.          In response to any other event (initiated by either system or
  1043.          operator), the local system releases all BGP resources
  1044.          associated with this connection and changes its state to Idle.
  1045.  
  1046.       Active state:
  1047.  
  1048.          In this state BGP is trying to acquire a BGP neighbor by
  1049.          initiating a transport protocol connection.
  1050.  
  1051.          If the transport protocol connection succeeds, the local system
  1052.          clears the ConnectRetry timer, completes initialization, sends
  1053.          an OPEN message to its peer, sets its hold timer to a large
  1054.          value, and changes its state to OpenSent.
  1055.  
  1056.          In response to the ConnectRetry timer expired event, the local
  1057.          system restarts the ConnectRetry timer, initiates a transport
  1058.          connection to other BGP peer, continues to listen for a
  1059.          connection that may be be initiated by the remote BGP peer, and
  1060.          changes its state to Connect.
  1061.  
  1062.          If the local system detects that a remote peer is trying to
  1063.  
  1064.  
  1065.  
  1066. Lougheed & Rekhter                                             [Page 19]
  1067.  
  1068. RFC 1163                          BGP                          June 1990
  1069.  
  1070.  
  1071.          establish BGP connection to it, and the IP address of the
  1072.          remote peer is not an expected one, the local system restarts
  1073.          the ConnectRetry timer, rejects the attempted connection,
  1074.          continues to listen for a connection that may be initiated by
  1075.          the remote BGP peer, and stays in the Active state.
  1076.  
  1077.          Start event is ignored in the Active state.
  1078.  
  1079.          In response to any other event (initiated by either system or
  1080.          operator), the local system releases all BGP resources
  1081.          associated with this connection and changes its state to Idle.
  1082.  
  1083.       OpenSent state:
  1084.  
  1085.          In this state BGP waits for an OPEN message from its peer.
  1086.          When an OPEN message is received, all fields are checked for
  1087.          correctness.  If the BGP message header checking or OPEN
  1088.          message checking detects an error (see Section 6), the local
  1089.          system sends a NOTIFICATION message and changes its state to
  1090.          Idle.
  1091.  
  1092.          If there are no errors in the OPEN message, BGP sends a
  1093.          KEEPALIVE message and sets a KeepAlive timer.  The hold timer,
  1094.          which was originally set to an arbitrary large value (see
  1095.          above), is replaced with the value indicated in the OPEN
  1096.          message.  If the value of the Autonomous System field is the
  1097.          same as our own , then the connection is "internal" connection;
  1098.          otherwise, it is "external".  (This will effect UPDATE
  1099.          processing as described below.)  Finally, the state is changed
  1100.          to OpenConfirm.
  1101.  
  1102.          If a disconnect notification is received from the underlying
  1103.          transport protocol, the local system closes the BGP connection,
  1104.          restarts the ConnectRetry timer, while continue listening for
  1105.          connection that may be initiated by the remote BGP peer, and
  1106.          goes into the Active state.
  1107.  
  1108.          If the hold time expires, the local system sends NOTIFICATION
  1109.          message with error code Hold Timer Expired and changes its
  1110.          state to Idle.
  1111.  
  1112.          In response to the Stop event (initiated by either system or
  1113.          operator) the local system sends NOTIFICATION message with
  1114.          Error Code Cease and changes its state to Idle.
  1115.  
  1116.          Start event is ignored in the OpenSent state.
  1117.  
  1118.          In response to any other event the local system sends
  1119.  
  1120.  
  1121.  
  1122. Lougheed & Rekhter                                             [Page 20]
  1123.  
  1124. RFC 1163                          BGP                          June 1990
  1125.  
  1126.  
  1127.          NOTIFICATION message with Error Code Finite State Machine Error
  1128.          and changes its state to Idle.
  1129.  
  1130.          Whenever BGP changes its state from OpenSent to Idle, it closes
  1131.          the BGP (and transport-level) connection and releases all
  1132.          resources associated with that connection.
  1133.  
  1134.       OpenConfirm state:
  1135.  
  1136.          In this state BGP waits for a KEEPALIVE or NOTIFICATION
  1137.          message.
  1138.  
  1139.          If the local system receives a KEEPALIVE message, it changes
  1140.          its state to Established.
  1141.  
  1142.          If the hold timer expires before a KEEPALIVE message is
  1143.          received, the local system sends NOTIFICATION message with
  1144.          error code Hold Timer expired and changes its state to Idle.
  1145.  
  1146.          If the local system receives a NOTIFICATION message, it changes
  1147.          its state to Idle.
  1148.  
  1149.          If the KeepAlive timer expires, the local system sends a
  1150.          KEEPALIVE message and restarts its KeepAlive timer.
  1151.  
  1152.          If a disconnect notification is received from the underlying
  1153.          transport protocol, the local system changes its state to Idle.
  1154.  
  1155.          In response to the Stop event (initiated by either system or
  1156.          operator) the local system sends NOTIFICATION message with
  1157.          Error Code Cease and changes its state to Idle.
  1158.  
  1159.          Start event is ignored in the OpenConfirm state.
  1160.  
  1161.          In response to any other event the local system sends
  1162.          NOTIFICATION message with Error Code Finite State Machine Error
  1163.          and changes its state to Idle.
  1164.  
  1165.          Whenever BGP changes its state from OpenConfirm to Idle, it
  1166.          closes the BGP (and transport-level) connection and releases
  1167.          all resources associated with that connection.
  1168.  
  1169.       Established state:
  1170.  
  1171.          In the Established state BGP can exchange UPDATE, NOTIFICATION,
  1172.          and KEEPALIVE messages with its peer.
  1173.  
  1174.          If the local system receives an UPDATE or KEEPALIVE message, it
  1175.  
  1176.  
  1177.  
  1178. Lougheed & Rekhter                                             [Page 21]
  1179.  
  1180. RFC 1163                          BGP                          June 1990
  1181.  
  1182.  
  1183.          restarts its Holdtime timer.
  1184.  
  1185.          If the local system receives a NOTIFICATION message, it changes
  1186.          its state to Idle.
  1187.  
  1188.          If the local system receives an UPDATE message and the UPDATE
  1189.          message error handling procedure (see Section 6.3) detects an
  1190.          error, the local system sends a NOTIFICATION message and
  1191.          changes its state to Idle.
  1192.  
  1193.          If a disconnect notification is received from the underlying
  1194.          transport protocol, the local system  changes its state to
  1195.          Idle.
  1196.  
  1197.          If the Holdtime timer expires, the local system sends a
  1198.          NOTIFICATION message with Error Code Hold Timer Expired and
  1199.          changes its state to Idle.
  1200.  
  1201.          If the KeepAlive timer expires, the local system sends a
  1202.          KEEPALIVE message and restarts its KeepAlive timer.
  1203.  
  1204.          Each time the local system sends a KEEPALIVE or UPDATE message,
  1205.          it restarts its KeepAlive timer.
  1206.  
  1207.          In response to the Stop event (initiated by either system or
  1208.          operator), the local system sends a NOTIFICATION message with
  1209.          Error Code Cease and changes its state to Idle.
  1210.  
  1211.          Start event is ignored in the Established state.
  1212.  
  1213.          In response to any other event, the local system sends
  1214.          NOTIFICATION message with Error Code Finite State Machine Error
  1215.          and changes its state to Idle.
  1216.  
  1217.          Whenever BGP changes its state from Established to Idle, it
  1218.          closes the BGP (and transport-level) connection, releases all
  1219.          resources associated with that connection, and deletes all
  1220.          routes derived from that connection.
  1221.  
  1222. 9.  UPDATE Message Handling
  1223.  
  1224.    An UPDATE message may be received only in the Established state.
  1225.    When an UPDATE message is received, each field is checked for
  1226.    validity as specified in Section 6.3.
  1227.  
  1228.    If an optional non-transitive attribute is unrecognized, it is
  1229.    quietly ignored.  If an optional transitive attribute is
  1230.    unrecognized, the Partial bit (the third high-order bit) in the
  1231.  
  1232.  
  1233.  
  1234. Lougheed & Rekhter                                             [Page 22]
  1235.  
  1236. RFC 1163                          BGP                          June 1990
  1237.  
  1238.  
  1239.    attribute flags octet is set to 1, and the attribute is retained for
  1240.    propagation to other BGP speakers.
  1241.  
  1242.    If an optional attribute is recognized, and has a valid value, then,
  1243.    depending on the type of the optional attribute, it is processed
  1244.    locally, retained, and updated, if necessary, for possible
  1245.    propagation to other BGP speakers.
  1246.  
  1247.    If the network and the path attributes associated with a route to
  1248.    that network are correct, then the route is compared with other
  1249.    routes to the same network.  If the new route is better than the
  1250.    current one, then it is propagated via an UPDATE message to adjacent
  1251.    BGP speakers as follows:
  1252.  
  1253.    - If a route in the UPDATE was received over an internal link, it is
  1254.      not propagated over any other internal link.  This restriction is
  1255.      due to the fact that all BGP speakers within a single AS form a
  1256.      completely connected graph (see above).
  1257.  
  1258.    - If the UPDATE message is propagated over an external link, then the
  1259.      local AS number is prepended to the AS_PATH attribute, and the
  1260.      NEXT_HOP attribute is updated with an IP address of the router that
  1261.      should be used as a next hop to the network.  If the UPDATE message
  1262.      is propagated over an internal link, then the AS_PATH attribute is
  1263.      passed unmodified and the NEXT_HOP attribute is replaced with the
  1264.      sender's own IP address.
  1265.  
  1266.    Generally speaking, the rules for comparing routes among several
  1267.    alternatives are outside the scope of this document.  There are two
  1268.    exceptions:
  1269.  
  1270.    - If the local AS appears in the AS path of the new route being
  1271.      considered, then that new route cannot be viewed as better than any
  1272.      other route.  If such a route were ever used, a routing loop would
  1273.      result.
  1274.  
  1275.    - In order to achieve successful distributed operation, only routes
  1276.      with a likelihood of stability can be chosen.  Thus, an AS must
  1277.      avoid using unstable routes, and it must not make rapid spontaneous
  1278.      changes to its choice of route.  Quantifying the terms "unstable"
  1279.      and "rapid" in the previous sentence will require experience, but
  1280.      the principle is clear.
  1281.  
  1282. 10. Detection of Inter-AS Policy Contradictions
  1283.  
  1284.    Since BGP requires no central authority for coordinating routing
  1285.    policies among ASs, and since routing policies are not exchanged via
  1286.    the protocol itself, it is possible for a group of ASs to have a set
  1287.  
  1288.  
  1289.  
  1290. Lougheed & Rekhter                                             [Page 23]
  1291.  
  1292. RFC 1163                          BGP                          June 1990
  1293.  
  1294.  
  1295.    of routing policies that cannot simultaneously be satisfied.  This
  1296.    may cause an indefinite oscillation of the routes in this group of
  1297.    ASs.
  1298.  
  1299.    To help detect such a situation, all BGP speakers must observe the
  1300.    following rule.  If a route to a destination that is currently used
  1301.    by the local system is determined to be unreachable (e.g., as a
  1302.    result of receiving an UPDATE message for this route with the
  1303.    UNREACHABLE attribute), then, before switching to another route, this
  1304.    local system must advertize this route as unreachable to all the BGP
  1305.    neighbors to which it previously advertized this route.
  1306.  
  1307.    This rule will allow other ASs to distinguish between two different
  1308.    situations:
  1309.  
  1310.    - The local system has chosen to use a new route because the old
  1311.      route become unreachable.
  1312.  
  1313.    - The local system has chosen to use a new route because it preferred
  1314.      it over the old route.  The old route is still viable.
  1315.  
  1316.    In the former case, an UPDATE message with the UNREACHABLE attribute
  1317.    will be received for the old route.  In the latter case it will not.
  1318.  
  1319.    In some cases, this may allow a BGP speaker to detect the fact that
  1320.    its policies, taken together with the policies of some other AS,
  1321.    cannot simultaneously be satisfied.  For example, consider the
  1322.    following situation involving AS A and its neighbor AS B.  B
  1323.    advertises a route with a path of the form <B,...>, where A is not
  1324.    present in the path.  A then decides to use this path, and advertises
  1325.    <A,B,...> to all its neighbors.  B later advertises <B,...,A,...>
  1326.    back to A, without ever declaring its previous path <B,...> to be
  1327.    unreachable.  Evidently, A prefers routes via B and B prefers routes
  1328.    via A.  The combined policies of A and B, taken together, cannot be
  1329.    satisfied.  Such an event should be noticed, logged locally, and
  1330.    brought to the attention of AS A's administration.  The means to do
  1331.    this, however, lies outside the scope of this document.  Also outside
  1332.    the document is a more complete procedure for detecting such
  1333.    contradictions of policy.
  1334.  
  1335.    While the above rules provide a mechanism to detect a set of routing
  1336.    policies that cannot be satisfied simultaneously, the protocol itself
  1337.    does not provide any mechanism for suppressing the route oscillation
  1338.    that may result from these unsatisfiable policies.  The reason for
  1339.    doing this is that routing policies are viewed as external to the
  1340.    protocol and as determined by the local AS administrator.
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Lougheed & Rekhter                                             [Page 24]
  1347.  
  1348. RFC 1163                          BGP                          June 1990
  1349.  
  1350.  
  1351. Appendix 1.  BGP FSM State Transitions and Actions.
  1352.  
  1353.    This Appendix discusses the transitions between states in the BGP FSM
  1354.    in response to BGP events.  The following is the list of these states
  1355.    and events.
  1356.  
  1357.     BGP States:
  1358.  
  1359.              1 - Idle
  1360.              2 - Connect
  1361.              3 - Active
  1362.              4 - OpenSent
  1363.              5 - OpenConfirm
  1364.              6 - Established
  1365.  
  1366.  
  1367.     BGP Events:
  1368.  
  1369.              1 - BGP Start
  1370.              2 - BGP Stop
  1371.              3 - BGP Transport connection open
  1372.              4 - BGP Transport connection closed
  1373.              5 - BGP Transport connection open failed
  1374.              6 - BGP Transport fatal error
  1375.              7 - ConnectRetry timer expired
  1376.              8 - Holdtime timer expired
  1377.              9 - KeepAlive timer expired
  1378.             10 - Receive OPEN message
  1379.             11 - Receive KEEPALIVE message
  1380.             12 - Receive UPDATE messages
  1381.             13 - Receive NOTIFICATION message
  1382.  
  1383.    The following table describes the state transitions of the BGP FSM
  1384.    and the actions triggered by these transitions.
  1385.  
  1386.     Event                Actions               Message Sent   Next State
  1387.     --------------------------------------------------------------------
  1388.     Idle (1)
  1389.      1            Initialize resources            none             2
  1390.                   Start ConnectRetry timer
  1391.                   Initiate a transport connection
  1392.      others               none                    none             1
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Lougheed & Rekhter                                             [Page 25]
  1403.  
  1404. RFC 1163                          BGP                          June 1990
  1405.  
  1406.  
  1407.     Connect(2)
  1408.      1                    none                    none             2
  1409.      3            Complete initialization         OPEN             4
  1410.                   Clear ConnectRetry timer
  1411.      5            Restart ConnectRetry timer      none             3
  1412.      7            Restart ConnectRetry timer      none             2
  1413.                   Initiate a transport connection
  1414.      others       Release resources               none             1
  1415.  
  1416.     Active (3)
  1417.      1                    none                    none             3
  1418.      3            Complete initialization         OPEN             4
  1419.                   Clear ConnectRetry timer
  1420.      5            Close connection                                 3
  1421.                   Restart ConnectRetry timer
  1422.      7            Restart ConnectRetry timer      none             2
  1423.                   Initiate a transport connection
  1424.      others       Release resources               none             1
  1425.  
  1426.     OpenSent(4)
  1427.      1                    none                    none             4
  1428.      4            Close transport connection      none             3
  1429.                   Restart ConnectRetry timer
  1430.      6            Release resources               none             1
  1431.     10            Process OPEN is OK            KEEPALIVE          5
  1432.                   Process OPEN failed           NOTIFICATION       1
  1433.     others        Close transport connection    NOTIFICATION       1
  1434.                   Release resources
  1435.  
  1436.     OpenConfirm (5)
  1437.      1                   none                     none             5
  1438.      4            Release resources               none             1
  1439.      6            Release resources               none             1
  1440.      9            Restart KeepAlive timer       KEEPALIVE          5
  1441.     11            Complete initialization         none             6
  1442.                   Restart Holdtime timer
  1443.     13            Close transport connection                       1
  1444.                   Release resources
  1445.     others        Close transport connection    NOTIFICATION       1
  1446.                   Release resources
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Lougheed & Rekhter                                             [Page 26]
  1459.  
  1460. RFC 1163                          BGP                          June 1990
  1461.  
  1462.  
  1463.     Established (6)
  1464.      1                   none                     none             6
  1465.      4            Release resources               none             1
  1466.      6            Release resources               none             1
  1467.      9            Restart KeepAlive timer       KEEPALIVE          6
  1468.     11            Restart Holdtime timer        KEEPALIVE          6
  1469.     12            Process UPDATE is OK          UPDATE             6
  1470.                   Process UPDATE failed         NOTIFICATION       1
  1471.     13            Close transport connection                       1
  1472.                   Release resources
  1473.     others        Close transport connection    NOTIFICATION       1
  1474.                   Release resources
  1475.    ---------------------------------------------------------------------
  1476.  
  1477.    The following is a condensed version of the above state transition
  1478.    table.
  1479.  
  1480. Events| Idle | Active | Connect | OpenSent | OpenConfirm | Estab
  1481.       | (1)  |   (2)  |  (3)    |    (4)   |     (5)     |   (6)
  1482.       |--------------------------------------------------------------
  1483.  1    |  2   |    2   |   3     |     4    |      5      |    6
  1484.       |      |        |         |          |             |
  1485.  2    |  1   |    1   |   1     |     1    |      1      |    1
  1486.       |      |        |         |          |             |
  1487.  3    |  1   |    4   |   4     |     1    |      1      |    1
  1488.       |      |        |         |          |             |
  1489.  4    |  1   |    1   |   1     |     3    |      1      |    1
  1490.       |      |        |         |          |             |
  1491.  5    |  1   |    3   |   3     |     1    |      1      |    1
  1492.       |      |        |         |          |             |
  1493.  6    |  1   |    1   |   1     |     1    |      1      |    1
  1494.       |      |        |         |          |             |
  1495.  7    |  1   |    2   |   2     |     1    |      1      |    1
  1496.       |      |        |         |          |             |
  1497.  8    |  1   |    1   |   1     |     1    |      1      |    1
  1498.       |      |        |         |          |             |
  1499.  9    |  1   |    1   |   1     |     1    |      5      |    6
  1500.       |      |        |         |          |             |
  1501. 10    |  1   |    1   |   1     |  1 or 5  |      1      |    1
  1502.       |      |        |         |          |             |
  1503. 11    |  1   |    1   |   1     |     1    |      6      |    6
  1504.       |      |        |         |          |             |
  1505. 12    |  1   |    1   |   1     |     1    |      1      | 1 or 6
  1506.       |      |        |         |          |             |
  1507. 13    |  1   |    1   |   1     |     1    |      1      |    1
  1508.       |      |        |         |          |             |
  1509.       ---------------------------------------------------------------
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Lougheed & Rekhter                                             [Page 27]
  1515.  
  1516. RFC 1163                          BGP                          June 1990
  1517.  
  1518.  
  1519. Appendix 2.  Comparison with RFC 1105
  1520.  
  1521.    Minor changes to the RFC1105 Finite State Machine were necessary to
  1522.    accommodate the TCP user interface provided by 4.3 BSD.
  1523.  
  1524.    The notion of Up/Down/Horizontal relations present in RFC1105 has
  1525.    been removed from the protocol.
  1526.  
  1527.    The changes in the message format from RFC1105 are as follows:
  1528.  
  1529.        1.  The Hold Time field has been removed from the BGP header and
  1530.            added to the OPEN message.
  1531.  
  1532.        2.  The version field has been removed from the BGP header and
  1533.            added to the OPEN message.
  1534.  
  1535.        3.  The Link Type field has been removed from the OPEN message.
  1536.  
  1537.        4.  The OPEN CONFIRM message has been eliminated and replaced
  1538.            with implicit confirmation provided by the KEEPALIVE message.
  1539.  
  1540.        5.  The format of the UPDATE message has been changed
  1541.            significantly.  New fields were added to the UPDATE message
  1542.            to support multiple path attributes.
  1543.  
  1544.        6.  The Marker field has been expanded and its role broadened to
  1545.            support authentication.
  1546.  
  1547. Appendix 3.  TCP options that may be used with BGP
  1548.  
  1549.    If a local system TCP user interface supports TCP PUSH function, then
  1550.    each BGP message should be transmitted with PUSH flag set.  Setting
  1551.    PUSH flag forces BGP messages to be transmitted promptly to the
  1552.    receiver.
  1553.  
  1554.    If a local system TCP user interface supports setting precedence for
  1555.    TCP connection, then the BGP transport connection should be opened
  1556.    with precedence set to Internetwork Control (110) value (see also
  1557.    [6]).
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Lougheed & Rekhter                                             [Page 28]
  1571.  
  1572. RFC 1163                          BGP                          June 1990
  1573.  
  1574.  
  1575. References
  1576.  
  1577.    [1]  Mills, D., "Exterior Gateway Protocol Formal Specification", RFC
  1578.         904, BBN, April 1984.
  1579.  
  1580.    [2]  Rekhter, Y., "EGP and Policy Based Routing in the New NSFNET
  1581.         Backbone", RFC 1092, T.J. Watson Research Center, February 1989.
  1582.  
  1583.    [3]  Braun, H-W., "The NSFNET Routing Architecture", RFC 1093,
  1584.         MERIT/NSFNET Project, February 1989.
  1585.  
  1586.    [4]  Postel, J., "Transmission Control Protocol - DARPA Internet
  1587.         Program Protocol Specification", RFC 793, DARPA, September 1981.
  1588.  
  1589.    [5]  Honig, J., Katz, D., Mathis, M., Rekhter, Y., and J. Yu,
  1590.         "Application of the Border Gateway Protocol in the Internet",
  1591.         RFC 1164, Cornell University Theory Center, Merit/NSFNET,
  1592.         Pittsburgh Supercomputing Center, IBM, Merit/NSFNET, June 1990.
  1593.  
  1594.    [6]  Postel, J., "Internet Protocol - DARPA Internet Program Protocol
  1595.         Specification", RFC 791, DARPA, September 1981.
  1596.  
  1597. Security Considerations
  1598.  
  1599.    Security issues are not discussed in this memo.
  1600.  
  1601. Authors' Addresses
  1602.  
  1603.    Kirk Lougheed
  1604.    cisco Systems, Inc.
  1605.    1525 O'Brien Drive
  1606.    Menlo Park, CA 94025
  1607.  
  1608.    Phone:  (415) 326-1941
  1609.  
  1610.    Email:  LOUGHEED@CISCO.COM
  1611.  
  1612.  
  1613.    Yakov Rekhter
  1614.    T.J. Watson Research Center IBM Corporation
  1615.    P.O. Box 218
  1616.    Yorktown Heights, NY 10598
  1617.  
  1618.    Phone:  (914) 945-3896
  1619.  
  1620.    Email:  YAKOV@IBM.COM
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626. Lougheed & Rekhter                                             [Page 29]
  1627.