文章目录
背景信息
VLAN 对于管理逻辑分组非常有用,可以轻松对组中成员进行移动、更改或添加操作。 本练习重点介绍创建和命名 VLAN 以及将接入端口分配给特定 VLAN,以及配置跨交换机VLAN中继。
第 1 部分: 查看默认 VLAN 配置
步骤 1: 显示当前 VLAN。
在 S1 上,发出显示所有已配置 VLAN 的命令。 默认情况下,所有接口都分配给 VLAN 1。查看VLAN和接口关系的命令:show vlan。分别修改交换机名字为S1,S2,S3
改名:(以S1为例,S2,S3相同操作)
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#
S1#show vlan
步骤 2: 验证同一网络上的 PC 之间的连接。
请注意,每台 PC 都可 ping 共享同一网络的另一台 PC。
· PC11 可 ping PC13
· PC21 可 ping PC23
· PC3 可 ping Server3
· PC4 可 ping Server4
Ping 其它网络中的 PC 则会失败。
对当前网络配置 VLAN 可带来什么好处?有什么坏处?
第 2 部分: 配置 VLAN
步骤 1:在S1 、S2 和S3上创建和命名 VLAN。
创建必要的VLAN及相应名称:
· VLAN 10:finance
· VLAN 20:marketing
· VLAN 30:production
· VLAN 40:customer
创建并命名VLAN(以S1为例,S2,S3相同操作)
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#vlan 10
S1(config-vlan)#name finance
S1(config-vlan)#vlan 20
S1(config-vlan)#name marketing
S1(config-vlan)#vlan 30
S1(config-vlan)#name production
S1(config-vlan)#vlan 40
S1(config-vlan)#name customer
S1(config-vlan)#
步骤 2:验证 VLAN 配置。
哪些命令将仅显示 VLAN 名称、状态和交换机上的关联端口?show vlan brief
S1#show vlan brief
验证VLAN配置(以S2为例,S1,S3相同操作)
第 3 部分:为端口分配 VLAN
步骤 1: 将 VLAN 分配到S1 上的活动端口。
将 VLAN 分配到以下端口如S1:
· VLAN 10:F0/3-4
· VLAN 20:F0/1-2
· VLAN 30:F0/5
其他交换机参考地址分配表
vlan将端口分配到S1的操作:
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#interface range F0/3-4
S1(config-if-range)#switchport mode access
S1(config-if-range)#switchport access vlan 10
S1(config-if-range)#exit
S1(config)#interface range F0/1-2
S1(config-if-range)#switchport access vlan 20
S1(config-if-range)#exit
S1(config)#interface F0/5
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 30
S1(config-if)#
vlan将端口分配到S2的操作:
注意:vlan端口号不同。
Switch>en
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S2
S2(config)#interface F0/2
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 30
% Access VLAN does not exist. Creating vlan 30
S2(config-if)#exit
S2(config)#interface F0/3
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 40
% Access VLAN does not exist. Creating vlan 40
S2(config-if)#
vlan将端口分配到S3的操作:
Switch>en
Switch#
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S3
S3(config)#interface range F0/1-2
S3(config-if-range)#switchport mode access
S3(config-if-range)#exit
S3(config)#interface range F0/3-4
S3(config-if-range)#switchport mode access
S3(config-if-range)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
S3(config-if-range)#exit
S3(config)#interface F0/5
S3(config-if)#switchport mode access
S3(config-if)#switchport access vlan 40
% Access VLAN does not exist. Creating vlan 40
S3(config-if)#
第 4 部分: 配置VLAN中继
步骤 1:
交换机之间传递多个VLAN 信息时需要 Trunk。
在S1、S2 和S3上配置中继并使用 VLAN 99作为原生VLAN。在S1、S2 和S3 上创建VLAN99,并为其命名manage
创建VLAN99并命名为manage(以S1为例,S2,S3相同操作)
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#vlan 99
S1(config-vlan)#name manage
S1(config-vlan)#
S1#
步骤 2:在S1 、S2 和S3上的VLAN99子接口上配置相应IP地址。
在S1的VLAN99子接口上配置相应IP地址(以S1为例,S2,S3相同操作)
S1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#interface vlan 99
S1(config-if)#
%LINK-5-CHANGED: Interface Vlan99, changed state to up
S1(config-if)#ip address 192.168.99.1 255.255.255.0
S1(config-if)#
S1到S2接口上仅允许VLAN10,VLAN20,VLAN30及本征VLAN99通过
S1(config)#interface G0/1
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk native vlan 99
S1(config-if)#switchport nonegotiate
S1(config-if)#switchport trunk allowed vlan 10,20,30,99
S1(config-if)#
S2(config)#interface range G0/1-2
S2(config-if-range)#switchport mode trunk
S2(config-if-range)#switchport trunk native vlan 99
S2(config-if-range)#switchport nonegotiate
S2(config-if-range)#switchport trunk allowed vlan 10,20,30,40,99
S2(config-if-range)#
S2到S3接口上仅允许VLAN10,VLAN20,VLAN40及本征VLAN99通过
S3(config)#interface G0/2
S3(config-if)#switchport trunk native vlan 99
S3(config-if)#switchport nonegotiate
S3(config-if)#switchport trunk allowed vlan 10,20,30,40,99
S3(config-if)#
配置每个server的ip地址和子网掩码
(以Server1为例,Server2、Server3、Server4、PC11、PC12、P13、P21、P22、P23的ip地址和子网掩码操作根据地址分配表更改)
做完情况
PPT知识点
如若侵权,请及时与我联系。
此篇文章仅供学习参考,欢迎纠错,一起学习!