您的位置:首页 > 其它

CCNA配置试验五 vlan的基本配置

2009-03-02 01:45 615 查看
VLAN综述:

一个VLAN =一个广播域 = 逻辑网段 (子网)

Vlan运作:
每个逻辑的VLAN就象一个独立的物理桥
交换机上的每一个端口都可以分配给不同的VLAN
默认的情况下,所有的端口都属于VLAN1(Cisco
同一个VLAN可以跨越多个交换机
主干功能支持多个VLAN的数据
主干使用了特殊的封装格式支持不同的VLAN
只有快速以太网端口可以配置为主干端口

VLAN Trunk
交换机对帧进行VLAN标记有两种协议:ISL和802.1Q

VLAN干道:对于多个VLAN交换机来说,VLAN干线就是两个交换机之间的连接,它在两个或两个以上的VLAN之间传输通信。每个交换机必须确定它所收到的帧属于哪个VLAN
一个交换机的任何端口都必须属于且只能属于一个VLAN,但当端口配置成trunk干线后,该端口就失去了它自身的VLAN标识,可以为该交换机内的所有VLAN传输数据。

VLAN配置的步骤
1.全局配置模式下,输入VLAN ID,进入VLAN配置模式:
Switch(config)#vlan {vlan-id}
2.为VLAN设置名字.可选:
Switch(config-vlan)#name {vlan-name}
3.创建了以太网VLAN之后,接下来把交换机端口分配到特定的VLAN里.假如你把端口分配进了不存在的VLAN里,那么新的VLAN将自动被创建.进入接口配置模式:
Switch(config)#interface {interface}
4.定义VLAN端口的成员关系,把它定义为层2接入端口:
Switch(config-if)#switchport mode access
5.把端口分配进特定的VLAN里:
Switch(config-if)#switchport access vlan {vlan-id}
6.配置中继端口,定义中继模式:
Switch(config-if)#switchport trunk encapsulation {isl|dot1q|negotiate}
7.定义端口为层2的中继端口:
Switch(config-if)#switchport mode {dynamic auto|dynamic desirable|trunk}
试验配置vlan



试验说明:在交换机SW1上划分VLAN 2 和 VLAN 3 。把交换机的F0/2端口放入VLAN 2。把F0/3端口放入VLAN 3
在交换机SW2上划分VLAN 2和VLAN 3。把F0/3端口放入VLAN 2,把F0/5端口放入VLAN 3
试验要求:在交换机SW1 和SW2上划分vlan并把指定端口放入vlan内。使用show vlan brief(由于模拟器与真实机器之间的差别,查看VLAN信息的命令为show vlan-switch brief) 查看VLAN 信息。
交换机配置如下,(红色字体为配置内容)
SW1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host sw1 定义交换机名称
sw1(config)#exit
sw1#vlan database
sw1(vlan)#vlan 2 name v2 为vlan设置名称
VLAN 2 added:
Name: v2
sw1(vlan)#vlan 3 name v3
VLAN 3 added:
Name: v3
sw1(vlan)#exit
sw1#conf tleted.Exiting....
Enter configuration commands, one per line. End with CNTL/Z.
sw1(config)#int f0/2 把交换机端口分配到vlan
sw1(config-if)#switchport mode access 定义VLAN端口的成员关系
sw1(config-if)#switchport access vlan 2
sw1(config-if)#exit
sw1(config)#int f0/3
sw1(config-if)#switchport mode access
sw1(config-if)#switchport access vlan 3
sw1(config-if)#exit
sw1(config)#int f0/1
sw1(config-if)#switchport trunk encapsulation dot1q 定义干线封装协议标示
sw1(config-if)#switchport mode trunk 定义干线
sw1(config-if)#switchport trunk allowed vlan all
SW2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host sw2
sw2(config)#exit
sw2#vlan database
sw2(vlan)#vlan 2 name v2
VLAN 2 added:
Name: v2
sw2(vlan)#vlan 3 name v3
VLAN 3 added:
Name: v3
sw2(vlan)#exit
APPLY completed.
Exiting....
sw2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw2(config)#int f0/3
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 2
sw2(config-if)#exit
sw2(config)#int f0/5
sw2(config-if)#switchport mode access
sw2(config-if)#switchport access vlan 3
sw2(config-if)#exit
sw2(config)#int f0/1
sw2(config-if)#switchport trunk encapsulation dot1q
sw2(config-if)#switchport mode trunk
sw2(config-if)#switchport trunk allowed vlan all
sw2(config-if)#exit
show vlan-switch brief查看vlan信息。
SW1
sw1#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, 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 v2 active Fa0/2
3 v3 active Fa0/3
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW2
sw2#show vlan-switch brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/2, Fa0/4, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15
2 v2 active Fa0/3
3 v3 active Fa0/5
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
如上内容显示vlan2(v2)vlan3 (v3)为active 状态。
试验成功!
本文出自 “范琳琳学习笔记” 博客,请务必保留此出处/article/4449970.html
本文出自 51CTO.COM技术博客
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: