您的位置:首页 > 其它

实验 22 利用三层交换实现以太网建立多个 VLAN

2017-05-09 23:29 686 查看
一.实验目的:

在以太网上建立多个 VLAN,通过一个三层交换机的第三层路由交换技术,实现多个 VLAN 之间的通信。

二.实验要点:

1.在三层交换机与二层交换机间配置 trunk 实现多个 VLAN 数据的通过。

2.启用三层交换机上的路由功能。

三.实验设备:

Cisco 3560-24PS 交换机一台,Cisco 2950 交换机三台(或若干台),PC 机若干台

四、实验环境



五. 实验步骤

1、设置 vtp domain 及 vtp 的工作模式(核心、分支交换机上都设置)

2、配置中继(核心、分支交换机上都设置)

3、创建 vlan(在 server 上设置)

4、将交换机端口划入 vlan

5、配置三层交换的路由

6、配置计算机 IP 地址

实验指导书中将例子的实现转换成了三层交换机teacher和二层交换机student,然后将交换机的端口划分到不通的VLAN中,实现不同VLAN中的通信。这里考虑稍微简单一点的,举个更贴切的实例,某企业有两个主要部门,技术部和销售部,分处于不同的办公室,为了安全和便于管理,对两个部门的主机进行了VLAN的划分,技术部和销售部分处于不同的VLAN。现由于业务的需求,需要销售部和技术部的主机能够相互访问,获得相应的资源,两个部门的交换机通过一台三层交换机进行了连接。

三层交换机具备网络层的功能,实现VLAN间相互访问的原理是:利用三层交换机的路由功能,通过识别数据包的IP地址,查找路由表进行选路转发。三层交换机利用直连路由可以实现不同VLAN之间的互相访问。三层交换机给接口配置IP地址,采用SVI(交换虚拟接口)的方式实现VLAN间互连。SVI是指为交换机中的VLAN创建虚拟接口,并且配置IP地址。

二层交换机上
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#int f0/3
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit
Switch(config)#int f0/1
Switch(config-if)#switch mode trunk

Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up


在三层交换机上配置VLAN 2、VLAN 3,分别将端口2、端口3划到VLAN 2、VLAN 3
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 2
Switch(config-if)#exit
Switch(config)#int f0/3
Switch(config-if)#switchport access vlan 3
Switch(config-if)#exit


设置三层交换机VLAN间通信,创建VLAN 2、VLAN 3的虚拟接口,并配置虚拟接口VLAN 2、VLAN 3的IP地址

Switch(config)#int vlan 2
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up

Switch(config-if)#ip ad 10.0.0.1 255.0.0.0
Switch(config-if)#no sh
Switch(config-if)#exit
Switch(config)#int vlan 3
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up

Switch(config-if)#ip ad 172.0.0.1 255.255.0.0
Switch(config-if)#no sh
Switch(config-if)#exit
Switch(config)#end


查看三层交换机路由表
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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    10.0.0.0/8 is directly connected, Vlan2
C    172.0.0.0/16 is directly connected, Vlan3


主机pc0上:
Packet Tracer PC Command Line 1.0
PC>ping 10.0.0.3

Pinging 10.0.0.3 with 32 bytes of data:

Reply from 10.0.0.3: bytes=32 time=1ms TTL=128
Reply from 10.0.0.3: bytes=32 time=0ms TTL=128
Reply from 10.0.0.3: bytes=32 time=0ms TTL=128
Reply from 10.0.0.3: bytes=32 time=0ms TTL=128

Ping statistics for 10.0.0.3:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC>ping 172.0.0.2

Pinging 172.0.0.2 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 172.0.0.2:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),


六. 实验总结

1.利用三层交换机实现 VLAN 间的路由的配置步骤。

2. 对实验中产生的问题分析其产生的原因。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  思科 以太网 交换机