PPP session

When two devices are first turned on, there is no physical layer connection between them. Once the connection is made, the link can continue to establish a PPP session. There are three phases of establishing a PPP session:

Phase 1: Link establishment and configuration negotiation

Before PPP exchanges any network layer datagrams, such as IP, the LCP must first perform the basic setup of the link. The sending device sends an LCP configuration request to a receiving device. Suppose sending device is A and receiving device is B. The B receive the configuration request message over the physical link, containing the parameters wishes to use.

If device B agrees with the parameters, it replies with an acknowledgement (Ack) otherwise sends negative acknowledgement (NACK) message. In the case of NACK, sending device tries different parameters with a new request. This phase is complete when the negotiation between both is successful. After the successful completion of Phase 1, the status goes to LCP open and proceed to the authentication phase.

Phase 2: Link quality determination

Link Quality determination is the second phase of the PPP session establishment. It as an optional phase in the PPP session.  The LCP check the link quality to decide that the link is sufficient to bring up network-layer protocols. The LCP can delay data sending of network layer protocol information until this phase is complete.

Phase 3: Network layer protocol configuration negotiation

After the link quality determination, the specific configuration of the appropriate network layer protocol is performed by invoking the suitable NCP, such as IPCP, IPXCP etc. If the LCP terminate the link, it informs the network-layer protocols so that they can take appropriate action. More than one NCP can be run on a particular PPP link, and each NCP can be terminate independently when it is no longer needed. The PPP link remains configured for communications until explicit LCP or NCP frames terminate the link, or until some outside event occurs.

LCP Operation

Link Control Protocol (LCP) is the main part of the PPP session. It is responsible for controlling the links in Point-to-Point Protocol (PPP) suite. It is implemented at Data Link Layer in the OSI model. LCP is used to automatically agree upon the encapsulation format, sizes of packets, looped-back link, and common misconfiguration errors. It is also responsible for connection termination. LCP operation uses three classes of LCP frames to accomplish the work of each of the LCP phases:

  • Link-establishment frames
  • Link-maintenance frames
  • Link-termination frames

 Link Establishment

Link establishment is the first phase of LCP operation that must complete successfully, before exchanging any network layer packets. During link establishment, the LCP opens the connection and negotiates the configuration parameters. The initiating device starts link establishment by sending a Configure-Request frame to the responder. The frame contains a variable number of configuration options needed to set up on the link. The initiator includes the options for how it wants the link created, including protocol or authentication parameters.

The responder processes the request. If the options are not suitable or not recognized the responder sends a Configure-NAK or Configure-Reject In case if the negotiation fails, the initiator must restart the process with new options. If the options are suitable and acceptable, the responder replies with a Configure-Ack message and the process moves on to the next stage. Next stage is NCP operation. When NCP has completed configurations, authentication if configured, the line is available for data transfer. During the data exchange, LCP transitions into the link maintenance phase. Figure 1 illustrates the Link Establishment phase of LCP.

PPP session

Link Maintenance

When the link is in the maintenance phase, LCP can test the link using test and feedback messages as shown in Figure 2.

  • Test Messages Frame. Echo-Request, Echo-Reply, and Discard-Request can be used for testing the link.
  • Feedback Messages Frame. Code-Reject and Protocol-Rejectframe types provide link feedback when one device receives an invalid frame due to unrecognized LCP code or a bad protocol identifier. Code-Reject packet is sent in response. The sending device will resend the packet.
PPP session 4

Link Termination

The link remains open until the LCP terminates the link. If the LCP terminates the link before NCP, the NCP session is also terminated. NCP only terminates the network layer and NCP links. PPP can terminate the link at any time. PPP link termination can occur because of the loss of the carrier including authentication failure, link quality failure, the expiration of an idle-period timer, or the administrative closing of the link. For closing the link, LCP exchanged the Terminate packets.

The device that starts the shutdown process sends a Terminate-Request message. The other device replies with a Terminate-Ack. When the link is closing, PPP informs the network-layer protocols so that they may take suitable action.

PPP session 5

LCP Packet

Figure 1 shows the fields in an LCP packet:

  • Code – This field is 8 bits long and identifies the type of LCP packet.
  • Identifier – The identifier is also 8 bits (one octet) long field in length and is used to match packet requests and replies.
  • Length – The length field is 16 bits long field in length and indicates the total length (including all fields) of the LCP packet.
  • Data – The data field is 0 or more bits in size as indicated by the length field. The format of this field is determined by the code field. Data field contains the information associated with the frame, which may be configuration options, frame information, or data.
PPP session 6

Each LCP packet is a complete LCP message containing an LCP code, an identifier field, a length field indicating the size of the LCP packet and LCP packet type-specific data. Each LCP packet has a specific function in the exchange of configuration information depending on its packet type. The code field of the LCP packet defines the type of the packet. Different LCP packet types are:

Configure-Request – When the LCP Code field value is 0x01, it shows that the packet is the configure-request frame. This frame is used for opening or resetting a PPP connection. It contains a list of LCP option with changes to default values.

Configure-Ack – When the code field value is 0x02, it means that the frame is Configure-Ack field. This frame is sent when all of the value of the last configure-request received is recognized and acceptable. When both PPP peers send and receive Configure-Acks, the LCP negotiation is complete.

Configure-Nak – If the code field value is 0x03, it’s mean that the frame is Configure-NAK frame. This frame is sent When some LCP option is not acceptable and some option is acceptable. The frame includes the mismatching option and their acceptable values.

Configure-Reject – If the code field value is 0x04, the frame type is a Configure-Reject frame. This type of frame is sent when any LCP option is not recognized or accepted. This frame also includes the unrecognized or non-negotiable option.

Terminate-Request – if the code field value is 0x05, the frame is Terminate-Request frame. This frame is sent optionally for closing the PPP session.

Terminate-Ack – if the code field value is 0x06, the frame type is Terminate-Ack. This frame is sent in response to the Terminate-Request frame in PPP session.

Code-Reject – If the code field value is 0x07, the frame type is a Code-Reject frame. This frame is sent when the LCP code is unknown. The Code-Reject message also includes the rejected LCP packet.

Protocol-Reject – When a code field value is set to 0x08, the frame type is Protocol-Reject frame. It is sent when the PPP frame includes an unknown protocol ID. The Protocol-Reject message also includes the rejected LCP packet.

Echo-Request – If the code field value is 0x09, the frame type is Echo-Request. Echo-Request frame is sent optionally to test the PPP connection.

Echo-Reply – When a code field value is 0x0a, the frame type is Echo-Reply. This frame is sent in response to the Echo-Request frame. PPP Echo-Request and Echo-Reply frame are not related to the ICMP Echo-Request and Echo-Reply messages.

Discard-Request – if the code field value is 0x0b, the frame type is Discard-Request. This frame is optionally sent to exercise the link in the outbound direction.