预配置:第一步:在R1上的预配置R1(config)#int s1/2R1(config-if)#ip add 10.1.1.1 255.255.255.0R1(config-if)#no shR1(
.
预配置:
第一步:在R1上的预配置
R1(config)#int s1/2
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
第二步:在R2上的预配置
R2(config)#int s2/1
R2(config-if)#ip add 10.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
配置过程:
第一步:在R1上查看接口状态
R1#sh int s1/2
Serial1/2 is up, line protocol is up (接口up,协议up)
Hardware is M4T
Internet address is 10.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation HDLC, crc 16, loopback not set, keepalive set (10 sec)
(cisco路由器默认封装为hdlc)
Last input 00:00:09, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); 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)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
10 packets input, 1002 bytes, 0 no buffer
Received 10 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
28 packets output, 1935 bytes, 0 underruns
0 output errors, 0 collisions, 6 interface resets
0 output buffer failures, 0 output buffers swapped out
7 carrier transitions DCD=up DSR=up DTR=up RTS=up CTS=up
第二步:在s1/2下封装hdlc查看结果
R1#sh run int s1/2
Building configuration...
Current configuration:
!
interface Serial1/2
ip address 10.1.1.1 255.255.255.0
no ip directed-broadcast
end
R1(config)#int s1/2 (给s1/2封装hdlc协议)
R1(config-if)#encapsulation hdlc
R1(config-if)#^Z
R1#sh run int s1/2 (查看封装结果)
Building configuration...
Current configuration:
!
interface Serial1/2
ip address 10.1.1.1 255.255.255.0
no ip directed-broadcast (没有结果,代表cisco默认采用hdlc进行封装)
end
R1#
第三步:更改R1接口类型为PPP
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s1/2
R1(config-if)#en
R1(config-if)#encapsulation PPP
R1(config-if)#
R1#sh int s1/2
Serial1/2 is up, line protocol is down (这里line protocol 是down的)
Hardware is M4T
Internet address is 10.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255
Encapsulation PPP, crc 16, loopback not set, keepalive set (10 sec) (协议封装为PPP)
LCP Listen
Closed: IPCP, CDPCP (NCP中的ipcp cdpcp目前是关闭的)
Last input 00:00:02, output 00:00:30, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); 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)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
104 packets input, 6502 bytes, 0 no buffer
Received 97 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
114 packets output, 6883 bytes, 0 underruns
0 output errors, 0 collisions, 6 interface resets
0 output buffer failures, 0 output buffers swapped out
7 carrier transitions DCD=up DSR=up DTR=up RTS=up CTS=up
R1#
第四步:更改R2的接口类型为PPP
R2(config)#
R2(config)#int s2/1
R2(config-if)#encapsulation PPP
R2(config-if)#
第五步:回到R1调试PPP
第六步:使用debug ppp negotiation
R1#debug ppp negotiation
PPP protocol negotiation debugging is on
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s1/2
R1(config-if)#sh
R1(config-if)#
00:13:34: %LINK-5-CHANGED: Interface Serial1/2, changed state to administratively down
R1(config-if)#
00:13:34: Se1/2 IPCP: State is Closed
00:13:34: Se1/2 CDPCP: State is Closed
00:13:34: Se1/2 PPP: Phase is TERMINATING
00:13:34: Se1/2 LCP: State is Closed
00:13:34: Se1/2 PPP: Phase is DOWN
00:13:34: Se1/2 IPCP: Remove route to 10.1.1.2
R1(config-if)#
00:13:35: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to down
R1(config-if)#
R1(config-if)#
R1(config-if)#
R1(config-if)#
R1(config-if)#no sh
R1(config-if)#
00:13:53: Se1/2 CDP: LCP not open, discarding packet
00:13:53: %LINK-3-UPDOWN: Interface Serial1/2, changed state to up
00:13:54: Se1/2 PPP: Treating connection as a dedicated line
00:13:54: Se1/2 PPP: Phase is ESTABLISHING, Active Open
00:13:54: Se1/2 LCP: O CONFREQ [Closed] id 13 len 10
00:13:54: Se1/2 LCP: MagicNumber 0x000CBA09 (0x0506000CBA09)
00:13:54: Se1/2 LCP: I CONFREQ [REQsent] id 2 len 10
00:13:54: Se1/2 LCP: MagicNumber 0x000CDC9B (0x0506000CDC9B)
00:13:54: Se1/2 LCP: O CONFACK [REQsent] id 2 len 10
00:13:54: Se1/2 LCP: MagicNumber 0x000CDC9B (0x0506000CDC9B)
00:13:54: Se1/2 LCP: I CONFACK [ACKsent] id 13 len 10
00:13:54: Se1/2 LCP: MagicNumber 0x000CBA09 (0x0506000CBA09)
00:13:54: Se1/2 LCP: State is Open
00:13:54: Se1/2 PPP: Phase is UP
00:13:54: Se1/2 IPCP: O CONFREQ [Closed] id 2 len 10
00:13:54: Se1/2 IPCP: Address 10.1.1.1 (0x03060A010101)
00:13:54: Se1/2 CDPCP: O CONFREQ [Closed] id 2 len 4
00:13:54: Se1/2 IPCP: I CONFREQ [REQsent] id 2 len 10
00:13:54: Se1/2 IPCP: Address 10.1.1.2 (0x03060A010102)
00:13:54: Se1/2 IPCP: O CONFACK [REQsent] id 2 len 10
00:13:54: Se1/2 IPCP: Address 10.1.1.2 (0x03060A010102)
00:13:54: Se1/2 CDPCP: I CONFREQ [REQsent] id 2 len 4
00:13:54: Se1/2 CDPCP: O CONFACK [REQsent] id 2 len 4
00:13:54: Se1/2 IPCP: I CONFACK [ACKsent] id 2 len 10
00:13:54: Se1/2 IPCP: Address 10.1.1.1 (0x03060A010101)
00:13:54: Se1/2 IPCP: State is Open
00:13:54: Se1/2 CDPCP: I CONFACK [ACKsent] id 2 len 4
00:13:54: Se1/2 CDPCP: State is Open
00:13:54: Se1/2 IPCP: Install route to 10.1.1.2
(可以看到ppp的ncp协议中的ipcp学习到了一条10.1.1.2的路由)
00:13:55: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up
R1(config-if)#
第七步:现在查看一下R1的路由表
R1#sh ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.2/32 is directly connected, Serial1/2 (看到这里确实学到了路由)
C 10.1.1.0/24 is directly connected, Serial1/2
R2的路由表:
R2#sh ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered route
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Serial2/1 (看到这里确实学到了路由)
C 10.1.1.1/32 is directly connected, Serial2/1
R2#