您的位置:首页 > 其它

cisco路由器上实现的CHAP认证

2010-07-20 17:33 375 查看
在配置PPP验证时有PAP和CHAP的选择,其中PAP为明文传送用户名和口令,不安全;而CHAP则采用哈希值进行验证,口令不会在网上传送,所以安全性比较高。
PC1<------>R1<-------->R2<-------->PC2
说明:PC1的以太口(192.168.10.2)与Router1的以太网接口(192.168.10.1)相连;Router1的Serial 0/0(10.10.10.1)与Router2的Serial 0/0(10.10.10.2)相连,Router1为DCE,Router2为DTE;Router2的以太网接口(192.168.20.1)与 PC2的以太口(192.168.20.2)相连。路由协议采用静态路由,路由器为模拟的Cisco3640.
一、Router1的配置如下:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router1
Router1(config)#interface ethernet 0/0
Router1(config-if)#ip address 192.168.10.1 255.255.255.0
Router1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
Router1(config-if)#exit
Router1(config)#interface serial 0/0
Router1(config-if)#ip address 10.10.10.1 255.255.255.252
Router1(config-if)#clock rate 64000
Router1(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Serial0/0, changed state to up
%LINK-3-UPDOWN: Interface Serial0/0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
Router1(config-if)#exit
%LINK-3-UPDOWN: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
Router1(config)#ip route 192.168.20.0 255.255.255.0 10.10.10.1
Router1(config)#username Router2 password cisco
Router1(config)#interface serial 0/0
Router1(config-if)#encapsulation ppp
%LINK-3-UPDOWN: Interface Serial0/0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
Router1(config-if)#ppp authentication chap
Router1(config-if)#exit
Router1(config)#exit
Router1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
%LINK-3-UPDOWN: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
================================================================
二、Router2的配置如下:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router2
Router2(config)#interface ethernet 0/0
Router2(config-if)#ip address 192.168.20.1 255.255.255.0
Router2(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
Router2(config-if)#exit
Router2(config)#interface serial 0/0
Router2(config-if)#ip address 10.10.10.2 255.255.255.252
Router2(config-if)#no shutdown
%LINK-3-UPDOWN: Interface Serial0/0, changed state to up
Router2(config-if)#exit
Router2(config)#ip route 192.168.10.0 255.255.255.0 10.10.10.2
%LINK-3-UPDOWN: Interface Serial0/0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
Router2(config)#username Router1 password cisco
Router2(config)#interface serial 0/0
Router2(config-if)#encapsulation ppp
Router2(config-if)#ppp authentication chap
%LINK-3-UPDOWN: Interface Serial0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
Router2(config-if)#exit
Router2(config)#exit
Router2#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
==================================================================
三、测试网络的连通性:
1、在PC1上pingPC2=》C:>ping 192.168.20.2
Pinging 192.168.20.2 with 32 bytes of data:
Reply from 192.168.20.2: bytes=32 time=60ms TTL=241
Reply from 192.168.20.2: bytes=32 time=60ms TTL=241
Reply from 192.168.20.2: bytes=32 time=60ms TTL=241
Reply from 192.168.20.2: bytes=32 time=60ms TTL=241
Reply from 192.168.20.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.20.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms
2、在PC2上pingPC1=》C:>ping 192.168.10.2
Pinging 192.168.10.2 with 32 bytes of data:
Reply from 192.168.10.2: bytes=32 time=60ms TTL=241
Reply from 192.168.10.2: bytes=32 time=60ms TTL=241
Reply from 192.168.10.2: bytes=32 time=60ms TTL=241
Reply from 192.168.10.2: bytes=32 time=60ms TTL=241
Reply from 192.168.10.2: bytes=32 time=60ms TTL=241
Ping statistics for 192.168.10.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 50ms, Maximum = 60ms, Average = 55ms

====================================================================
四、查看Serial 0/0的相关信息:
1、Router1#show interfaces serial 0/0
Serial0/0 is up, line protocol is up ------接口与协议均已开启
Hardware is HD64570
Internet address is 10.10.10.1/30
MTU 1500 bytes, BW 1544 Kbit, DLY 1000 usec, rely 255/255, load 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
LCP Open -----开启
Open: IPCP, CDPCP ------开启
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of show interface counters never
Queueing strategy: fifo
2、Router2#show interfaces serial 0/0
Serial0/0 is up, line protocol is up -----接口与协议均已开启
Hardware is HD64570
Internet address is 10.10.10.2/30
MTU 1500 bytes, BW 1544 Kbit, DLY 1000 usec, rely 255/255, load 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)
LCP Open -------开启
Open: IPCP, CDPCP -------开启
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of show interface counters never
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  cisco 路由器 认证