PPP的配置

本篇文檔介紹的是PPP協議的PAP和CHAP認證在Cisco路由器上的配置,配置中涉及的簡單命令在這裏就不再重複註釋了……


圖1


一、在路由器Router-A和Router-B上配置、驗證並測試PPP PAP(請參考圖1的拓撲)

1、在路由器Router-A上配置PAP

Router-A>en
Router-A #conf t
Router-A (config)#username RTB password netscene-B(在Router-A中創建用戶名RTB,密碼爲netscene-B,這組用戶名和密碼是Router-B與Router-A進行PAP協商時使用的憑據,需要在Router-A中爲Router-B事先創建好。)
Router-A (config)#int s 0/0
Router-A (config-if)#ip add 192.168.1.1 255.255.255.0
Router-A (config-if)#no shut
Router-A (config-if)#clock rate 64000(因爲兩臺路由器是串口連接,需要將其中一臺路由器的串口配置爲DCE,這裏我們選擇RTA的串口s0/0上配置時鐘速率64000)
Router-A (config-if)#encapsulation ppp (在串行接口上封裝PPP協議)
Router-A (config-if)#ppp authentication pap (雙方進行PPP協商都使用PAP進行驗證)
Router-A (config-if)#ppp pap sent-username RTA password netscene-A (在與Router-B協商時,Router-A會向Router-B發送用戶名爲RTA,密碼爲netscene-A的這組驗證憑據,這組憑據需要事先在Router-B上創建好。)
Router-A (config-if)#end
Router-A#

2、在路由器Router-B上配置PAP

Router-B>en
Router-B#conf t
Router-B(config)#username RTA password netscene-A (在Router-B中創建用戶名RTA,密碼爲netscene-A,這組用戶名和密碼是Router-A與Router-B進行PAP協商時使用的憑據,所以也需要在Router-B中爲Router-A事先創建好。)
Router-B(config)#interface s 0/1
Router-B(config-if)#ip add 192.168.1.2 255.255.255.0
Router-B(config-if)#encapsulation ppp (在串行接口上封裝PPP協議)
Router-B(config-if)#ppp authentication pap (雙方進行PPP協商時都使用PAP進行驗證)
Router-B(config-if)#ppp pap sent-username RTB password netscene-B (在與Router-A協商時,Router-B會向Router-A發送用戶名爲RTB,密碼爲netscene-B的這組驗證憑據,當然這組憑據也已經事先在Router-A上配置好了。)
Router-B(config-if)#end
Router-B#

3、驗證PPP

Router-A#show interface s0/0

Serial0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 192.168.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
LCP Open
Open: IPCP,CDPCP
……
……

爲了方便描述,我已將以上Router-A的s0/0端口輸出的一部分PPP信息隱去,加粗的信息部分很重要:“Serial0/0 isup表明物理端口s0/0已開啓,這也證明該設備的第一層——物理層已爲PPP協商做好了準備;“line protocol is up(connected)表明第二層——數據鏈路層也已經搭建完畢;“Internet address is 192.168.1.1/24”表時該端口已具有了第三層標識——IP地址;以上的輸出信息表明TCP/IP協議棧的下三層均已搭建完成。“EncapsulationPPP說明該接口封裝了PPP協議;“LCP OpenOpen: IPCP說明PPP協商的兩個重要階段——LCP與NCP(IPCP)已協商成功,LCP和NCP(IPCP)這兩個子層已處於“open(打開)”狀態(具體協商過程和原理請參考本站的PPP協議原理的文檔)。
注:路由器Router-B的s0/1端口的PPP輸出信息同Router-A的s0/0端口的輸出信息大同小異,這裏就不再重複了……

4、測試PPP連通性

Router-A#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms

輸出信息中的5個“感嘆號”證明Router-A能夠ping通Router-B,雙方PPP PAP的協商和驗證是成功的。


圖2


二、在路由器Router-A和Router-B上配置、驗證並測試PPP CHAP(請參考圖2的拓撲)

1、在路由器Router-A上配置CHAP

Router-A(config)#username RTB password netscene.net(該指令中設置的密碼必須與Router-B中設置的密碼一致,否則通信兩端通過哈希函數計算出的應答值是無法匹配的,相關原理請參考本站PPP協議運行原理的文檔。)
Router-A(config)#interface s1/1
Router-A(config-if)#ip address 192.168.1.1 255.255.255.0
Router-A (config-if)#no shut
Router-A (config-if)#clock rate 64000
Router-A(config-if)#encapsulation ppp
Router-A(config-if)#ppp authentication chap (雙方進行PPP協商時都使用CHAP進行驗證)
Router-A(config-if)#ppp chap hostname RTA (在與Router-B協商時,Router-A會向Router-B發送用戶名爲RTA的憑據,該憑據已在Router-B中創建並會以明文在網絡上傳送,但是所需密碼是不會在網絡上以明文傳送的。)
Router-A(config-if)#end
Router-A#

2、在路由器Router-B上配置CHAP

Router-B(config)#username RTA password netscene.net(該指令中設置的密碼必須與Router-A中設置的密碼一致,否則通信兩端通過哈希函數計算出的應答值是無法匹配的,相關原理請參考博文中的PPP協議運行原理的文檔。)
Router-B(config)#interface s1/0
Router-B(config-if)#ip address 192.168.1.2 255.255.255.0
Router-B(config-if)#no shut
Router-B(config-if)#encapsulation ppp
Router-B(config-if)#ppp authentication chap(雙方進行PPP協商時都使用CHAP進行驗證)
Router-B(config-if)#ppp chap hostname RTB(在與Router-A協商時,Router-B會向Router-A發送用戶名爲RTB的憑據,該憑據已在Router-A中創建並會以明文在網絡上傳送,但是所需密碼是不會在網絡上以明文傳送的。)
Router-B(config-if)#end
Router-B#

3、測試PPP連通性

Router-A#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms

輸出的信息表明Router-A能夠ping通Router-B,雙方PPP CHAP的協商和驗證也是成功的。 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章