How to configure HDLC and PPP step by step guide and example


In this article I will demonstrate how can you configure wan encapsulation protocols. HDLC is the default encapsulation for synchronous serial links on Cisco routers. You should only use the encapsulation hdlc command to return the link to its default state.

For practical example of HDLC PPP create a simple topology as shown in figure or download this pre configured topology and load it in packet tracer.
Double click on R1 and check the default encapsulation
Router>
Router#show interfaces serial 0/0/0
Serial0/0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 20.0.0.1/8
MTU 1500 bytes, BW 64 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
    [output is omited]
As you can verify that default encapsulation on router is HDLC. A wan link work only when it detects same protocols on same sides. To check it change the default encapsulation to PPP.
Router#configure terminal
Router(config)#interface serial 0/0/0
Router(config-if)#encapsulation ppp
Router(config)#exit
Router#show interfaces serial 0/0/0
Serial0/0/0 is up, line protocol is down (disabled)
Hardware is HD64570
Internet address is 20.0.0.1/8
MTU 1500 bytes, BW 64 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
 [output is omited]
as you can see that line protocols is disable. To enable it set the encapsulation back to HDLC and restart the port with shut down command
Router#configure terminal
Router(config)#interface serial 0/0/0
Router(config-if)#encapsulation hdlc
Router(config-if)#shutdown
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router#show interfaces serial 0/0/0
Serial0/0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 20.0.0.1/8
MTU 1500 bytes, BW 64 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
    [output is omited]

Configuration of PPP

Now we will configure PPP encapsulations on both router. We will also authenticate it with CHAP. Hostname of Router are R1 and R2 and password is vinita.
Double Click on R1 and configure it
Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#username R2 password vinita
R1(config)#interface serial 0/0/0
R1(config-if)#encapsulation ppp
R1(config-if)#ppp authentication chap
R1(config-if)#exit
R1(config)#
Now configure R2 for PPP
Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#username R1 password vinita
R2(config)#interface serial 0/0/0
R2(config-if)#encapsulation ppp
R2(config-if)#ppp authentication chap
R2(config-if)#exit
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0,
changed state to up
R2(config)#

HDLC PPP command reference sheet

Router(config)#interface serial 0/0/0
Moves to interface configuration mode
Router(config-if)#encapsulation hdlc
Sets the encapsulation mode for this interface to HDLC
Router(config)#interface serial 0/0/0
Moves to interface configuration mode
Router(config-if)#encapsulation ppp
Changes encapsulation from default HDLC to PPP
Router(config)#username R1 password vinita
Sets a username of R1 and a password of vinita for authentication from the other side of the PPP serial link. This is used by the local router to authenticate the PPP peer
Router(config)#interface serial 0/0/0
Moves to interface configuration mode.
Router(config-if)#ppp authentication pap
Turns on Password Authentication Protocol (PAP) authentication only
Router(config-if)#ppp authentication chap
Turns on Challenge Handshake Authentication Protocol (CHAP) authentication only.
Router(config-if)#ppp authentication pap chap
Defines that the link will use PAP authentication, but will try CHAP if PAP fails or is rejected by other side.
Router(config-if)#ppp authentication chap pap
Defines that the link will use CHAP authentication, but will try PAP if CHAP fails or is rejected by other side.
Router(config-if)#ppp pap sentusername R1 password vinita
This command must be set if using PAP in Cisco IOS Software Release 11.1 or later
Router#show interfaces serial x
Lists information for serial interface x
Router#show controllers serial x
Tells you what type of cable (DCE/DTE) is plugged into your interface and whether a clock rate has been set
Router#debug serial interface
Displays whether serial keepalive counters are incrementing
Router#debug ppp
Displays any traffic related to PPP
Router#debug ppp packet
Displays PPP packets that are being sent and received
Router#debug ppp negotiation
Displays PPP packets related to the negotiation of the PPP link