[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 hdlcWarning: 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 hdlcWarning: 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 hdlcWarning: 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 hdlcWarning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
配置完成后,查看串行接口的狀態。以R1上的顯示信息為例。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
[R1]display interface Serial1/0/0Serial1/0/0 current state : UPLine protocol current state : UPLast line protocol up time : 2016-03-10 11:25:08Description:HUAWEI, AR Series, Serial1/0/0 InterfaceRoute Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)Internet Address is 10.0.12.1/24Link layer protocol is nonstandard HDLCLast physical up time : 2016-03-22 22:03:46Last physical down time : 2016-03-22 22:03:44Current system time: 2016-03-22 22:05:39Physical layer is synchronous, Baudrate is 64000 bpsInterface is DCE, Cable type is V35, Clock mode is DCECLK1……output omit……
?
確認該接口的物理狀態和協議狀態均已UP后,檢測直連鏈路的連通性。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
<R2>ping 10.0.12.1 PING 10.0.12.1: 56 data bytes, press CTRL_C to break Reply from 10.0.12.1: bytes=56 Sequence=1 ttl=255 time=44 ms Reply from 10.0.12.1: bytes=56 Sequence=2 ttl=255 time=39 ms Reply from 10.0.12.1: bytes=56 Sequence=3 ttl=255 time=39 ms Reply from 10.0.12.1: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 10.0.12.1: bytes=56 Sequence=5 ttl=255 time=39 ms[R2]ping 10.0.23.3 PING 10.0.23.3: 56 data bytes, press CTRL_C to break Reply from 10.0.23.3: bytes=56 Sequence=1 ttl=255 time=44 ms Reply from 10.0.23.3: bytes=56 Sequence=2 ttl=255 time=39 ms Reply from 10.0.23.3: bytes=56 Sequence=3 ttl=255 time=39 ms Reply from 10.0.23.3: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 10.0.23.3: bytes=56 Sequence=5 ttl=255 time=39 ms
?
步驟四?配置OSPF
在三臺路由器上都啟用OSPF路由協議,并發布各自的直連路由。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
[R1]ospf 1[R1-ospf-1]area 0[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255[R2]ospf 1[R2-ospf-1]area 0[R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255[R2-ospf-1-area-0.0.0.0]network 10.0.23.0 0.0.0.255[R3]ospf 1[R3-ospf-1]area 0[R3-ospf-1-area-0.0.0.0]network 10.0.23.0 0.0.0.255配置完成后,檢查設備是否通過OSPF協議學習到了相應的路由。<R1>display ip routing-table Route Flags: R - relay, D - download to fib----------------------------------------------------------------------------Routing Tables: Public Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost Flags NextHop Interface10.0.23.0/24 OSPF 10 3124 D 10.0.12.2 Serial1/0/0……output omit……
確認相應的路由信息都已通過OSPF協議學習到。
在R1上,執行ping命令,檢測R1和R3間的連通性。
?
?
?
?
?
?
?
<R1>ping 10.0.23.3 PING 10.0.23.3: 56 data bytes, press CTRL_C to break Reply from 10.0.23.3: bytes=56 Sequence=1 ttl=254 time=44 ms Reply from 10.0.23.3: bytes=56 Sequence=2 ttl=254 time=39 ms Reply from 10.0.23.3: bytes=56 Sequence=3 ttl=254 time=39 ms Reply from 10.0.23.3: bytes=56 Sequence=4 ttl=254 time=40 ms Reply from 10.0.23.3: bytes=56 Sequence=5 ttl=254 time=39 ms
?
步驟五?管理串口連接
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
查看串行接口連接的線纜的類型、接口狀態和時鐘頻率,并修改時鐘頻率。<R1>display interface Serial1/0/0Serial1/0/0 current state : UPLine protocol current state : UPLast line protocol up time : 2016-03-10 11:25:08Description:HUAWEI, AR Series, Serial1/0/0 InterfaceRoute Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)Internet Address is 10.0.12.1/24Link layer protocol is nonstandard HDLCLast physical up time : 2016-03-10 11:23:55Last physical down time : 2016-03-10 11:23:55Current system time: 2016-03-10 11:51:12Physical layer is synchronous, Baudrate is 64000 bpsInterface is DCE, Cable type is V35, Clock mode is DCECLK1Last 300 seconds input rate 5 bytes/sec 40 bits/sec 0 packets/secLast 300 seconds output rate 2 bytes/sec 16 bits/sec 0 packets/sec…output omit…
[R1]interface Serial 1/0/0[R1-Serial1/0/0]baudrate 128000
配置完成后,查看串行接口的狀態,確認時鐘頻率已修改。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
<R1>display interface Serial1/0/0Serial1/0/0 current state : UPLine protocol current state : UPLast line protocol up time : 2016-03-10 11:25:08Description:HUAWEI, AR Series, Serial1/0/0 InterfaceRoute Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)Internet Address is 10.0.12.1/24Link layer protocol is nonstandard HDLCLast physical up time : 2016-03-10 11:23:55Last physical down time : 2016-03-10 11:23:55Current system time: 2016-03-10 11:54:19Physical layer is synchronous, Baudrate is 128000 bpsInterface is DCE, Cable type is V35, Clock mode is DCECLK1Last 300 seconds input rate 6 bytes/sec 48 bits/sec 0 packets/secLast 300 seconds output rate 4 bytes/sec 32 bits/sec 0 packets/sec…output omit…
?
步驟六?修改串行接口的封裝類型為PPP
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
在R1和R2以及R2和R3間修改串行接口使用PPP封裝。鏈路兩端必須配置相同的封裝類型,否則接口狀態會出現“Down”的情況。[R1]interface Serial 1/0/0[R1-Serial1/0/0]link-protocol pppWarning: 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 pppWarning: 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 pppWarning: 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 pppWarning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
配置完成后,檢測鏈路連通性。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
<R2>ping 10.0.12.1 PING 10.0.12.1: 56 data bytes, press CTRL_C to break Reply from 10.0.12.1: bytes=56 Sequence=1 ttl=255 time=22 ms Reply from 10.0.12.1: bytes=56 Sequence=2 ttl=255 time=27 ms Reply from 10.0.12.1: bytes=56 Sequence=3 ttl=255 time=27 ms Reply from 10.0.12.1: bytes=56 Sequence=4 ttl=255 time=27 ms Reply from 10.0.12.1: bytes=56 Sequence=5 ttl=255 time=27 ms<R2>ping 10.0.23.3 PING 10.0.23.3: 56 data bytes, press CTRL_C to break Reply from 10.0.23.3: bytes=56 Sequence=1 ttl=255 time=35 ms Reply from 10.0.23.3: bytes=56 Sequence=2 ttl=255 time=40 ms Reply from 10.0.23.3: bytes=56 Sequence=3 ttl=255 time=40 ms Reply from 10.0.23.3: bytes=56 Sequence=4 ttl=255 time=40 ms Reply from 10.0.23.3: bytes=56 Sequence=5 ttl=255 time=40 ms
?
如果無法Ping通,請查看接口狀態,觀察協議狀態是否正常。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
<R1>display interface Serial1/0/0Serial1/0/0 current state : UPLine protocol current state : UPLast line protocol up time : 2016-03-10 12:35:41Description:HUAWEI, AR Series, Serial1/0/0 InterfaceRoute Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)Internet Address is 10.0.12.1/24Link layer protocol is PPPLCP opened, IPCP openedLast physical up time : 2016-03-10 11:57:20Last physical down time : 2016-03-10 11:57:19Current system time: 2016-03-10 13:38:03Physical layer is synchronous, Baudrate is 128000 bpsInterface is DCE, Cable type is V35, Clock mode is DCECLK1Last 300 seconds input rate 7 bytes/sec 56 bits/sec 0 packets/secLast 300 seconds output rate 4 bytes/sec 32 bits/sec 0 packets/sec…output omit…
?
步驟七?檢查路由表項的變化
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
PPP配置完成后,路由器之間會建立數據鏈路層的連接。本地路由器會向遠端路由器發送一條主機路由,路由信息中包含本地接口的IP地址,掩碼為32位。以R2為例,可以查看到R1和R3發送的主機路由。[R2]display ip routing-tableRoute Flags: R - relay, D - download to fib----------------------------------------------------------------------------Routing Tables: Public Destinations : 12 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface10.0.12.0/24 Direct 0 0 D 10.0.12.2 Serial1/0/010.0.12.1/32 Direct 0 0 D 10.0.12.1 Serial1/0/010.0.23.3/32 Direct 0 0 D 10.0.23.3 Serial2/0/0可以看出,路由表中已經包含通往R1和R3的路由。回顧下這兩條路由的由來和功能,回答下面兩個問題:如果配置的是HDLC封裝,路由表中還會有這兩條路由嗎?如果R1和R2上的S1/0/0接口IP地址不在同一網段,它們之間還能夠通過HDLC或PPP實現通信嗎?
[R2]interface Serial 1/0/0[R2-Serial1/0/0]ppp pap local-user huawei password cipher huawei123
?
配置完成后,檢測R1和R2間的連通性,并可以通過debug功能觀察PAP認證報文的交互。
?
<R1>debugging ppp pap packet<R1>terminal debugging<R1>display debuggingPPP PAP packets debugging switch is on<R1>system-view[R1]interface Serial 1/0/0[R1-Serial1/0/0]shutdown[R1-Serial1/0/0]undo shutdownMar 10 2016 14:44:22.440.1+00:00 R1 PPP/7/debug2: PPP Packet: Serial1/0/0 Input PAP(c023) Pkt, Len 22 State ServerListen, code Request(01), id 1, len 18 Host Len: 6 Name:huawei[R1-Serial1/0/0]Mar 10 2016 14:44:22.440.2+00:00 R1 PPP/7/debug2: PPP Packet: Serial1/0/0 Output PAP(c023) Pkt, Len 52 State WaitAAA, code Ack(02), id 1, len 48 Msg Len: 43 Msg:Welcome to use Access ROUTER, Huawei Tech.[R1-Serial1/0/0]return<R1>undo debugging allInfo: All possible debugging has been turned off
?
步驟九?在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[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命令測試連通性。
?
?
<R2>ping 10.0.23.3 PING 10.0.23.3: 56 data bytes, press CTRL_C to break Reply from 10.0.23.3: bytes=56 Sequence=1 ttl=255 time=35 ms Reply from 10.0.23.3: bytes=56 Sequence=2 ttl=255 time=41 ms Reply from 10.0.23.3: bytes=56 Sequence=3 ttl=255 time=41 ms Reply from 10.0.23.3: bytes=56 Sequence=4 ttl=255 time=41 ms Reply from 10.0.23.3: bytes=56 Sequence=5 ttl=255 time=41 ms
[R2]interface Serial 2/0/0[R2-Serial2/0/0]shutdown執行debugging ppp chap all和terminal debugging命令,查看debug信息。[R2-Serial2/0/0]return<R2>debugging ppp chap all<R2>terminal debuggingInfo: Current terminal debugging is on.<R2>display debuggingPPP CHAP packets debugging switch is onPPP CHAP events debugging switch is onPPP CHAP errors debugging switch is onPPP CHAP state change debugging switch is on打開R2的物理接口,發起認證。<R2>system-viewEnter system view, return user view with Ctrl+Z.[R2]interface Serial 2/0/0[R2-Serial2/0/0]undo shutdown此時可以看到相應的debug信息輸出如下:Mar 10 2016 09:10:38.700.1+00:00 R2 PPP/7/debug2: PPP State Change: Serial2/0/0 CHAP : Initial --> ListenChallenge[R2-Serial2/0/0]Mar 10 2016 09:10:38.710.1+00:00 R2 PPP/7/debug2: PPP Packet: Serial2/0/0 Input CHAP(c223) Pkt, Len 25 State ListenChallenge, code Challenge(01), id 1, len 21 Value_Size: 16 Value: fc 9b 56 e1 53 e3 a6 26 1b 54 e5 e2 a1 ed 90 87 Name:[R2-Serial2/0/0]Mar 10 2016 09:10:38.710.2+00:00 R2 PPP/7/debug2: PPP Event: Serial2/0/0 CHAP Receive Challenge Event state ListenChallenge[R2-Serial2/0/0]Mar 10 2016 09:10:38.710.3+00:00 R2 PPP/7/debug2: PPP Packet: Serial2/0/0 Output CHAP(c223) Pkt, Len 31 State ListenChallenge, code Response(02), id 1, len 27 Value_Size: 16 Value: f9 54 1 69 30 59 a0 af 52 a1 1d de 85 77 27 6b Name: huawei[R2-Serial2/0/0]Mar 10 2016 09:10:38.710.4+00:00 R2 PPP/7/debug2: PPP State Change: Serial2/0/0 CHAP : ListenChallenge --> SendResponse[R2-Serial2/0/0]Mar 10 2016 09:10:38.720.1+00:00 R2 PPP/7/debug2: PPP Packet: Serial2/0/0 Input CHAP(c223) Pkt, Len 20 State SendResponse, code SUCCESS(03), id 1, len 16 Message: Welcome to .[R2-Serial2/0/0]Mar 10 2016 09:10:38.720.2+00:00 R2 PPP/7/debug2: PPP Event: Serial2/0/0 CHAP Receive Success Event state SendResponse[R2-Serial2/0/0]Mar 10 2016 09:10:38.720.3+00:00 R2 PPP/7/debug2: PPP State Change: Serial2/0/0 CHAP : SendResponse --> ClientSuccess回顯信息中灰色陰影標注的部分顯示了協商狀態的變化和發送的信息。最后關閉debug功能。[R2-Serial2/0/0]return<R2>undo debugging allInfo: All possible debugging has been turned off