实验要求:用OSPF进行单区域的全网互ping。
注:OSPF是现在最流行的路由协议,如果区域的数据不需要交换到别的非骨干区域则不需要设计多区域,设置单区域需要保证配置的信息中在同一个区域,即区域号一致!配置时还需要设定OSPF的进程号,需要配置子网掩码的反码和区域号,配置的格式如下: Router ospf
Net <网段> <子网掩码的反码> area 实验步骤:
1、 基本的配置。(同EIGRP的基本配置一致) 2、 在R1上的OSPF配置。
r1(config)#router ospf 1 (进程号可以不一致)
r1(config-router)#network 192.168.1.0 0.0.0.255 area 0 (单区域的区域号保持一致) 3、 在R2上的OSPF配置。 r2(config)#router ospf 2
r2(config-router)#network 192.168.1.0 0.0.0.255 area 0 r2(config-router)#network 172.16.0.0 0.0.255.255 area 0 4、 在R3上的OSPF配置。 r3(config)#router ospf 3
r3(config-router)#network 172.16.0.0 0.0.255.255 area 0 r3(config-router)#network 10.0.0.0 0.255.255.255 area 0 5、 在R4上的OSPF配置。 r4(config)#router ospf 4
r4(config-router)#network 10.0.0.0 0.255.255.255 area 0 6、 查看路由表,进行全网互ping。 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 1.0.0.0/8 is directly connected, Loopback0
O 172.16.0.0/16 [110/128] via 192.168.1.2, 00:05:11, Serial1/1 (路由表中的O代表OSPF) O 10.0.0.0/8 [110/192] via 192.168.1.2, 00:03:12, Serial1/1 C 192.168.1.0/24 is directly connected, Serial1/1 r1#ping 10.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 500/520/548 ms
R4#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 500/520/548 ms
十三、配置多区域OSPF.
Area 1 Area 0 10.1.1.255.0.0.0 S1/1 S1/0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 S1/1 172.16.1.2 255.255.0.0 4 10.1.1.1 255.0.0.0 Area 2
192.168.1.1 255.255.255.0 172.16.1.1 255.255.0.0 S1/0 3 实验要求:用OSPF进行多区域的全网互ping。 注:所有非骨干区域进行交换数据的时候,首先将数据发送到骨干区域,再由骨干区域发送给其他非骨干区域。骨干区域的区域号为0,即area 0;不同区域的区域号不同,配置格式: Router ospf
Net <网段> <子网掩码的反码> area 1、 基本的配置。(同单区域的OSPF基本配置一致) 2、 在R1上的OSPF配置。
r1(config)#router ospf 1 (进程号可以不同)
r1(config-router)#network 192.168.1.0 0.0.0.255 area 1 (多区域的区域号不同) 3、 在R2上的OSPF配置。 r2(config)#router ospf 2
r2(config-router)#network 192.168.1.0 0.0.0.255 area 1 r2(config-router)#network 172.16.0.0 0.0.255.255 area 0 4、 在R3上的OSPF配置。 r3(config)#router ospf 3
r3(config-router)#network 172.16.0.0 0.0.255.255 area 0 r3(config-router)#network 10.0.0.0 0.255.255.255 area 2 5、 在R4上的OSPF配置。 r4(config)#router ospf 4
r4(config-router)#network 10.0.0.0 0.255.255.255 area 2 6、查看路由表,进行全网互ping。 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 1.0.0.0/8 is directly connected, Loopback0
O IA 172.16.0.0/16 [110/128] via 192.168.1.2, 00:05:11, Serial1/1 (路由表中O IA表示多区域 O IA 10.0.0.0/8 [110/192] via 192.168.1.2, 00:03:12, Serial1/1 OSPF通过area0 学习的信息) C 192.168.1.0/24 is directly connected, Serial1/1 r1#ping 10.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 500/520/548 ms R4#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 500/520/548 ms
十四、PPP的认证
192.168.1.1 1 255.255.255.0 S1/0 S1/1 192.168.1.1 255.255.255.0
实验要求:在广域网中,实现路由器之间的PPP认证。
注:ppp是广域网路由器之间的传输协议,还有一种是CISCO专业的HDLC协议。Ppp的认证协议有两种PAP(明文)和CHAP(密文),一般选用CHAP,更加可靠!必须两个路由器都配置了相同的PPP信息,才能互相访问。先配置用户信息(username() passward())然后在接口下的配置信息如下: Encapsulation PPP
Ppp authentication chap 实验步骤:
1、 基本参数配置。
Router(config)#hostname R1
2 R1(config)#no ip domain-lookup R1(config)#line con 0
R1(config-line)#logging syn R1(config-line)#exec-timeout 0 R1(config)#interface s1/1 R1(config-if)#no shutdown
R1(config-if)#ip address 192.168.1.1 255.255.255.
Router(config)#hostname R2 R2(config)#no ip domain-lookup R2(config)#line con 0
R2(config-line)#logging syn R2(config-line)#exec-timeout 0 R2(config)#interface s1/0 R2(config-if)#no shutdown
R2(config-if)#ip address 192.168.1.2 255.255.255.0 2、 R1上的PPP配置。
r1(config)#username r2 password 123 (配置username 并设置密码) r1(config)#interface s1/1
r1(config-if)#encapsulation ppp
r1(config-if)#ppp authentication chap r1(config-if)#end
查看R1的接口状态:(只在一端配置PPP,原来联通的接口会自动down,认证不了) r1#show ip interface b
Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 192.168.1.1 YES manual up down Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down ATM2/0 unassigned YES unset administratively down down 在R2上PING R1: r2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: .....(不通)
Success rate is 0 percent (0/5) 3、 在R2上配置PPP。
r2(config)#username r1 password 123 r2(config)#interface s1/0
r2(config-if)#encapsulation ppp
r2(config-if)#ppp authentication chap 查看R1上接口的状态:(在另一端配置了相同的PPP信息后,原来down的接口UP)
r1#show ip int b
Interface IP-Address OK? Method Status Protocol FastEthernet0/0 unassigned YES unset administratively down down Serial1/0 unassigned YES unset administratively down down Serial1/1 192.168.1.1 YES manual up up Serial1/2 unassigned YES unset administratively down down Serial1/3 unassigned YES unset administratively down down ATM2/0 unassigned YES unset administratively down down 在R2上ping R1: r2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: !!!!! (认证成功)
Success rate is 100 percent (5/5), round-trip min/avg/max = 96/142/188 ms
十五、交换机VTP的配置。
F0/0
F0/0
SW1 服务器 VLAN 2、 4
客户模式 SW2
实验要求:在SW1上新建两个VLAN(2和4),并配置成VTP server模式;将SW2配置成VTP client模式,查看VLAN信息。
注:默认情况下交换机所以的端口都属于valn1;
在连接的端口上配置模式为trunk并封装802.1q协议,交换机才能传输多个vlan信息; 在VTP的配置环境下,交换机间的domain和password要保持一致。 实验步骤: 1、 基本配置。
sw1(config)#hostname sw1 sw1(config)#no ip do loo sw1(config)#line con 0
sw1(config-line)#logging syn sw1(config-line)#exec-t 0
sw1(config-line)#interface fa0/0 sw1(config-if)#no shut
sw2(config)#hostname sw2 sw2(config)#no ip do loo sw2(config)#line con 0