##實驗 2-1 HDLC 和 PPP 配置

##實驗 2-1 HDLC 和 PPP 配置
學習目標
 掌握HDLC的基本配置方法
 掌握DCE時鐘波特率的配置方法
 掌握PPP的基本配置方法
 掌握PPP鏈路的PAP認證的配置方法
 掌握PPP鏈路的CHAP認證的配置方法
在這裏插入圖片描述
場景
您是公司的網絡管理員。公司總部有一臺路由器R2,R1和R3分別是其他兩
個分部的路由器。現在您需要將總部網絡和分部網絡通過廣域網連接起來。在廣域網鏈路上嘗試使用HDLC和PPP協議,並在使用PPP協議時配置了不同的認證方式保證安全。
步驟一. 實驗環境準備
如果本任務中您使用的是空配置設備,需要從步驟1開始,然後跳過步驟2。
如果使用的設備包含上一個實驗的配置,請直接從步驟2開始。
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
步驟二. 清除設備上原有的配置
刪除缺省靜態路由的配置並關閉指定的以太網接口。刪除無關的VLAN配置。
[R1]undo ip route-static 0.0.0.0 0
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]shutdown
[R3]undo ip route-static 0.0.0.0 0
[R3]interface GigabitEthernet 0/0/2
[R3-GigabitEthernet0/0/2]shutdown
[S1]undo interface Vlanif 3
[S1]undo interface Vlanif 5
[S1]undo vlan batch 3 5 to 7
Warning: The configurations of the VLAN will be deleted. Continue?[Y/N]:y
Info: This operation may take a few seconds. Please wait for a moment…done.
[S1]interface GigabitEthernet 0/0/1
[S1-GigabitEthernet0/0/1]undo port default vlan
[S1-GigabitEthernet0/0/1]quit
[S1]undo ospf 1
[S2]undo interface Vlanif 5
[S2]undo interface Vlanif 7
[S2]undo vlan batch 3 to 5 7
Warning: The configurations of the VLAN will be deleted. Continue?[Y/N]:y
Info: This operation may take a few seconds. Please wait for a moment…done.
[S2]interface GigabitEthernet 0/0/3
[S2-GigabitEthernet0/0/3]undo port default vlan
[S2-GigabitEthernet0/0/3]quit
[S2]undo ospf 1
[S3]undo interface Vlanif 1
[S4]undo interface Vlanif 1
步驟三. 爲 R1、R2 和 R3 的串行接口配置 IP 地址
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]ip address 10.0.12.1 24
[R2]interface Serial 1/0/0
[R2-Serial1/0/0]ip address 10.0.12.2 24
[R2-Serial1/0/0]quit
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]ip address 10.0.23.2 24
[R3]interface Serial 2/0/0
[R3-Serial2/0/0]ip address 10.0.23.3 24
步驟四. 在串行接口上啓用 HDLC 協議
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R2]interface Serial 1/0/0
[R2-Serial1/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R2-Serial1/0/0]quit
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R3]interface Serial 2/0/0
[R3-Serial2/0/0]link-protocol hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
配置完成後,查看串行接口的狀態。以R1上的顯示信息爲例。
[R1]display interface Serial1/0/0
確認該接口的物理狀態和協議狀態均已UP後,檢測直連鏈路的連通性。
ping 10.0.12.1
步驟五. 配置 RIPv2
在三臺路由器上都啓用RIPv2路由協議,併發布各自的直連路由。
[R1]rip
[R1-rip-1]version 2
[R1-rip-1]network 10.0.0.0
[R2]rip
[R2-rip-1]version 2
[R2-rip-1]network 10.0.0.0
[R3]rip
[R3-rip-1]version 2
[R3-rip-1]network 10.0.0.0
配置完成後,檢查設備是否通過RIPv2協議學習到了相應的路由。
display ip routing-table
步驟六. 管理串口連接
查看串行接口連接的線纜的類型、接口狀態和時鐘頻率,並修改時鐘頻率。
display interface Serial1/0/0
回顯信息表明R1的S1/0/0接口連接的是DCE線纜,時鐘頻率是64000bit/s。
DCE設備可以控制時鐘頻率和帶寬。
將R1和R2間鏈路的時鐘頻率修改爲128000bit/s。這一操作需在DCE設備
R1上執行。
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]baudrate 128000
配置完成後,查看串行接口的狀態確認時鐘頻率已修改。
display interface Serial1/0/0
步驟七. 修改串行接口的封裝類型爲 PPP
在R1和R2以及R2和R3間修改串行接口使用PPP封裝。鏈路兩端必須配置相
同的封裝類型,否則接口狀態會出現“Down”的情況。
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]link-protocol ppp
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R2]interface Serial 1/0/0
[R2-Serial1/0/0]link-protocol ppp
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R2-Serial1/0/0]quit
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]link-protocol ppp
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
[R3]interface Serial 2/0/0
[R3-Serial2/0/0]link-protocol ppp
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
配置完成後,檢測鏈路連通性。
ping 10.0.12.1
ping 10.0.23.3
如果無法Ping通,請查看接口狀態,觀察協議狀態是否正常。
display interface Serial1/0/0
步驟八. 檢查路由表項的變化
PPP配置完成後,路由器之間會建立數據鏈路層的連接。本地路由器會向遠
端路由器發送一條主機路由,路由信息中包含本地接口的IP地址,掩碼爲32位。
以R2爲例,可以查看到R1和R3發送的主機路由。
[R2]display ip routing-table
可以看出,路由表中已經包含通往R1和R3的路由。回顧下這兩條路由的由
來和功能,回答下面兩個問題:
如果配置的是HDLC封裝,路由表中還會有這兩條路由嗎?
如果R1和R2上的S1/0/0接口IP地址不在同一網段,它們之間還能夠通過
HDLC或PPP實現通信嗎?
步驟九. 在 R1 和 R2 間的 PPP 鏈路啓用 PAP 認證功能。
配置PAP認證功能,並將R1配置爲PAP認證方。
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]ppp authentication-mode pap
[R1-Serial1/0/0]quit
[R1]aaa
[R1-aaa]local-user huawei password cipher huawei123
info: A new user added
[R1-aaa]local-user huawei service-type ppp
將R2配置爲PAP被認證方。
[R2]interface Serial 1/0/0
[R2-Serial1/0/0]ppp pap local-user huawei password cipher huawei123
配置完成後,檢測R1和R2間的連通性,並可以通過debug功能觀察PAP認
證報文的交互。
debugging ppp pap packet
terminal debugging
display debugging
PPP PAP packets debugging switch is on
system-view
[R1]interface Serial 1/0/0
[R1-Serial1/0/0]shutdown
[R1-Serial1/0/0]undo shutdown
步驟十. 在 R2 和 R3 間的 PPP 鏈路啓用 CHAP 認證功能
將R3配置爲CHAP的認證方。
[R3]interface Serial 2/0/0
[R3-Serial2/0/0]ppp authentication-mode chap
[R3-Serial2/0/0]quit
[R3]aaa
[R3-aaa]local-user huawei password cipher huawei123
info: A new user added
[R3-aaa]local-user huawei service-type ppp
[R3-aaa]quit
[R3]interface Serial 2/0/0
[R3-Serial2/0/0]shutdown
[R3-Serial2/0/0]undo shutdown
注意,此時R3上會有如下提示:
Mar 10 2016 15:06:00+00:00 R3 %%01PPP/4/PEERNOCHAP(l)[5]:On the interface
Serial2/0/0, authentication failed and PPP link was closed because CHAP was
disabled on the peer.
[R3-Serial2/0/0]
Mar 10 2016 15:06:00+00:00 R3 %%01PPP/4/RESULTERR(l)[6]:On the interface
Serial2/0/0, LCP negotiation failed because the result cannot be accepted.
回顯信息中灰色陰影標註的部分表明與對端認證時失敗。
將R2配置爲CHAP的被認證方。
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]ppp chap user huawei
[R2-Serial2/0/0]ppp chap password cipher huawei123
配置完成後,接口變爲Up狀態。執行ping命令測試連通性。
ping 10.0.23.3
步驟十一. 使用debug 命令查看 R2 和 R3 之間使用CHAP建立PPP
連接的協商過程
查看R2與R3建立PPP連接時的協商情況,爲了看到完整的協商過程,需要
先關閉R2的S2/0/0接口,然後啓動debug命令,再打開接口,即可看到完整協
商過程。
首先關閉R2的物理接口。
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]shutdown
執行debugging ppp chap
執行debugging ppp chap all和terminal debugging命令,查看debug
信息。
[R2-Serial2/0/0]return
debugging ppp chap all
terminal debugging
Info: Current terminal debugging is on.
display debugging
打開R2的物理接口,發起認證。
system-view
Enter system view, return user view with Ctrl+Z.
[R2]interface Serial 2/0/0
[R2-Serial2/0/0]undo shutdown
附加練習:分析並驗證
爲什麼PPP中CHAP認證比PAP認證的安全性更高?
配置文件
[R1]display current-configuration
[V200R007C00SPC600]

