实验28:HDLC 和PPP 封装<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
 1. 实验目的
 通过本实验,读者可以掌握如下技能:
 (1) 串行链路上的封装概念
 (2) HDLC 封装
 (3) PPP 封装
 2. 实验拓扑
 如图:
 
 
3. 实验步骤
 注:
 显示串行接口时,常见以下几种状态:
 Serial0/0/0 is up, line protocol is up
 //链路正常
 Serial0/0/0 is administratively down, line protocol is down
 //没有打开该接口,执行“no shutdown”可以打开接口
 Serial0/0/0 is up, line protocol is down
 //物理层正常,数据链路层有问题,通常是没有配置时钟、两端封装不匹配、PPP 认证错误
 Serial0/0/0 is down, line protocol is down
 //物理层故障,通常是连线问题
 配置如下:
 r0(config)#int s0/0
 r0(config-if)#ip add 172.16.1.1 255.255.255.0
 r0(config-if)#no sh
 r0(config-if)#
 *Mar  1 00:01:31.655: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
 *Mar  1 00:01:32.659: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
 *Mar  1 00:01:57.271: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
 r0(config-if)#
 r0(config-if)#do sh ip int s0/0
 Serial0/0 is up, line protocol is down
   Internet address is 172.16.1.1/24
   Broadcast address is 255.255.255.255
   Address determined by setup command
   MTU is 1500 bytes
   Helper address is not set
   Directed broadcast forwarding is disabled
   Outgoing access list is not set
   Inbound  access list is not set
   Proxy ARP is enabled
   Local Proxy ARP is disabled
   Security level is default
   <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Split horizon is enabled
   ICMP redirects are always sent
   ICMP unreachables are always sent
   ICMP mask replies are never sent
   IP fast switching is enabled
   IP fast switching on the same interface is enabled
   IP Flow switching is disabled
   IP CEF switching is enabled
   IP CEF Fast switching turbo vector
   IP multicast fast switching is enabled
   IP multicast distributed fast switching is disabled
   IP route-cache flags are Fast, CEF
   Router Discovery is disabled
   IP output packet accounting is disabled
   IP access violation accounting is disabled
   TCP/IP header compression is disabled
   RTP/IP header compression is disabled
   Policy routing is disabled
   Network address translation is disabled
   BGP Policy Mapping is disabled
   WCCP Redirect outbound is disabled
   WCCP Redirect inbound is disabled
   WCCP Redirect exclude is disabled
 r0(config-if)#
 *Mar  1 00:03:17.263: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
 r0(config-if)#do sh int s0/0
 Serial0/0 is up, line protocol is up 
   Hardware is GT96K Serial
   Internet address is 172.16.1.1/24
   MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 
      reliability 255/255, txload 1/255, rxload 1/255
   Encapsulation HDLC, loopback not set//该接口的默认封装为HDLC 封装
   Keepalive set (10 sec)
   CRC checking enabled
   Last input 00:00:01, output 00:00:02, output hang never
   Last clearing of "show interface" counters 00:02:53
   Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
   Queueing strategy: weighted fair
   Output queue: 0/1000/64/0 (size/max total/threshold/drops) 
      Conversations  0/1/256 (active/max active/max total)
      Reserved Conversations 0/0 (allocated/max allocated)
      Available Bandwidth 1158 kilobits/sec
   5 minute input rate 0 bits/sec, 0 packets/sec
   5 minute output rate 0 bits/sec, 0 packets/sec
      7 packets input, 764 bytes, 0 no buffer
      Received 7 broadcasts, 0 runts, 0 giants, 0 throttles
      0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
      20 packets output, 1960 bytes, 0 underruns
      0 output errors, 0 collisions, 5 interface resets
      0 output buffer failures, 0 output buffers swapped out
      0 carrier transitions
      DCD=up  DSR=up  DTR=up  RTS=up  CTS=up
 r0(config-if)#
 r0(config-if)#
 r0(config-if)#
 r0(config-if)#enc  
 r0(config-if)#encapsulation ppp
 r0(config-if)#
 *Mar  1 00:04:33.727: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
 r0(config-if)#
 r0(config-if)#do ping 172.16.1.2 
 
Type escape sequence to abort.
 Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
 .....
 Success rate is 0 percent (0/5)
 由于R1还没有封装PPP,链路两端封装不同协议所以PING不通
 
r0(config-if)#
 *Mar  1 00:05:39.947: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
 r0(config-if)#do ping 172.16.1.2
 
Type escape sequence to abort.
 Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
 !!!!!
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/21/64 ms
 链路的两端封装相同,则ping 测试应该正常
 
