PPP CHAP认证:
路由器使用广域网封装协议:PPP<H3C路由器默认广域网接口封装方式>:
[RTA]int e0/0
[RTA-Ethernet0/0]ip add 192.168.1.1 24
[RTA]int s0/0
[RTA-s0/0]ip add 10.1.1.1 24
[RTB]int e0/0
[RTB-Ethernet0/0]ip add 192.168.2.1 24
[RTB]int s0/0
[RTB-s0/0]ip add 10.1.1.2 24
PCA:192.168.1.2 255.255.255.0 GT:192.168.1.1
PCB:192.168.2.2 255.255.255.0 GT:192.168.2.1
[RTA]ip route-static 192.168.2.0 255.255.255.0 10.1.1.2
[RTB]ip route-static 192.168.1.0 255.255.255.0 10.1.1.1
RTA]int s0/0
[RTA-s0/0]link-protocol ppp
[RTA-s0/0]buadrate 9600
[RTB]int s0/0
[RTB-s0/0]link-protocol ppp
[RTA]disp int s0/0/0
Serial0/0/0 current state: UP
Line protocol current state: UP
Description: Serial0/0/0 Interface
The Maximum Transmit Unit is 1500, Hold timer is 10(sec)
Internet Address is 10.1.1.1/24 Primary
Link layer protocol is PPP
LCP opened, IPCP opened
Output queue : (Urgent queuing : Size/Length/Discards) 0/50/0
Output queue : (Protocol queuing : Size/Length/Discards) 0/500/0
Output queue : (FIFO queuing : Size/Length/Discards) 0/75/0
Interface is V35
608 packets input, 10308 bytes
597 packets output, 10454 bytes
配置CHAP认证方式,主验证方为RTA:
[RTA]local-user chap
[RTA-luser-pap]password cipher chap12345678
[RTA-luser-pap]service-type ppp
[RTA]int s0/0/0
[RTA-Serial0/0/0]link-protocol ppp
[RTA-Serial0/0/0]ppp authentication-mode chap
此时RTA无法访问RTB因为RTB没有被验证:
[RTA-Serial0/0/0]ping 10.1.1.2
PING 10.1.1.3: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 10.1.1.3 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
配置被验证方RTB:
[RTB]int s0/0/0
[RTB-Serial0/0/0]ppp chap user chap
[RTB-Serial0/0/0]link-protocol ppp
此时RTA ,RTB又可以互访了:
[RTB]ping 10.1.1.1
PING 10.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=5 ms
Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 10.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/11/20 ms
C:\Documents and Settings\xiaofei>ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time<1ms TTL=254
Reply from 192.168.2.2: bytes=32 time<1ms TTL=254
Reply from 192.168.2.2: bytes=32 time<1ms TTL=254
Reply from 192.168.2.2: bytes=32 time=1ms TTL=254
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
当需要双向验证时,在RTB上创建用来验证RTA的用户即可。