Section 3. PPP Link Operation

3.1.  Overview
   In order to establish communications over a point-to-point link, each
   end of the PPP link MUST first send LCP packets to configure and test
   the data link.  After the link has been established, the peer MAY be
   authenticated.
   Then, PPP MUST send NCP packets to choose and configure one or more
   network-layer protocols.  Once each of the chosen network-layer
   protocols has been configured, datagrams from each network-layer
   protocol can be sent over the link.
   The link will remain configured for communications until explicit LCP
   or NCP packets close the link down, or until some external event
   occurs (an inactivity timer expires or network administrator
   intervention).
3.2.  Phase Diagram
   In the process of configuring, maintaining and terminating the
   point-to-point link, the PPP link goes through several distinct
   phases which are specified in the following simplified state diagram:
   +------+        +-----------+           +--------------+
   |      | UP     |           | OPENED    |              | SUCCESS/NONE
   | Dead |------->| Establish |---------->| Authenticate |--+
   |      |        |           |           |              |  |
   +------+        +-----------+           +--------------+  |
      ^               |                        |             |
      |          FAIL |                   FAIL |             |
      +<--------------+             +----------+             |
      |                             |                        |
      |            +-----------+    |           +---------+  |
      |       DOWN |           |    |   CLOSING |         |  |
      +------------| Terminate |<---+<----------| Network |<-+
                   |           |                |         |
                   +-----------+                +---------+
   Not all transitions are specified in this diagram.  The following
   semantics MUST be followed.
3.3.  Link Dead (physical-layer not ready)
   The link necessarily begins and ends with this phase.  When an
   external event (such as carrier detection or network administrator
   configuration) indicates that the physical-layer is ready to be used,
   PPP will proceed to the Link Establishment phase.
   During this phase, the LCP automaton (described later) will be in the
   Initial or Starting states.  The transition to the Link Establishment
   phase will signal an Up event to the LCP automaton.
   Implementation Note:
      Typically, a link will return to this phase automatically after
      the disconnection of a modem.  In the case of a hard-wired link,
      this phase may be extremely short -- merely long enough to detect
      the presence of the device.
3.4.  Link Establishment Phase
   The Link Control Protocol (LCP) is used to establish the connection
   through an exchange of Configure packets.  This exchange is complete,
   and the LCP Opened state entered, once a Configure-Ack packet
   (described later) has been both sent and received.
   All Configuration Options are assumed to be at default values unless
   altered by the configuration exchange.  See the chapter on LCP
   Configuration Options for further discussion.
   It is important to note that only Configuration Options which are
   independent of particular network-layer protocols are configured by
   LCP.  Configuration of individual network-layer protocols is handled
   by separate Network Control Protocols (NCPs) during the Network-Layer
   Protocol phase.
   Any non-LCP packets received during this phase MUST be silently
   discarded.
   The receipt of the LCP Configure-Request causes a return to the Link
   Establishment phase from the Network-Layer Protocol phase or
   Authentication phase.
3.5.  Authentication Phase
   On some links it may be desirable to require a peer to authenticate
   itself before allowing network-layer protocol packets to be
   exchanged.
   By default, authentication is not mandatory.  If an implementation
   desires that the peer authenticate with some specific authentication
   protocol, then it MUST request the use of that authentication
   protocol during Link Establishment phase.
   Authentication SHOULD take place as soon as possible after link
   establishment.  However, link quality determination MAY occur
   concurrently.  An implementation MUST NOT allow the exchange of link
   quality determination packets to delay authentication indefinitely.
   Advancement from the Authentication phase to the Network-Layer
   Protocol phase MUST NOT occur until authentication has completed.  If
   authentication fails, the authenticator SHOULD proceed instead to the
   Link Termination phase.
   Only Link Control Protocol, authentication protocol, and link quality
   monitoring packets are allowed during this phase.  All other packets
   received during this phase MUST be silently discarded.
   Implementation Notes:
      An implementation SHOULD NOT fail authentication simply due to
      timeout or lack of response.  The authentication SHOULD allow some
      method of retransmission, and proceed to the Link Termination
      phase only after a number of authentication attempts has been
      exceeded.
      The implementation responsible for commencing Link Termination
      phase is the implementation which has refused authentication to
      its peer.
3.6.  Network-Layer Protocol Phase
   Once PPP has finished the previous phases, each network-layer
   protocol (such as IP, IPX, or AppleTalk) MUST be separately
   configured by the appropriate Network Control Protocol (NCP).
   Each NCP MAY be Opened and Closed at any time.
   Implementation Note:
      Because an implementation may initially use a significant amount
      of time for link quality determination, implementations SHOULD
      avoid fixed timeouts when waiting for their peers to configure a
      NCP.
   After a NCP has reached the Opened state, PPP will carry the
   corresponding network-layer protocol packets.  Any supported
   network-layer protocol packets received when the corresponding NCP is
   not in the Opened state MUST be silently discarded.
   Implementation Note:
      While LCP is in the Opened state, any protocol packet which is
      unsupported by the implementation MUST be returned in a Protocol-
      Reject (described later).  Only protocols which are supported are
      silently discarded.
   During this phase, link traffic consists of any possible combination
   of LCP, NCP, and network-layer protocol packets.
3.7.  Link Termination Phase
   PPP can terminate the link at any time.  This might happen because of
   the loss of carrier, authentication failure, link quality failure,
   the expiration of an idle-period timer, or the administrative closing
   of the link.
   LCP is used to close the link through an exchange of Terminate
   packets.  When the link is closing, PPP informs the network-layer
   protocols so that they may take appropriate action.
   After the exchange of Terminate packets, the implementation SHOULD
   signal the physical-layer to disconnect in order to enforce the
   termination of the link, particularly in the case of an
   authentication failure.  The sender of the Terminate-Request SHOULD
   disconnect after receiving a Terminate-Ack, or after the Restart
   counter expires.  The receiver of a Terminate-Request SHOULD wait for
   the peer to disconnect, and MUST NOT disconnect until at least one
   Restart time has passed after sending a Terminate-Ack.  PPP SHOULD
   proceed to the Link Dead phase.
   Any non-LCP packets received during this phase MUST be silently
   discarded.
   Implementation Note:
      The closing of the link by LCP is sufficient.  There is no need
      for each NCP to send a flurry of Terminate packets.  Conversely,
      the fact that one NCP has Closed is not sufficient reason to cause
      the termination of the PPP link, even if that NCP was the only NCP
      currently in the Opened state.