1.封装ppp:

R1(config)#int s0/0
R1(config-if)#encapsulation ppp  //定义封装类型为PPP。
R1(config-if)#no shut
R1(config-if)#ip add 13.1.1.1 255.255.255.0
R1(config)#int s0/0
R1(config-if)#clock rate 64000 
R1#show controllers s0/0
cable type : V.11 (X.21) DCE cable, received clockrate 2015232
 
 
R3(config)#int s0/0                              
R3(config-if)#encapsulation ppp 
R3(config-if)#ip add 13.1.1.3 255.255.255.0
R3(config-if)#no shut
 
调试:
R3#debug  ppp negotiation 
PPP protocol negotiation debugging is on
R3(config-if)#shut
R3(config-if)#no shut
Mar  1 00:15:11.339: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:15:11.343: Se0/0 PPP: Using default call direction
*Mar  1 00:15:11.343: Se0/0 PPP: Treating connection as a dedicated line
*Mar  1 00:15:11.343: Se0/0 PPP: Session handle[5E000003] Session id[3]
*Mar  1 00:15:11.347: Se0/0 PPP: Phase is ESTABLISHING, Active Open
*Mar  1 00:15:11.347: Se0/0 LCP: O CONFREQ [Closed] id 3 len 10
*Mar  1 00:15:11.347: Se0/0 LCP:    MagicNumber 0x0019EC68 (0x05060019EC68)
*Mar  1 00:15:11.455: Se0/0 LCP: I CONFREQ [REQsent] id 72 len 10
*Mar  1 00:15:11.455: Se0/0 LCP:    MagicNumber 0x0019EE38 (0x05060019EE38)
*Mar  1 00:15:11.455: Se0/0 LCP: O CONFACK [REQsent] id 72 len 10
*Mar  1 00:15:11.459: Se0/0 LCP:    MagicNumber 0x0019EE38 (0x05060019EE38)
*Mar  1 00:15:11.459: Se0/0 LCP: I CONFACK [ACKsent] id 3 len 10
*Mar  1 00:15:11.459: Se0/0 LCP:    MagicNumber 0x0019EC68 (0x05060019EC68)
*Mar  1 00:15:11.459: Se0/0 LCP: State is Open
*Mar  1 00:15:11.463: Se0/0 PPP: Phase is FORWARDING, Attempting Forward
*Mar  1 00:15:11.467: Se0/0 PPP: Phase is ESTABLISHING, Finish LCP
*Mar  1 00:15:11.471: Se0/0 PPP: Phase is UP
*Mar  1 00:15:11.471: Se0/0 IPCP: O CONFREQ [Closed] id 1 len 10
*Mar  1 00:15:11.471: Se0/0 IPCP:    Address 13.1.1.3 (0x03060D010103)
*Mar  1 00:15:11.471: Se0/0 CDPCP: O CONFREQ [Closed] id 1 len 4
*Mar  1 00:15:11.475: Se0/0 PPP: Process pending ncp packets
*Mar  1 00:15:11.543: Se0/0 IPCP: I CONFREQ [REQsent] id 1 len 10
*Mar  1 00:15:11.543: Se0/0 IPCP:    Address 13.1.1.1 (0x03060D010101)
*Mar  1 00:15:11.543: Se0/0 IPCP: O CONFACK [REQsent] id 1 len 10
*Mar  1 00:15:11.547: Se0/0 IPCP:    Address 13.1.1.1 (0x03060D010101)
*Mar  1 00:15:11.547: Se0/0 CDPCP: I CONFREQ [REQsent] id 1 len 4
*Mar  1 00:15:11.547: Se0/0 CDPCP: O CONFACK [REQsent] id 1 len 4
*Mar  1 00:15:11.575: Se0/0 CDPCP: I CONFACK [ACKsent] id 1 len 4
*Mar  1 00:15:11.575: Se0/0 CDPCP: State is Open
*Mar  1 00:15:11.575: Se0/0 IPCP:I CONFACK [ACKsent] id 1 len 10
*Mar  1 00:15:11.579: Se0/0 IPCP:    Address 13.1.1.3 (0x03060D010103)
*Mar  1 00:15:11.579: Se0/0 IPCP: State is Open
*Mar  1 00:15:11.587: Se0/0 IPCP: Install route to 13.1.1.1
*Mar  1 00:15:11.595: Se0/0 IPCP: Add link info for cef entry 13.1.1.1
*Mar  1 00:15:12.467: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
2.pap认证的配置和实现:
1)单向:
R3为主认证方:
R3(config)#username cisco password ccna
R3(config)#int s0/0 
R3(config-if)#ppp authentication pap
*Mar  1 00:18:23.019: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down//此时链路会自动关闭的。
R1为被认证方:
R1(config)#int s0/0
R1(config-if)#ppp pap sent-username cisco password ccna
 
R3#debug ppp negotiation 
PPP protocol negotiation debugging is on
*Mar  1 00:25:19.227: Se0/0 PAP: I AUTH-REQ id 5 len 15 from "cisco"
*Mar  1 00:25:19.227: Se0/0 PAP: Authenticating peer cisco
*Mar  1 00:25:19.251: Se0/0 PAP: O AUTH-ACK id 5 len 5
 
2)双向
R1(config)#username yb password hz
R1(config)#int s0/0
R1(config-if)#ppp authentication pap
R1(config-if)#ppp pap sent-username cisco password ccna
R1#show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
Serial0/0                  13.1.1.1        YES manual up                    down  
 
R3(config)#username cisco password ccna
R3(config)#int s0/0 
R3(config-if)#ppp authentication pap
R3(config-if)#ppp pap sent-username yb password hz
*如果你是配了双向的,但是你只是一边写ppp pap sent-username  ** password **接口就会处于关闭的状态。
 
3.CHAP认证的配置和实现:
R3(config)#username R1 password ccna
R3(config)#int s0/0
R3(config-if)#encapsulation ppp
R3(config-if)#ppp authentication chap
*Mar  1 00:10:05.063: Se0/0 PPP: Phase is AUTHENTICATING, by both
*Mar  1 00:10:05.067: Se0/0 CHAP: O CHALLENGE id 2 len 23 from "R3"
*Mar  1 00:10:05.111: Se0/0 CHAP: I CHALLENGE id 3 len 23 from "R1"
*Mar  1 00:10:05.115: Se0/0 CHAP: I RESPONSE id 2 len 23 from "R1"