CCNA实验大全

更新时间:2024-06-14 01:59:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

CCNA实验大全

一、CDP 的配置。

192.168.1.1 192.168.1.2 2 S1/1 1 S1/1 S1/0 172.16.1.1

172.16.1.2

S1/0 3

要求:a、 配置接口的信息。

b 、R1能ping通R2,R2能ping通R3;

c、在R2 S1/0关闭cdp,使R1不能发现R2,但R3可以发现R2;

d、 R2在全局的模式下关闭cdp,让所有的路由器间不能相互发现对方。 注:如果路由器之间连接帧中继,需要封装encapsulation frame-relay 步骤:1、配置基本信息 Router(config)#hostname R1 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.0 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 R2(config-if)#exit

Router(config)#interface s1/1 R2(config-if)#no shutdown

R2(config-if)#ip address 172.16.1.1 255.255.0.0

Router(config)#hostname R3 R3(config)#no ip domain-lookup R3(config)#line con 0

R3(config-line)#logging syn R3(config-line)#exec-timeout 0 R3(config)#interface s1/0

R3(config-if)#no shutdown

R3(config-if)#ip address 172.16.1.2 255.255.0.0 2、R1能ping通R2,R2能ping通R3; r1#ping 192.168.1.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 48/56/88 ms R2#ping 172.16.1.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 48/56/88 ms 3在R2 S1/0关闭cdp,使R1不能发现R2,但R3可以发现R2; r1#show cdp neighbors

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID

R2 Ser 1/1 147 R 7206VXR Ser 1/0 在R2s1/0关闭cdp:(直关闭接口的CDP) R2(config)#interface s1/0

R2(config-if)#no cdp enable 在R1查询cdp的邻居(60s): r1#show cdp neighbors

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID (没有邻居) 在R3查询cdp的邻居(60s): r3#show cdp neighbors

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID

R2 Ser 1/0 132 R 7206VXR Ser 1/1 4、R2在全局的模式下关闭cdp,让所有的路由器间不能相互发现对方。 先在R2的s1/0开启cdp,然后在配置no cdp run (关闭整个路由的CDP)

R2(config)#no cdp run r1#show cdp neighbors

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge

S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID r3#show cdp ne

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port ID (没有邻居)

二、 远程控制(TELNET)

192.168.1.1 S1/1 2 S1/1 1 S1/0 192.168.1.2 172.16.1.2 S1/0 3

实验要求:a、基本配置;

b、R1能够telnet R2,进行控制,R2能够telnetR3,R3能够telnet R1; 注:需要配置特权密码和虚拟端口的密码。 实验步骤: 1、 基本的配置

Router(config)#hostname R1 R1(config)#no ip domain-lookup r1(config)#enable password 123 r1(config)#line vty 0 4 r1(config-line)#password 1234 r1(config-line)#login r1(config-line)#exit 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.0

Router(config)#hostname R2 R2(config)#no ip domain-lookup R2(config)#enable password 123 R2(config)#line vty 0 4 R2(config-line)#password 1234 R2(config-line)#login R2(config-line)#exit 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 R2(config-if)#exit

Router(config)#interface s1/1 R2(config-if)#no shutdown

172.16.1.1 R2(config-if)#ip address 172.16.1.1 255.255.0.0 Router(config)#hostname R3 R3(config)#enable password 123 R3(config)#line vty 0 4 R3(config-line)#password 1234 R3(config-line)#login R3(config-line)#exit

R3(config)#no ip domain-lookup R3(config)#line con 0

R3(config-line)#logging syn R3(config-line)#exec-timeout 0 R3(config)#interface s1/0 R3(config-if)#no shutdown

R3(config-if)#ip address 172.16.1.2 255.255.0.0 2、 R1 telnet R2 R1#telnet 192.168.1.2

Trying 192.168.1.2 ... Open User Access Verification Password: R2>en Password: R2#

3、 R2 telnet R3 R2#telnet 172.16.1.2

Trying 172.16.1.2 ... Open User Access Verification Password: R3>en Password: R3#

4、 R3 telnet R1 R3#telnet 192.168.1.1

Trying 192.168.1.1 ... Open User Access Verification Password: R1>en Password: R1#

三、 静态路由的配置

10.1.1.2

Loopback 0 3.3.3.3 4 Loopback 0 1.1.1.1 1 192.168.1.1 2 S1/0 10.1.1.1 172.16.1.1 S1/1 S1/1 3 172.16.1.2 S1/1 S1/0 192.168.1.2 S1/0

实验要求:使用静态路由实现全网互PING。

注:在全局模式下,格式ip route <目的网段> <子网掩码> <下一跳路由地址>/<接口> 实验步骤: 1、基本配置

Router(config)#hostname R1 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.0 R1(config-if)#exit

r1(config)#interface loopback 0

r1(config-if)#ip address 1.1.1.1 255.0.0.0

路由器2、3和4如R1配置。(R4需要配置lookback口) 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 R2(config-if)#exit

Router(config)#interface s1/1 R2(config-if)#no shutdown

R2(config-if)#ip address 172.16.1.1 255.255.0.0

Router(config)#hostname R3 R3(config)#no ip domain-lookup R3(config)#line con 0

R3(config-line)#logging syn R3(config-line)#exec-timeout 0 R3(config)#interface s1/0 R3(config-if)#no shutdown

R3(config-if)#ip address 172.16.1.2 255.255.0.0 R2(config-if)#exit