r0(config-if)#
 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/21/64 ms
 r0(config-if)#do sh int s0/0
 Serial0/0 is up, line protocol is up 
   Hardware is GT96K Serial
   Internet address is 172.16.1.1/24
   MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 
      reliability 255/255, txload 1/255, rxload 1/255
   Encapsulation PPP, LCP Open//该接口的封装为PPP 封装
 
  Open: IPCP, CDPCP, loopback not set//网络层支持IP 和CDP 协议
 
  Keepalive set (10 sec)
   CRC checking enabled
   Last input 00:00:43, output 00:00:02, output hang never
   Last clearing of "show interface" counters 00:03:55
   Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
   Queueing strategy: weighted fair
   Output queue: 0/1000/64/0 (size/max total/threshold/drops) 
      Conversations  0/1/256 (active/max active/max total)
      Reserved Conversations 0/0 (allocated/max allocated)
      Available Bandwidth 1158 kilobits/sec
   5 minute input rate 0 bits/sec, 0 packets/sec
   5 minute output rate 0 bits/sec, 0 packets/sec
      58 packets input, 2928 bytes, 0 no buffer
      Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
      0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
      69 packets output, 3012 bytes, 0 underruns
 r0(config-if)#
 
r1(config)#int s0/0
 r1(config-if)#ip add 172.16.1.2 255.255.255.0
 r1(config-if)#no sh
 r1(config-if)#do sh 
 *Mar  1 00:03:00.043: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
 r1(config-if)#do sh ip int
 *Mar  1 00:03:01.047: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
 r1(config-if)#do sh ip int s0/0
 Serial0/0 is up, line protocol is up
   Internet address is 172.16.1.2/24
   Broadcast address is 255.255.255.255
   Address determined by setup command
   MTU is 1500 bytes
   Helper address is not set
   Directed broadcast forwarding is disabled
   Outgoing access list is not set
   Inbound  access list is not set
   Proxy ARP is enabled
   Local Proxy ARP is disabled
   Security level is default
   Split horizon is enabled
   ICMP redirects are always sent
   ICMP unreachables are always sent
   ICMP mask replies are never sent
   IP fast switching is enabled
   IP fast switching on the same interface is enabled
   IP Flow switching is disabled
   IP CEF switching is enabled
   IP CEF Fast switching turbo vector
   IP multicast fast switching is enabled
   IP multicast distributed fast switching is disabled
   IP route-cache flags are Fast, CEF
   Router Discovery is disabled
   IP output packet accounting is disabled
   IP access violation accounting is disabled
   TCP/IP header compression is disabled
   RTP/IP header compression is disabled
   Policy routing is disabled
   Network address translation is disabled
   BGP Policy Mapping is disabled
   WCCP Redirect outbound is disabled
   WCCP Redirect inbound is disabled
   WCCP Redirect exclude is disabled
 r1(config-if)#
 r1(config-if)#
 r1(config-if)#
 *Mar  1 00:04:57.355: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
 r1(config-if)#do sh int s0/0
 Serial0/0 is up, line protocol is down 
   Hardware is GT96K Serial
   Internet address is 172.16.1.2/24
   MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, 
      reliability 255/255, txload 1/255, rxload 1/255
   Encapsulation HDLC, loopback not set
   Keepalive set (10 sec)
   CRC checking enabled
   Last input 00:00:29, output 00:00:00, output hang never
   Last clearing of "show interface" counters 00:04:13
   Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
   Queueing strategy: weighted fair
   Output queue: 0/1000/64/0 (size/max total/threshold/drops) 
      Conversations  0/1/256 (active/max active/max total)
      Reserved Conversations 0/0 (allocated/max allocated)
      Available Bandwidth 1158 kilobits/sec
   5 minute input rate 0 bits/sec, 0 packets/sec
   5 minute output rate 0 bits/sec, 0 packets/sec
      35 packets input, 2518 bytes, 0 no buffer
      Received 35 broadcasts, 0 runts, 0 giants, 0 throttles
      0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
      18 packets output, 1316 bytes, 0 underruns
      0 output errors, 0 collisions, 3 interface resets
      0 output buffer failures, 0 output buffers swapped out
      0 carrier transitions
      DCD=up  DSR=up  DTR=up  RTS=up  CTS=up
 r1(config-if)#
 r1(config-if)#
 r1(config-if)#
 r1(config-if)#en
 r1(config-if)#encapsulation ppp
 r1(config-if)#
 *Mar  1 00:05:41.015: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
 r1(config-if)#
转载于:https://blog.51cto.com/gauyanm/238099