资源描述
实验 3 报告
学号
姓名
课堂号
01
实验日期
实验名称
VLAN基础与综合
实验用时
同组人
指导教师
一、实验目的
理解Port VLAN的配置和跨交换机之间VLAN的特点
二、实验要求
通过实验掌握虚拟局域网(VLAN)的基本概念、类型,理解Port VLAN和Tag VLAN的配置方法。
三、实验环境(设备)
交换机2台,PC4台,直连线5根
四、实验内容
(一).配置Port VALN (一台交换机上连线连接2台PC,分配到不同的vlan,测试是否ping通)
1. 实验拓扑,如图1所示。
F0/1
NIC
NIC
F0/11
VLAN10
VLAN20
S2126-1
F0/1
NIC
NIC
F0/11
S2126-2
F0/9
F0/9
图1
2. 实验准备
关闭防火墙(系统防火墙和安全软件的需全部关闭)
3. 实验步骤
(1).配置交换机的名称 (应该根据自己所使用设备来配置,即与RCMS上的设备同名)
switch#enable 14
!进入特权模式
Password: 402
switch #configure terminal
! 进入全局配置模式
switch (config)#hostname S2126-1
! 配置交换机名称为“S2126-1”
(2).创建VLAN
S2126-1 (config)# vlan 10
! 创建vlan 10
S2126-1 (config-vlan 10)# name star
! 将vlan10命名为star(也可不定义名称)
S2126-1 (config)# vlan 20
! 创建vlan 20
S2126-1 (config-vlan 20)# name moon
! 将vlan20命名为moon(也可不定义名称)
(3).把端口加入VLAN
S2126-1 (config)# interface range f 0/1-4
! 进入f0/1-f0/4的接口配置模式
S2126-1 (config-if-range)# switch access vlan 10
! 将fastethernet 0/1-4端口加入vlan 10
S2126-1 (config)# interface range fastethernet 0/11-14
! 进入fastethernet 0/11-14的接口配置模式
S2126-1 (config-if-range)# switch access vlan 20
! 将fastethernet 0/14端口加入vlan 20
S2126-1 (config)# interface range fastethernet 0/11-14
! 进入fastethernet 0/11-14的接口配置模式
S2126-1 (config-if-range)# switch access vlan 20
! 将fastethernet 0/14端口加入vlan 20
(4).测试
l 查看或配置内网卡的IP地址和子网掩码,将同一VLAN内的主机的IP地址设置为同一网段的,建议: VLAN 10:192.168.10.x;VLAN 20:192.168.20.x
l 两台pc互相ping一下,是否可以连通
(二).跨交换机 VLAN
1. 实验拓扑,如图1所示。
2. 实验准备
关闭防火墙(系统防火墙和安全软件的需全部关闭)
3. 实验步骤
再配置一台交换机S2126-2
(1).配置交换机的名称 (应该根据自己所使用设备来配置,即与RCMS上的设备同名)
switch#enable 14
!进入特权模式
Password: 402
switch #configure terminal
! 进入全局配置模式
switch (config)#hostname S2126-2
! 配置交换机名称为“S2126-2”
(2).创建VLAN
S2126-2 (config)# vlan 10
! 创建vlan 10
S2126-2 (config-vlan 10)# name star
! 将vlan10命名为star(也可不定义名称)
S2126-2 (config)# vlan 20
! 创建vlan 20
S2126-2 (config-vlan 20)# name moon
! 将vlan20命名为moon(也可不定义名称)
(3).把端口加入VLAN
S2126-2 (config)# interface range f 0/1-4
! 进入f0/1-f0/4的接口配置模式
S2126-2 (config-if-range)# switch access vlan 10
! 将fastethernet 0/1-4端口加入vlan 10
S2126-2 (config)# interface range fastethernet 0/11-14
! 进入fastethernet 0/11-14的接口配置模式
S2126-2 (config-if-range)# switch access vlan 20
! 将fastethernet 0/14端口加入vlan 20
S2126-2 (config)# interface range fastethernet 0/11-14
! 进入fastethernet 0/11-14的接口配置模式
S2126-2 (config-if-range)# switch access vlan 20
! 将fastethernet 0/14端口加入vlan 20
(4).配置trunk口
S2126-2 (config)# interface fastethernet 0/9
! 进入fastethernet 0/9的接口配置模式
S2126-2 (config-if)# switchport mode trunk
! 将fastethernet 0/9号口设置为tag VLAN模式
(5).交换机S2126-1的设置
S2126-1 # configure terminal
! 进入全局配置模式
S2126-1 (config)# interface fastethernet 0/9
! 进入fastethernet 0/9的接口配置模式
S2126-1 (config-if)# switchport mode trunk
! 将fastethernet 0/9设为Tag VLAN模式
(6).测试:
l 关闭防火墙
l 开始-运行-cmd C:\Documents and settings>ipconfig
l ping ip地址
不同VLAN内两台pc互相ping一下,是否可以连通
相同VLAN内两台pc互相ping一下,是否可以连通
(三).跨交换机VLAN之间相互通信
F0/1
NIC
NIC
F0/11
VLAN10
VLAN20
S2126-1
F0/1
NIC
NIC
F0/11
S3550-1
F0/9
F0/9
拓扑结构如右图所示:
1.交换机S2126-1上的配置与(一)中的一样
2.交换机S3550-1上的配置:
S3550-1(config)#vlan 10
! 创建vlan 10
S3550-1(config)#vlan 20
! 创建vlan 20
S3550-1(config)# interface range fastethernet 0/1-5
! 进入fastethernet 0/1-5的接口配置模式
S3550-1(config-if-range)# switch access vlan 10
! 将fastethernet 0/1-5端口加入vlan 10
S3550-1(config)# interface range fastethernet 0/11-15
! 进入fastethernet 0/11-15的接口配置模式
S3550-1(config-if-range)# switch access vlan 20
! 将fastethernet 0/11-15端口加入vlan 20
S3550-1(config)# interface fastethernet 0/9
! 进入fastethernet 0/9的接口配置模式
S3550-1(config-if)# switchport mode trunk
! 将fastethernet 0/9设为Tag VLAN模式
S3550-1(config)#interface vlan 10
! 进入虚拟vlan接口,vlan10
S3550-1(config-if)#ip address 192.168.10.100 255.255.255.0
! 为VLAN 10 接口配置IP地址
S3550-1(config)#interface vlan 20
! 进入虚拟vlan接口vlan20
S3550-1(config-if)#ip address 192.168.20.200 255.255.255.0
! 为VLAN 20 接口配置IP地址
3.将vlan 10内的主机的内网NIC的IP地址设置为:192.168.10.x/24,网关设置为该VLAN接口的IP地址,即192.168.10.100;vlan 20内的主机的内网NIC的IP地址设置为:192.168.20.x/24,网关设置为该VLAN接口的IP地址,即192.168.20.200;
4.测试:
l 关闭防火墙
l 开始-运行-cmd C:\Documents and settings>ipconfig
l ping ip地址
不同VLAN内两台pc互相ping一下,是否可以连通
相同VLAN内两台pc互相ping一下,是否可以连通
五、实验注意事项
1.VLAN:在同一网段内进行逻辑划分成若干部分,相同VLAN中的主机可以直接访问,不同VLAN中的主机必须经过路由设备进行转发才能相互访问,广播数据包只可在相同VLAN内广播而不能传输到其他VAN
2 .VLAN类型
交换机端口隔离Prot VALN:利用交换机的端口划分的VLAN,一个端口只属于一个VLAN
跨交换机实现Tag VLAN:用于跨交换机,相同VLAN内主机间可直接访问,对不同VLAN的主机进行隔离,遵循IEEE802.1q协议标准
3.交换机所有端口在默认情况下属于access端口,可直接将端口加入某一VLAN,利用switchport access vlan x命令可更改端口的VLAN模式
如:switch(config)#interface fa 0/1
Switch(config-if)#switchport access vlan x(x表示要加入的vlan号)
4.VLAN1属于系统默认的VLAN,不可删除
删除当前某个VLAN时,应先将属于该VLAN的端口加入其他的VLAN再删除VLAN
如switch(config)# no vlan 10
5.两台交换机之间连接的端口应该设置为tag vlan模式,trunk端口在默认情况下支持所有vlan的传输
6.验证命令
Ø show running-config
Ø show vlan
Ø show ip interface
六、实验记录
(一)在同一个交换机,不同Vlan内的两台主机Ping
C:\Documents and Settings\Administrator>ping 192.168.10.7
Pinging 192.168.10.7 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
(二)在两个双层交换机互连的情况下
Ping 同一Vlan内的两台主机
C:\Documents and Settings\Administrator>ping 192.168.10.7
Pinging 192.168.10.7 with 32 bytes of data:
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Ping 不同Vlan内的两台主机
C:\Documents and Settings\Administrator>ping 192.168.10.7
Pinging 192.168.10.7 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
(三)在一个双层交换机和三层交换机互连的情况下
配置好IP地址和网关的情况下
Ping 同一个Vlan 内的两台主机
C:\Documents and Settings\Administrator>ping 192.168.10.7
Pinging 192.168.10.7 with 32 bytes of data:
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Reply from 192.168.10.7: bytes=32 time<1ms TTL=128
Ping 不容Vlan内的两台主机
C:\Documents and Settings\Administrator>ping 192.168.10.7
Pinging 192.168.20.7 with 32 bytes of data:
Reply from 192.168.20.7: bytes=32 time<1ms TTL=128
Reply from 192.168.20.7: bytes=32 time<1ms TTL=128
Reply from 192.168.20.7: bytes=32 time<1ms TTL=128
Reply from 192.168.20.7: bytes=32 time<1ms TTL=128
七、实验结果及其分析
即便在不同的交换机,只要在同一个Vlan内,也是可以实现互通的
在两台双层交换机相连的情况下,不同Vlan的主机是不能实现互通的。
但是在有三层交换机的情况下,可以通过配置网关实现不同Vlan的主机互通
分析:即便在同一台交换机,但若处于不同的Vlan也不能实现互通。也就是说想要实现二层交换机之间的不同主机之间交换数据就一定要在同一个Vlan内,而要想实现不同Vlan内的互通就需要一个三层交换机通过网关来实现互通
教师评语:
1.按时完成实验;
2.实验内容和过程记录完整;
3.回答问题完整、正确;
4.有实验的心得或讨论;
5.实验报告的撰写认真、格式符合要求,没有抄袭行为。
刘琪
2011/4/20
评分:
展开阅读全文