热心网友
回答时间:2023-10-09 16:09
实验二 - VLAN 基本配置
Lab Exercise 2.1
目标:熟练掌握如何创建VLAN.
设备需求:Catalyst 2950 系列交换机两台.
语法:
1.全局配置模式下,输入VLAN ID,进入VLAN 配置模式:
Aiko(config)#vlan {vlan-id}
2.为VLAN 设置名字.可选:
Aiko(config-vlan)#name {vlan-name}
3.创建了以太网VLAN 之后,接下来把交换机端口分配到特定的VLAN 里.假如你把端口分配进了不存在的VLAN 里,那么新的VLAN 将自动被创建.进入接口配置模式:
Aiko(config)#interface {interface}
4.定义VLAN 端口的成员关系,把它定义为层2 接入端口:
Aiko(config-if)#switchport mode access
5.把端口分配进特定的VLAN 里:
Aiko(config-if)#switchport access vlan {vlan-id}
6.配置中继端口,定义中继模式:
Aiko(config-if)#switchport trunk encapsulation {isl|dot1q|negotiate}
7.定义端口为层2 的中继端口:
Aiko(config-if)#switchport mode {dynamic auto|dynamic desirable|trunk}
解释:
一般当VLAN 跨交换机划分,通常要配置中继链路.
配置实例一:
交换机Asuqa 配置如下:
Asuqa#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Asuqa(config)#vlan 2
Asuqa(config-vlan)#name Sales
Asuqa(config-vlan)#vlan 3
Asuqa(config-vlan)#name Tech
Asuqa(config-vlan)#interface f0/2
Asuqa(config-if)#switchport mode access
Asuqa(config-if)#switchport access vlan 2
Asuqa(config-if)#no shutdown
Asuqa(config-if)#interface f0/3
Asuqa(config-if)#switchport mode access
Asuqa(config-if)#switchport access vlan 3
Asuqa(config-if)#no shutdown
Asuqa(config-if)#interface f0/1
Asuqa(config-if)#switchport trunk encapsulation dot1q
Asuqa(config-if)#switchport mode trunk
Asuqa(config-if)#no shutdown
Asuqa(config-if)#end
Asuqa#
交换机Aiko 配置如下:
Aiko#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Aiko(config)#vlan 2
Aiko(config-vlan)#name Sales
Aiko(config-vlan)#vlan 3
Aiko(config-vlan)#name Tech
Aiko(config-vlan)#interface f0/3
Aiko(config-if)#switchport mode access
Aiko(config-if)#switchport access vlan 2
Aiko(config-if)#no shutdown
Aiko(config-if)#interface f0/5
Aiko(config-if)#switchport mode access
Aiko(config-if)#switchport access vlan 3
Aiko(config-if)#no shutdown
Aiko(config-if)#interface f0/24
Aiko(config-if)#switchport trunk encapsulation dot1q
Aiko(config-if)#switchport mode trunk
Aiko(config-if)#no shutdown
Aiko(config-if)#end
Aiko#
测试:
Asuqa#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
Fa0/16, Fa0/17, Fa0/18, Fa0/19
Fa0/20, Fa0/21, Fa0/22, Fa0/23
Gi0/1, Gi0/2
2 Sales active Fa0/2
3 Tech active Fa0/3
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
Asuqa#
Aiko#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Gi0/1, Gi0/2
2 Sales active Fa0/3
3 Tech active Fa0/5
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
Aiko#
Lab Exercise 2.2
目标:熟练掌握如何配置VTP.
设备需求:Catalyst 2950 系列交换机两台.
语法:
1.全局配置模式下,定义VTP 域名,在同一VLAN 管理域的交换机的VTP 域名必须相同.该域名长度为1 到32 字符: Aiko(config)#vtp domain {domain-name}
2.全局配置模式下,定义VTP 模式:
Aiko(config)#vtp mode {server|client|transparent}
3.设置VTP 域的密码,同一VTP 域里的交换机的VTP 域的密码必须一致,密码长度为8 到64 字符.可选: Aiko(config)#vtp password {password}
解释:
VTP 模式如果为服务器模式,可以在交换机上增加,删除和修改VLAN 信息;如果VTP 模式为客户模式,不能在交换机上增加,删除和修改VLAN 信息,它的VLAN 信息是从VTP 模式为服务器模式的交换机上学习而来;如果VTP 模式为透明模式,交换机可以独立维持自身的VLAN 信息库.默认VTP 模式均为服务器模式.
准备工作:VLAN 已经划分完毕.
配置实例一:
交换机Asuqa 配置如下:
Asuqa#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Asuqa(config)#vtp domain Aiko
Changing VTP domain name from NULL to Aiko
Asuqa(config)#vtp mode server
Device mode already VTP SERVER.
Asuqa(config)#vtp password Asuqa
Setting device VLAN database password to Asuqa
Asuqa(config)#end
Asuqa#
交换机Aiko 配置如下:
Aiko#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Aiko(config)#vtp domain Aiko
Changing VTP domain name from NULL to Aiko
Aiko(config)#vtp mode client
Setting device to VTP CLIENT mode.
Aiko(config)#no vlan 2
VTP VLAN configuration not allowed when device is in CLIENT mode.
Aiko(config)#vtp password Asuqa
Setting device VLAN database password to Asuqa
Aiko(config)#end
Aiko#
引自:CISCO CERTIFIED NETWORK ASSOCIATE LAB GUIDE
思科认证网络工程师完全实验手册
作者: 红头发 CCIE#15101
收起