sysname R1

aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %%=i~>Xp&aY+*2cEVcS-A23Uwe%%
local-user admin service-type http
local-user huawei password cipher %%B:%I)Io0H8)[%SB[idM3C/!#%%
local-user huawei service-type ppp

interface Serial1/0/0
link-protocol ppp
ppp authentication-mode pap
ip address 10.0.12.1 255.255.255.0
baudrate 128000

rip 1
version 2
network 10.0.0.0

user-interface con 0
authentication-mode password
set authentication password
cipher %%dD#}P<HzJ;Xs%X>hOkm!,.+Iq61QKK6tI}cc-;k_oC.+L,%%
user-interface vty 0 4

return
[R2]display current-configuration
[V200R007C00SPC600]

sysname R2

interface Serial1/0/0
link-protocol ppp
ppp pap local-user huawei password cipher %%u[hr6d<JVHR@->T7xr1<.iv.iv%%$
ip address 10.0.12.2 255.255.255.0

interface Serial2/0/0
link-protocol ppp
ppp chap user huawei
ppp chap password cipher %%e{5h)gh"/Uz0mUC%vEx34&lt;m4&lt;m%%$
ip address 10.0.23.2 255.255.255.0

rip 1
version 2
network 10.0.0.0

user-interface con 0
authentication-mode password
set authentication password
cipher %%|nRPL^hr2IXi7LHDID!/,.%.8%h;3:,hXO2dk#ikaWI.(,%%
user-interface vty 0 4

return
[R3]display current-configuration
[V200R007C00SPC600]

sysname R3

aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %%=i~>Xp&aY+2cEVcS-A23Uwe%%
local-user admin service-type http
local-user huawei password cipher %%fZsyUk1=O=>:L4’ytgR~D
Im%%
local-user huawei service-type ppp

interface Serial2/0/0
link-protocol ppp
ppp authentication-mode chap
ip address 10.0.23.3 255.255.255.0

rip 1
version 2
network 10.0.0.0

user-interface con 0
authentication-mode password
set authentication password
cipher %%W|KaTeX parse error: Expected 'EOF', got '}' at position 5: )M5D}̲v@bY^gK\;>QR,.*…%$
user-interface vty 0 4

return

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