Router(config)#interface s1/1 R2(config-if)#no shutdown

R2(config-if)#ip address 10.1.1.1 255.0.0.0

Router(config)#hostname R4 R4(config)#no ip domain-lookup R4(config)#line con 0

R4(config-line)#logging syn R4(config-line)#exec-timeout 0 R4(config)#interface s1/0 R4(config-if)#no shutdown

R4(config-if)#ip address 10.1.1.2 255.0.0.0 R4(config-if)#exit

R4(config)#interface loopback 0

R4(config-if)#ip address 3.3.3.3 255.0.0.0

通告show ip interface brief 查看所配置的接口。 2.在R1上配置静态路由。

r1(config)#ip route 172.16.0.0 255.255.0.0 192.168.1.2 r1(config)#ip route 10.0.0.0 255.0.0.0 192.168.1.2 r1(config)#ip route 3.0.0.0 255.0.0.0 192.168.1.2 3.在R2上配置静态路由。

r2(config)#ip route 1.0.0.0 255.0.0.0 192.168.1.1 r2(config)#ip route 10.0.0.0 255.0.0.0 172.168.1.2 r2(config)#ip route 3.0.0.0 255.0.0.0 172.16.1.2 4.在R3上配置静态路由。

r3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.1 r3(config)#ip route 1.0.0.0 255.0.0.0 172.16.1.1 r3(config)#ip route 3.0.0.0 255.0.0.0 10.1.1.2 5.在R4上配置静态路由。

r4(config)#ip route 1.0.0.0 255.0.0.0 10.1.1.1

