Ospf+pap+chap
的配置
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
呵呵刚放学,趁热把刚做的实验再从新温习一下。咳,光做拓扑图就浪费了我老大半时间,还有这该死的wps既然也学会卡机了,哦我无语了!好了不耽误大家的时间了,今天我们做的时候是ospf方面的实验,顺便复习一下ppp协议下的pap和chap认证。实验马上开始。
实验拓扑图如上:
第一步:给各个接口配上
ip
地址(这里注意了
R1
和
R2
,
R3
和
R4
直接我们跑
的是串口用
s
表示,
R2
和
R3
之间则是跑的以太网接口用
e
表示)
R1(config)# interface s0/1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdwon
同理对R2, R3 R4配上如上图的ip地址这里我不再配置(O(∩_∩)O~我是学会一个偷懒的家伙)
第二步在各个接口上跑
ospf
协议,我们把
192.168.2.1 192.168.2.2
接口划为
area0
192.168.1.2和192.168.1.1划为area1 ;192.168.3.1 和192.168.3.2划为area2
在R1上的配置
R1(config)# router ospf 100
R1(config-router)#network 192.168.1.0 0.0.0.255 area 1
在R2上的配置
R2(config)# router ospf 100
R2(config-router)#network 192.168.1.0 0.0.0.255 area 1
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
在R3上的配置
R3(config)# router ospf 100
R3(config-router)#network 192.168.3.0 0.0.0.255 area 2
R3(config-router)#network 192.168.2.0 0.0.0.255 area 0
在R4上的配置
R4(config)# router ospf 100
R4(config-router)#network 192.168.3.0 0.0.0.255 area 2
简单吧有点想
rip
的配置喽,其实两者本来就有许多的相同的和不同的
下面我们检查一下
R1#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, Serial0/1
O IA 192.168.2.0/24 [110/74] via 192.168.1.2, 00:35:08, Serial0/1
O IA 192.168.3.0/24 [110/138] via 192.168.1.2, 00:34:52, Serial0/1
R2#show ip route
Router>#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, Serial1/0
C 192.168.2.0/24 is directly connected, Ethernet0/0
O IA 192.168.3.0/24 [110/74] via 192.168.2.2, 00:35:41, Ethernet0/0
呵呵学到了,R3 R4上的查看我就偷懒省去了哦,大家做实验的时候可步要像我这样哦,我是一个爱偷懒的家伙O(∩_∩)O~
注意了下面关键的时候到了我们ping一下看看是否可以ping通,噢好激动啊。我们用R1去ping R4
R1# ping192.168.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/30/84 ms
我喜欢的大叹号出来了,哈哈通了!!
实验当中还有两个重要查命令需要我们掌握他们是show ip ospf 接口和show ip ospf neighbor下面我们来解释一下这两个命令的具体含义。我是在R4上打的这两个命令,命令如下:
Router>show ip ospf inter s0/1
Serial0/1 is up, line protocol is up
Internet Address 192.168.3.2/24, Area 2
Process ID 100, Router ID 192.168.3.2, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:03
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.3.1
Suppress hello for 0 neighbor(s)
Router>show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.1 0 FULL/ - 00:00:30 192.168.3.1 Serial0/1
下面我们开始做这个实验的第二部分在R1和R2 上跑ppp链路并且配置pap认证R3 和R4也跑ppp链路并且配置chap认证
第一步当然是配置
ip
地址了,这里我不再啰嗦了,依然用上图的
ip
地址,配置步骤这里省
略.........行。我们现在R1 R2上封装ppp协议
R1(config)#interface s0/1
R1(config-if)#encapsulation ppp
R2(config)#interface s1/0
R2(config-if)#encapsulation ppp
第二步
我们指定R2为主认证方,并且在其上进行pap封装。同时做好数据库的准备,也就是做好用户名和密码的准备,以便等待R1放送用户名和密码的时候查看自己的数据库进行认证
R2(config)#usname zhangyu passwor aaa
第三步在
R1
(被认证方)上发送用户名和密码
R1(config)#interface s 0/1
R1(config-if)#ppp pap sent-username zhangyu password aaa
最后验证在R1上去ping R2如果通,则实验成功
第一步封装
ppp
协议
R4(config)#interface s0/1
R4(config-if)#encapsulation ppp
R3(config)#interface s1/0
R3(config-if)#encapsulation ppp
第二步指定
R3
为主认证方
R3(config)#intface s1/0
R3(config-if)#ppp authentication chap
R3(config)#username R4 password aaa
第三步在
R4
配置用户名和密码
R4(config)#username R3 password aaa
最后R3 ping R4测试网络连通性
大家注意到pap和chap的区别了没有,对了配置命令基本相同,首先都有到链路上封装ppp协议,指定主认证方。但是配置pap认证的时候主认证方和被认证方的用户名必须一直。而chap的用户名必须是对方的用户名。这是因为pap认证的时候需要在链路上用到用户名和密码,而chap只是用到用户名,不需要在链路上用到密码,因此chap比pap更安全。
转载于:https://blog.51cto.com/nanwangting/143401