r4(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.1 r4(config)#ip route 172.16.0.0 255.255.0.0 10.1.1.1

可在特权模式下show ip route 查看路由表的信息。如: 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 C 1.0.0.0/8 is directly connected, Loopback0 S 3.0.0.0/8 [1/0] via 192.168.1.2

S 172.16.0.0/16 [1/0] via 192.168.1.2 (C 代表直连connected,S 代表静态路由) S 10.0.0.0/8 [1/0] via 192.168.1.2

C 192.168.1.0/24 is directly connected, Serial1/1 6.进行全网互ping。 在R1中ping 3.3.3.3 Ping 10.1.1.2 Ping 172.16.1.2 r1#ping 3.3.3.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 332/360/412 ms

四、 默认路由的配置。

10.1.1.2

Loopback 0 3.3.3.3 4 Loopback 0 1.1.1.1 1 192.168.1.1 2 S1/0 10.1.1.1 S1/1 172.16.1.1 S1/1 3 172.16.1.2 S1/1 S1/0 192.168.1.2 S1/0

实验要求;使用默认路由的配置进行全网互ping。

注:链路的来回不能同时配置默认路由,否则不能达到全网互ping 默认路由的格式为:ip route 0.0.0.0 0.0.0.0 <下一跳路由IP地址> 实验步骤:

1. 基本配置同静态路由实验的配置一致。 2. 在R1上的配置。

r1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2 3. 在R2上的配置。

r2(config)#ip route 0.0.0.0 0.0.0.0 172.16.1.2 r2(config)#ip route 1.0.0.0 255.0.0.0 192.168.1.1 4. 在R3上的配置。

r3(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2

r3(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.1 r3(config)#ip route 1.0.0.0 255.0.0.0 172.168.1.1 5. 在R4上的配置。

r4(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1 6.进行全网互ping。 在R1中ping 3.3.3.3 Ping 10.1.1.2 Ping 172.16.1.2 r1#ping 3.3.3.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 332/360/412 ms 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 = 340/422/536 ms r1#ping 172.16.1.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 264/296/356 ms

五、RIP的配置

10.1.1.255.0.0.0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 172.16.1.1 255.255.0.0 S1/0 3 S1/1 172.16.1.2 255.255.0.0 S1/1 S1/0 4 192.168.1.1 255.255.255.0 10.1.1.1 255.0.0.0

实验要求:使用RIP协议进行全网互PING。

注:router rip进入RIP模式,格式network <目的网段> 实验步骤:

1、 基本信息的配置。 Router(config)#hostname R1

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.0

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 R2(config-if)#exit

Router(config)#interface s1/1 R2(config-if)#no shutdown

R2(config-if)#ip address 172.16.1.1 255.255.0.0

R3(config)#line con 0

R3(config-line)#logging syn R3(config-line)#exec-timeout 0 R3(config)#interface s1/0 R3(config-if)#no shutdown

R3(config-if)#ip address 172.16.1.2 255.255.0.0 R2(config-if)#exit

Router(config)#interface s1/1 R2(config-if)#no shutdown

R2(config-if)#ip address 10.1.1.1 255.0.0.0

Router(config)#hostname R4 R4(config)#no ip domain-lookup R4(config)#line con 0

R4(config-line)#logging syn R4(config-line)#exec-timeout 0 R4(config)#interface s1/0 R4(config-if)#no shutdown

R4(config-if)#ip address 10.1.1.2 255.0.0.0 2、 在R1上配置RIP. r1(config)#router rip

r1(config-router)#network 192.168.1.0 3、 在R2上配置RIP.

r2(config)#router rip

r2(config-router)#network 192.168.1.0 r2(config-router)#network 172.16.0.0 4、 在R3上配置RIP. r3(config)#router rip

r3(config-router)#network 172.16.0.0 r3(config-router)#network 10.0.0.0 5、 在R4上配置RIP. r4(config)#router rip

r4(config-router)#network 10.0.0.0

6. 用show ip route 查看路由表,并进行全网互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

R 172.16.0.0/16 [120/1] via 192.168.1.2, 00:00:23, Serial1/1

R 10.0.0.0/8 [120/2] via 192.168.1.2, 00:00:23, Serial1/1 (路由表中R代表RIP) C 192.168.1.0/24 is directly connected, Serial1/1 r1#ping 10.1.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 220/242/264 ms

六、 RIP v2的配置。

10.1.1.255.0.0.0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 172.16.1.1 255.255.0.0 S1/0 3 S1/1 172.16.1.2 255.255.0.0 S1/1 S1/0 4 192.168.1.1 255.255.255.0 10.1.1.1 255.0.0.0

实验要求:用RIP v2进行全网互ping。 注:必须进入version 2.

实验步骤:

1、 基本信息的配置同RIP一致。 2、 在R1上的配置。 r1(config)#router rip

r1(config-router)#version 2

r1(config-router)#network 192.168.1.0 3、 在R2上的配置。 r2(config)#router rip

r2(config-router)#version 2

r2(config-router)#network 192.168.1.0 r2(config-router)#network 172.16.0.0 4、 在R3上的配置。 r3(config)#router rip

r3(config-router)#version 2

r3(config-router)#network 172.16.0.0 r3(config-router)#network 10.0.0.0 5、 在R4上的配置。 r4(config)#router rip

r4(config-router)#version 2

r4(config-router)#network 10.0.0.0

6、 用show ip route 查看路由表,并进行全网互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

R 172.16.0.0/16 [120/1] via 192.168.1.2, 00:00:23, Serial1/1 R 10.0.0.0/8 [120/2] via 192.168.1.2, 00:00:23, Serial1/1 C 192.168.1.0/24 is directly connected, Serial1/1 r1#ping 10.1.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 220/242/264 ms

七、 RIP V2的汇总。 172.16.1.1 255.255.255.0 172.16.2.1 255.255.255.0

实验要求:用RIP V2 进行路由汇总。

注:在Version 2下才能做RIP路由汇总。路由汇总默认是启动的auto-summary。 也可以再接口下实现汇总,格式 ip summary-address rip <网段> <标准子网掩码> 实验步骤: 1、 基本配置

Router(config)#hostname R1 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. r1(config-if)#exit

r1(config)#interface loopback 0

r1(config-if)#ip address 172.16.1.1 255.255.255.0 r1(config-if)#exit

r1(config)#interface loopback 1

r1(config-if)#ip address 172.16.2.1 255.255.255.0 r1(config-if)#end

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、 在R2查看路由汇总信息。 r2#show ip route

R1 R2 S1/1 A 192.168.1.1/24 S1/0 B 192.168.1.2/24 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 172.16.0.0/16 is directly connected, Serial1/1 C 192.168.1.0/24 is directly connected, Serial1/0 3、禁用路由汇总,在R1中的s1/1上配置接口汇总。 r1(config)#router rip

r1(config-router)#version 2

r1(config-router)#no auto-summary r1(config-router)#exit r2#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 172.16.1.1/16 is directly connected, Serial1/1

C 172.16.2.1/16 is directly connected, Serial1/1 (取消了路由汇总) C 192.168.1.0/24 is directly connected, Serial1/0

r1(config)#interface s1/1

r1(config-if)#ip summary-address rip 172.16.0.0 255.255.0.0 r1(config-if)#end

4、在R2查看路由汇总信息。 r2#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 172.16.0.0/16 is directly connected, Serial1/1 C 192.168.1.0/24 is directly connected, Serial1/1

八、 R1 RIP V2的认证。 S1/1 S1/0 B 192.168.1.2 R2 1.1.1.1 A 192.168.1.1

实验要求:在R1’R2上配置认证信息,保证能互ping。

注:在RIP version 2才能做认证。认证信息中name可以不一致,但password要一致才能相

互认证。直连的两台路由即使设置了认证不一致,也能连通!认证支持明文和密文。 实验步骤:

1、 基本信息的配置

Router(config)#hostname R1 R1(config)#no ip domain-lookup R1(config)#line con 0

R1(config-line)#logging syn R1(config-line)#exec-timeout 0 r1(config)#router rip

r1(config-router)#version 2

r1(config-router)#network 192.168.1.0 r1(config-router)#network 1.0.0.0 R1(config)#interface s1/1 R1(config-if)#no shutdown

R1(config-if)#ip address 192.168.1.1 255.255.255 R1(config)#interface lookback 0

R1(config-if)#ip address 1.1.1.1 255.0.0.0

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 r1(config)#router rip

r1(config-router)#version 2

r1(config-router)#network 192.168.1.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的s1/1接口上配置认证信息,检测R2能否访问。 r1(config)#key chain ccna r1(config-keychain)#key 1

r1(config-keychain-key)#key-string 123 r1(config)#interface s1/1

r1(config-if)#ip rip authentication key-chain ccna r1(config-if)#ip rip authentication mode text r1(config-if)#end r2#ping 1.1.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的s1/0接口上配置认证信息,检测R2能否访问。 R2(config)#key chain ccnp (名称可以不同) R2(config-keychain)#key 1

R2(config-keychain-key)#key-string 123 (密码一定要相同) R2(config)#interface s1/0

R2(config-if)#ip rip authentication key-chain ccnp

R2(config-if)#ip rip authentication mode text (text明文) R2(config-if)#end R2#ping 1.1.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 = 100/152/208 ms

九、 EIGRP的配置。

10.1.1.255.0.0.0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 172.16.1.1 255.255.0.0 S1/0 3 S1/1 172.16.1.2 255.255.0.0 S1/1 S1/0 4 192.168.1.1 255.255.255.0 10.1.1.1 255.0.0.0

实验要求:用EIGRP进行全网互ping。

注:EIGRP是思科专用的路由协议,配置EIGRP是必须配置AS号,而且各路由器的

AS号必须一致,才能互ping。 实验步骤:

1.基本信息的配置。(同RIP的基本配置一致) 2.在R1上的配置。

r1(config)#router eigrp 100

r1(config-router)#network 192.168.1.0 3.在R2上的配置。

r2(config)#router eigrp 100

r2(config-router)#network 192.168.1.0 r2(config-router)#network 172.16.0.0 4.在R3上的配置。

r3(config)#router eigrp 100 r3(config-router)#net 172.16.0.0 r3(config-router)#network 10.0.0.0 5.在R4上的配置。

r4(config)#router eigrp 100 r4(config-router)#net 10.0.0.0

6.用show ip route查看配置的路由表,进行全网互ping。 r4#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

D 172.16.0.0/16 [90/2681856] via 10.1.1.1, 00:00:41, Serial1/0 C 10.0.0.0/8 is directly connected, Serial1/0

D 192.168.1.0/24 [90/3193856] via 10.1.1.1, 00:00:41, Serial1/0 (D表示EIGRP) 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 = 408/454/504 ms 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 = 144/229/288 ms

十、 EIGRP的路由汇总。

错误!

R1 172.16.1.1

255.255.255.0

172.16.2.1

S1/1 A 192.168.1.1/24 S1/0 B R2 192.168.1.2/24 255.255.255.0

实验要求:使用EIGRP进行两种方式的路由汇总。

注:实现汇总有两种方式,一种是aut-summary 默认下开启,也可以再接口下实现汇总, 格式 ip summary-address eigrp <网段> <标准子网掩码> 实验步骤:

1. 基本信息的配置。 Router(config)#hostname R1 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. r1(config-if)#exit

r1(config)#interface loopback 0

r1(config-if)#ip address 172.16.1.1 255.255.255.0 r1(config-if)#exit

r1(config)#interface loopback 1

r1(config-if)#ip address 172.16.2.1 255.255.255.0 r1(config-if)#exit

r1(config)#router eigrp 100

r1(config-router)#net 172.16.0.0 255.255.0.0 r1(config-router)#net 192.168.1.0 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 R2(config-if)#exit

R2(config)#router eigrp 100

R2(config-router)#net 192.168.1.0 2. 在R2查看路由汇总信息 r2#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

D 172.16.0.0/16 is directly connected, Serial1/1 (路由自动汇总) C 192.168.1.0/24 is directly connected, Serial1/0

3. 禁用路由汇总并查看R2的路由表,在R1中的s1/1上配置接口汇总。 r1(config)#router eigrp 100

r1(config-router)#no auto-summary r1(config-router)#exit

r2#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

172.16.0.0/24 is subnetted, 2 subnets

D 172.16.1.0 [90/2297856] via 192.168.1.1, 00:00:02, Serial1/0

D 172.16.2.0 [90/2297856] via 192.168.1.1, 00:00:02, Serial1/0 (取消路由自动汇总) C 192.168.1.0/24 is directly connected, Serial1/0

在s1/1配置接口汇总: r1(config)#interface s1/1

r1(config-if)#ip summary-address eigrp 100 172.16.0.0 255.255.0.0 4. 在R2查看路由汇总信息。 r2#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

D 172.16.0.0/16 is directly connected, Serial1/1 (接口设置后的路由汇总) C 192.168.1.0/24 is directly connected, Serial1/0

R1 1.1.1.1 十一、EIGRP的认证。 S1/1 S1/0 A 192.168.1.1 B 192.168.1.2 R2 3.3.3.3

实验要求:在两个接口上进行路由信息的验证。

注:认证信息中name可以不一致,但password要一致才能相互认证。直连的两台路由即使

设置了认证不一致,也能连通!认证只支持密文MD5。注意格式与RIP V2的区别, Ip authentication key-chain eigrp Ip authentication mode eigrp md5 实验步骤:

1.配置基本信息。

Router(config)#hostname R1 R1(config)#no ip domain-lookup R1(config)#line con 0

R1(config-line)#logging syn R1(config-line)#exec-timeout 0 r1(config)#router eigrp 100

r1(config-router)#network 192.168.1.0 r1(config-router)#network 1.0.0.0 R1(config)#interface s1/1 R1(config-if)#no shutdown

R1(config-if)#ip address 192.168.1.1 255.255.255 R1(config)#interface lookback 0

R1(config-if)#ip address 1.1.1.1 255.0.0.0

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)#router eigrp 100

R2(config-router)#network 192.168.1.0 R2(config-router)#net 3.0.0.0 R2(config)#interface s1/0

R2(config-if)#ip address 192.168.1.2 255.255.255.0 R2(config-if)#no shutdown

R2(config)#interface lookback 0

R2(config-if)#ip address 3.3.3.3 255.0.0.0

2.在R1的s1/1口上配置认证信息,检测R2能否访问R1。 r1(config)#key chain ccna r1(config-keychain)#key 1

r1(config-keychain-key)#key-string 123 r1(config-keychain-key)#exi r1(config-keychain)#exi r1(config)#interface s1/1

r1(config-if)#ip authentication key-chain eigrp 100 ccna (注意格式与RIP的区别) r1(config-if)#ip authentication mode eigrp 100 md5 r1(config-if)#end

r2#ping 1.1.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 (0/5)

3.在R2的s1/0口上配置与R1 s1/1口相同的认证信息,ping通。 R2(config)#key chain ccnp (名字可以不同) R2(config-keychain)#key 1

R2(config-keychain-key)#key-string 123 (密码一定相同) R2(config-keychain-key)#exi R2(config-keychain)#exi R2(config)#interface s1/0

R2(config-if)#ip authentication key-chain eigrp 100 ccnp R2(config-if)#ip authentication mode eigrp 100 md5 R2(config-if)#end

r2#ping 1.1.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 = 52/107/144 ms

十二、OSPF单区域配置。

10.1.1.255.0.0.0 192.168.1.1 255.255.255.0 S1/1 1 2 S1/0 172.16.1.1 255.255.0.0 S1/0 3 S1/1 172.16.1.2 255.255.0.0 S1/1 S1/0 4 192.168.1.1 255.255.255.0 10.1.1.1 255.0.0.0

实验要求:用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

sw2(config-line)#logging syn sw2(config-line)#exec-t 0

sw2(config-line)#interface fa0/0 sw2(config-if)#no shut

2、 在交换机1上的配置。

a. 新建两个vlan,vlan2和vlan4

sw1#vlan database (进入vlan配置模式) sw1(vlan)#vlan 2 name vlan2 VLAN 2 added: Name: vlan2

sw1(vlan)#vlan 4 name vlan4 VLAN 4 added: Name: vlan4

sw1(vlan)#exi (只能exit 才能退出) APPLY completed. Exiting....

b.配置VTP为server。 sw1#vlan database

sw1(vlan)#vtp server (配置VTP的模式) Device mode already VTP SERVER.

sw1(vlan)#vtp domain yu (配置vtp域名) Changing VTP domain name from NULL to yu

sw1(vlan)#vtp password 123 (配置vtp的密码) Setting device VLAN database password to 123. sw1(vlan)#exi APPLY completed. Exiting....

c.查看vlan信息。 sw1#sh vlan-switch

VLAN Name Status Ports ---- -------------------------------- --------- -------------------------------

1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3 Fa0/4, Fa0/5, Fa0/6, Fa0/7 Fa0/8, Fa0/9, Fa0/10, Fa0/11 Fa0/12, Fa0/13, Fa0/14, Fa0/15 2 vlan2 active 4 vlan4 active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2

---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1 enet 100001 1500 - - - - - 1002 1003 2 enet 100002 1500 - - - - - 0 0 4 enet 100004 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 1 1003 1003 tr 101003 1500 1005 0 - - srb 1 1002 1004 fdnet 101004 1500 - - 1 ibm - 0 0 1005 trnet 101005 1500 - - 1 ibm - 0 0 d.在FA0/0口上配置为trunk模式,封装802.1q协议。 sw1(config)#interface fa0/0

sw1(config-if)#switchport mode trunk (trunk能传输多个vlan的信息) sw1(config-if)#switchport trunk encapsulation dot1q (封装802.1q) sw1(config-if)#end

3、 在交换机2上的配置。

a. 配置VTP为client模式。 sw2#vlan database

sw2(vlan)#vtp client (vtp客户端模式) Setting device to VTP CLIENT mode. sw2(vlan)#vtp domain yu

Changing VTP domain name from NULL to yu (域名和密码要一致) sw2(vlan)#vtp password 123

Setting device VLAN database password to 123. Exiting.... b..在FA0/0口上配置为trunk模式,封装802.1q协议。 Sw2(config)#interface fa0/0

Sw2(config-if)#switchport mode trunk

Sw2(config-if)#switchport trunk encapsulation dot1q Sw2(config-if)#end c.查看vlan信息。 Sw2#sh vlan-switch

VLAN Name Status Ports ---- -------------------------------- --------- -------------------------------

1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3 Fa0/4, Fa0/5, Fa0/6, Fa0/7 Fa0/8, Fa0/9, Fa0/10, Fa0/11 Fa0/12, Fa0/13, Fa0/14, Fa0/15

2 vlan2 active (client端能检测到vlan信息) 4 vlan4 active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1 enet 100001 1500 - - - - - 1002 1003 2 enet 100002 1500 - - - - - 0 0 4 enet 100004 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 1 1003 1003 tr 101003 1500 1005 0 - - srb 1 1002 1004 fdnet 101004 1500 - - 1 ibm - 0 0 1005 trnet 101005 1500 - - 1 ibm - 0 0

十六、VTP的三种模式的配置。

F0/0

服务器 VLAN 2 3 4

FO/0

透明模式

客户模式

F0/1

F0./1

实验要求:在各自的交换机上配置自己的VTP模式,测试能否通过trunk进行

vlan的相互通信。

注:VTP透明模式支持传输,但是不能查看到server上的vlan信息。 实验步骤:

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

sw2(config-line)#logging syn sw2(config-line)#exec-t 0

sw2(config-line)#interface fa0/0 sw2(config-if)#no shut

sw2(config-line)#interface fa0/1 sw2(config-if)#no shut

sw3(config)#hostname sw3 sw3(config)#no ip do loo sw3(config)#line con 0

sw3(config-line)#logging syn sw3(config-line)#exec-t 0

sw3(config-line)#interface fa0/0 sw3(config-if)#no shut 2、 在SW1上的配置。

a.新建三个vlan,vlan2、vlan3和vlan4 sw1#vlan database

sw1(vlan)#vlan 2 name vlan2 VLAN 2 added:

Name: vlan2

sw1(vlan)#vlan 3 name vlan3 VLAN 3 added: Name: vlan3

sw1(vlan)#vlan 4 name vlan4 VLAN 4 added: Name: vlan4 sw1(vlan)#exi APPLY completed. Exiting....

b.配置VTP为server。 sw1#vlan database sw1(vlan)#vtp server

Device mode already VTP SERVER. sw1(vlan)#vtp domain yu

Changing VTP domain name from NULL to yu sw1(vlan)#vtp password 123

Setting device VLAN database password to 123. sw1(vlan)#exi APPLY completed. Exiting....

c在FA0/0口上配置为trunk模式,封装802.1q协议。 sw1(config)#interface fa0/0

sw1(config-if)#switchport mode trunk

sw1(config-if)#switchport trunk encapsulation dot1q 3、 在SW2上的配置。 a 配置VTP为透明模式。

sw2(vlan)#vtp transparent (vtp透明模式) Setting device to VTP TRANSPARENT mode. sw2(vlan)#vtp domain yu

Changing VTP domain name from NULL to yu sw2(vlan)#vtp password 123

Setting device VLAN database password to 123. sw2(vlan)#exi APPLY completed. Exiting....

b 在fa0/0和f0/1配置模式为trunk并封装802.1q协议。 Sw2(config)#interface fa0/0

Sw2(config-if)#switchport mode trunk

Sw2(config-if)#switchport trunk encapsulation dot1q Sw2(config-if)#end

Sw2(config)#interface fa0/1

Sw2(config-if)#switchport mode trunk

Sw2(config-if)#switchport trunk encapsulation dot1q Sw2(config-if)#end c 查看vlan信息。 sw2#sh vlan-switch

(透明模式无法检测到server端的vlan信息,但支持传输) VLAN Name Status Ports ---- -------------------------------- --------- -------------------------------

1 default active Fa0/2, Fa0/3, Fa0/4, Fa0/5 Fa0/6, Fa0/7, Fa0/8, Fa0/9 Fa0/10, Fa0/11, Fa0/12, Fa0/13 Fa0/14, Fa0/15 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1 enet 100001 1500 - - - - - 1002 1003 1002 fddi 101002 1500 - - - - - 1 1003 1003 tr 101003 1500 1005 0 - - srb 1 1002 1004 fdnet 101004 1500 - - 1 ibm - 0 0 1005 trnet 101005 1500 - - 1 ibm - 0 0 4、在SW3上的配置。

a 配置VTP为client模式。 sw3#vlan database sw3(vlan)#vtp client

Setting device to VTP CLIENT mode. sw3(vlan)#vtp domain yu

Changing VTP domain name from NULL to yu sw3(vlan)#vtp password 123

Setting device VLAN database password to 123. sw3(vlan)#exi

In CLIENT state, no apply attempted. Exiting....

b.在fa0/1上配置模式为trunk并封装802.1q协议。 sw3(config-if)#switchport mode trunk

sw3(config-if)#switchport trunk encapsulation dot1q sw3(config-if)#end c.查看vlan信息 sw3#sh vlan-s

VLAN Name Status Ports ---- -------------------------------- --------- -------------------------------

1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/15

2 vlan2 active (client端能检测到vlan信息) 3 vlan3 active 4 vlan4 active 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------

1 enet 100001 1500 - - - - - 1002 1003 2 enet 100002 1500 - - - - - 0 0 3 enet 100003 1500 - - - - - 0 0 4 enet 100004 1500 - - - - - 0 0 1002 fddi 101002 1500 - 0 - - - 1 1003 1003 tr 101003 1500 1005 0 - - srb 1 1002 1004 fdnet 101004 1500 - - 1 ibm - 0 0 1005 trnet 101005 1500 - - 1 ibm - 0 0

十七、单臂路由的使用和配置。

R1 10.1.1.1 F0/0 VLAN4 F0/4

F0/2 SW1 F0/3 F0/0 R3 172.16.1.1

F0/0 F0/1 R4 192.168.1.1

VLAN 2 F0/0 R2 VLAN 3 实验要求:使用单臂路由的子接口实现全网互ping。

注:做R1的单臂路由,必须先用no ip routeing取消R2 R3 R4的路由功能;

交换机在不同的端口必须配置不同的模式(fa0/1为trunk,其它为access); R2.R3.R4必须配置默认网关,且地址必须与R1子接口的地址相对应; 配置过程中,必须注意交换机与路由器间的接口工作模式(half/full)。 实验步骤: 1、基本配置。

Router(config)#hostname r1 r1(config)#no ip do loo r1(config)#line con 0 r1(config-line)#logg syn r1(config-line)#exec-t 0 r1(config-line)#exi r1(config)#int fa0/0 r1(config-if)#no sh

r1(config-if)#duplex full

Router(config)#no ip do loo Router(config)#hostname r2 r2(config)#line con 0 r2(config-line)#logg syn r2(config-line)#exec-t 0 r2(config-line)#exi

r2(config)#ip default-gateway 192.168.1.2 (配置默认网关地址) r2(config)#int fa0/0 r2(config-if)#no shut

r2(config-if)#duplex full (配置以太网接口的工作模式) r2(config-if)#ip address 192.168.1.1 255.255.255.0

Router(config)#hostname r3 r3(config)#no ip do loo r3(config)#line con 0 r3(config-line)#logg syn r3(config-line)#exec-t 0 r3(config-line)#exi

r3(config)#ip default-gateway 172.16.1.2 r3(config)#int fa0/0 r3(config-if)#no sh

r3(config-if)#ip address 172.16.1.1 255.255.0.0 r3(config-if)#duplex full

Router(config)#hostname r4 r4(config)#no ip do loo r4(config)#line con 0 r4(config-line)#logg syn r4(config-line)#exec-t 0 r4(config-line)#exi

r4(config)#ip default-gateway 10.1.1.2 r4(config)#int fa0/0 r4(config-if)#no shut

r4(config-if)#ip address 10.1.1.1 255.0.0.0 r4(config-if)#duplex full

Router(config)#hostname sw1 sw1(config)#no ip do loo sw1(config)#line con 0 sw1(config-line)#logg syn sw1(config-line)#exec-t 0 sw1(config-line)#exi

2、将R2.R3.R4的路由功能取消,变成PC机。

r2(config)#no ip routing r3(config)#no ip routing r4(config)#no ip routing

3、在SW1配置vlan信息。 sw1#vlan database

sw1(vlan)#vlan 2 name vlan2 VLAN 2 added:

(取消路由功能) Name: vlan2

sw1(vlan)#vlan 3 name vlan3 VLAN 3 added: Name: vlan3

sw1(vlan)#vlan 4 name vlan4 VLAN 4 added: Name: vlan4

4、配置SW1的端口。 sw1(config)#interface fa0/1 sw1(config-if)#no sh

sw1(config-if)#switchport mode trunk

sw1(config-if)#switchport trunk encapsulation dot1q sw1(config)#interface fa0/2 sw1(config-if)#no sh

sw1(config-if)#switchport mode access sw1(config-if)#switchport access vlan 2 sw1(config-if)#exi

sw1(config)#interface fa0/3 sw1(config-if)#no sh

sw1(config-if)#switchport mode access sw1(config-if)#switchport access vlan 3 sw1(config-if)#exi

sw1(config)#interface fa0/4 sw1(config-if)#no sh

sw1(config-if)#switchport mode access sw1(config-if)#switchport access vlan 4 sw1(config-if)#exi

5、R1子接口的配置。

r1(config)#interface fa0/0.1 r1(config-subif)#no sh

r1(config-subif)#encapsulation dot1Q 2 r1(config-subif)#ip address 192.168.1.2 255.255.255.0

r1(config)#interface fa0/0.2 r1(config-subif)#no shutdown

r1(config-subif)#encapsulation dot1Q 3 r1(config-subif)#ip address 172.16.1.2 255.255.0.0 r1(config-subif)#exi

r1(config)#int fa0/0.3 r1(config-subif)#no sh

r1(config-subif)#encapsulation dot1Q 4 r1(config-subif)#ip add 10.1.1.2 255.0.0.0 6、进行全网互ping。 r1#ping 192.168.1.1

Type escape sequence to abort.

access模式能进行vlan的封装) 802.1q协议和vlan 2) (子接口的划分) 802.1q协议和vlan 3) (子接口的划分) (封装802.1q协议和vlan 4) ( (子接口的划分) (封装 (封装 Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: .!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 32/64/96 ms r1#ping 172.16.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: .!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 20/42/60 ms r1#ping 10.1.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds: .!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 28/48/88 ms r2#ping 172.16.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: .!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 36/54/60 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 = 56/76/108 ms

十八、标准访问控制列表的配置

Loopback 0

1.1.1.1 255.0.0.0 R1 R2 S1/1 S1/0 192.168.1.1 255.255.255.0 192.168.1.2 255.255.255.0

实验要求:用标准访问控制列表拒绝来源192.168.1.1的数据。

注:标准访问控制列表的ID为1-99,1300-1999,配置完控制列表,需指定应用于哪个接口

并指定其为入/出接口。检测时的前提是全网能够互ping的情况!! 实验步骤: 1、基本配置。

Router(config)#hostname r1 r1(config)#no ip do loo r1(config)#line con 0

r1(config-line)#logg syn r1(config-line)#exec-t 0 r1(config)#interface s1/1 r1(config-if)#no sh

r1(config-if)#ip add 192.168.1.1 255.255.255.0

Router(config)#hostname r2 r2(config)#no ip do loo r2(config)#line con 0 r2(config-line)#logg syn r2(config-line)#exec r2(config-line)#exec-t 0 r2(config-line)#exi r2(config)#int s1/0 r2(config-if)#no sh

r2(config-if)#ip add 192.168.1.2 255.255.255.0 r2(config-if)#exi

r2(config)#int loopback 0

r2(config-if)#ip add 1.1.1.1 255.0.0.0 2、在R1上配置默认路由。

r1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2

3、在R2上配置标准访问控制列表并应用于接口。

r2(config)#access-list 1 deny 192.168.1.1 0.0.0.0 (配置标准访问控制列表) r2(config)#int s1/0

r2(config-if)#ip access-group 1 in (将控制列表应用于接口) 4、检测。在R1上pingR2的loopback 0 口。

r1#ping (扩展ping) Protocol [ip]:

Target IP address: 1.1.1.1 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y

Source address or interface: 192.168.1.1 Type of service [0]:

Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]:

Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 192.168.1.1

U.U.U (U表示对方拒绝)

Success rate is 0 percent (0/5)

十九、扩展访问控制列表的配置和应用。

Loopback 0 3.3.3.3 255.0.0.0 R1 Loopback 0

1.1.1.1 255.0.0.0 R2 S1/1 S1/0

实验要求:用扩展访问控制列表拒绝来源主机1.1.1.1的数据,允许来自192.168.1.2的数据。 注:扩展访问控制列表的ID是100-199,2000-2999,配置时指定源地址和目的地址,还需

要指定是哪种协议。检测时的前提是全网能够互ping的情况!! 实验步骤: 1、基本配置

Router(config)#hostname r1 r1(config)#no ip do loo r1(config)#line con 0 r1(config-line)#logg syn r1(config-line)#exec-t 0 r1(config)#interface s1/1 r1(config-if)#no sh

r1(config-if)#ip add 192.168.1.1 255.255.255.0 r1(config)#int loopback 0

r1(config-if)#ip add 3.3.3.3 255.0.0.0

Router(config)#hostname r2 r2(config)#no ip do loo r2(config)#line con 0 r2(config-line)#logg syn r2(config-line)#exec r2(config-line)#exec-t 0 r2(config-line)#exi r2(config)#int s1/0 r2(config-if)#no sh

r2(config-if)#ip add 192.168.1.2 255.255.255.0 r2(config-if)#exi

r2(config)#int loopback 0

r2(config-if)#ip add 1.1.1.1 255.0.0.0 2、配置默认路由,保证全网互通。

192.168.1.1 255.255.255.0 192.168.1.2 255.255.255.0

r1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2 r2(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1 3、R1配置扩展访问控制列表并应用于接口。

r1(config)#access-list 100 permit ip host 192.168.1.2 any (配置扩展访问控制列表) r1(config)#access-list 100 deny ip host 1.1.1.1 any

r1#sh access-lists (查看配置的访问列表信息) Extended IP access list 100

10 permit ip host 192.168.1.2 any

20 deny ip host 1.1.1.1 any

r1(config)#interface s1/1

r1(config-if)#ip access-group 100 in 4、测试。 r2#ping ip

Target IP address: 3.3.3.3 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y

Source address or interface: 1.1.1.1 Type of service [0]:

Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]:

Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 U.U.U

Success rate is 0 percent (0/5) r2#ping ip

Target IP address: 3.3.3.3 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y

Source address or interface: 192.168.1.2 Type of service [0]:

Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]:

Loose, Strict, Record, Timestamp, Verbose[none]:

(应用于指定接口)Sweep range of sizes [n]: Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: Packet sent with a source address of 192.168.1.2 !!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 68/85/120 ms

二十、telnet服务的访问控制列表运用。

10.1.1.2/8 S1/2 10.1.1.1/8 S1/2 R2 S1/0 172.16.1.2/16 R4 R1 S1/0 S1/1 192.168.1.2/24 192.168.1.1/24

S1/1 172.16.1.1/16

R3

实验要求:用扩展访问控制列表;允许R1对R2进行TELNET ;不许R3对R2进行TELNET ;

不允许R4对R2进行TELNET。

注:配置的访问控制列表是应用于VTY 04接口的!!!! 实验步骤: 1、基本配置。

Router(config)#hostname r1 r1(config)#no ip do loo r1(config)#line con 0 r1(config-line)#logg syn r1(config-line)#exec-t 0 r1(config)#interface s1/1 r1(config-if)#no sh

r1(config-if)#ip add 192.168.1.1 255.255.255.0

Router(config)#hostname r2 r2(config)#no ip do loo r2(config)#line con 0 r2(config-line)#logg syn r2(config-line)#exec r2(config-line)#exec-t 0 r2(config-line)#exi

r2(config)#int s1/0 r2(config-if)#no sh

r2(config-if)#ip add 192.168.1.2 255.255.255.0 r2(config-if)#exi r2(config)#int s1/1 r2(config-if)#no sh

r2(config-if)#ip add 172.16.1.1 255.255.0.0 r2(config-if)#exi r2(config)#int s1/2 r2(config-if)#no sh

r2(config-if)#encapsulation frame-relay r2(config-if)#ip add 10.1.1.1 255.0.0.0

Router(config)#hostname r3 R3config)#no ip do loo R3config)#line con 0 R3config-line)#logg syn R3config-line)#exec R3config-line)#exec-t 0 R3nfig-line)#exi R3config)#int s1/0 R3config-if)#no sh

R3config-if)#ip add 172.16.1.2 255.255.0.0

Router(config)#hostname r4 R4config)#no ip do loo R4config)#line con 0 R4config-line)#logg syn R4config-line)#exec R4config-line)#exec-t 0 R4config-line)#exi R4config)#int s1/0 R4config-if)#no sh

R4onfig-if)#encapsulation frame-relay R4onfig-if)#ip add 10.1.1.2 255.0.0.0 2、在R2上的配置。

A、配置允许telnet的参数。 r2(config)#enable password 123 r2(config)#line vty 04

r2(config-line)#password 1234 r2(config-line)#login r2(config-line)#exi

B、配置访问控制列表。

r2(config)#access-list 100 permit tcp host 192.168.1.1 host 192.168.1.2 (扩展访问控制列表)

本文来源:https://www.bwwdw.com/article/oa36.html

Top