您的位置:首页 > 其它

CCNA入门---三台交换机的VLAN实验

2010-08-01 22:04 441 查看
VLAN(Virtual Local Area Network)的中文名为"虚拟局域网"。VLAN是一种将局域网设备从逻辑上划分成一个个网段,从而实现虚拟工作组的新兴数据交换技术。这一新兴技术主要应用于交换机和路由器中,但主流应用还是在交换机之中。
实验拓扑:



PC[/b]的[/b]IP[/b]地址配置:[/b][/b]
PC-1:



PC-2:



PC-3:



PC-1-1:



PC-2-1:



PC-3-1:



测试一下连通性:
PC-1 Ping PC-3:

PC-1 Ping PC-2:



PC-3 Ping PC-1:



PC-1 Ping PC-3-1:



OK!测试成功!
下面我们配置交换机并划分VLAN,让这些PC在指定的范围内通信。
交换机的配置:[/b][/b]
SW-1:[/b]
Switch>enable ---进入特权模式
Switch#conf t ---进入全局配置模式
Switch(config)#hostname SW-1 ---给设备起名为SW-1
SW-1(config)#interface range g1/1 -2 ---进入G1/1,G1/2接口
SW-1(config-if-range)#switchport mode trunk ---接口配置为主干道
SW-1(config-if-range)#exit
SW-1(config)#vtp domain ccxx ---指定VTP域名为CCXX
Domain name already set to ccxx.
SW-1(config)#vtp password cisco ---指定VTP域的密码
Password already set to cisco
SW-1(config)#vtp mode server ---指定交换机为VTP Server模式
Device mode already VTP SERVER.
SW-2:[/b]
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW-2
SW-2(config)#vtp domain ccxx ---设定VTP域名
Domain name already set to ccxx.
SW-2(config)#vtp password cisco ---设定VTP 密码
Setting device VLAN database password to cisco
SW-2(config)#vtp mode client ---指定交换机为VTP Client模式
Setting device to VTP CLIENT mode.
SW-2(config)#interface g1/1
SW-2(config-if)#switchport mode trunk
SW-2(config-if)#exit
SW-2(config)#^Z ---退出并保存
SW-3:[/b]
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW-3
SW-3(config)#vtp domain ccxx ---指定VTP域名
Domain name already set to ccxx.
SW-3(config)#vtp password cisco ---指定VTP密码
Setting device VLAN database password to cisco
SW-3(config)#vtp mode client ---指定交换机为VTP Client模式
Setting device to VTP CLIENT mode.
SW-3(config)#interface g1/1
SW-3(config-if)#switchport mode trunk
SW-3(config-if)#exit
SW-3(config)#^Z
下面我们分别show一下SW-1,SW-2,SW-3的VTP信息:
SW-1:



SW-2:



SW-3:



下面是VLAN信息:
SW-1:[/b]



下面是VLAN信息:
SW-2:[/b]



下面是VLAN信息:
SW-3:[/b]



从上面可以看出,SW-2和SW-3已经与SW-1(VTP Server)同步了VLAN信息。
下面我们开始划分[/b]VLAN[/b],然后看[/b]VTP[/b]的配置修订号变化。[/b][/b]

SW-1[/b]的配置:[/b][/b]
SW-1(config)#interface f0/1 ---进入F0/1接口
SW-1(config-if)#switchport mode access --设定接口为访问模式
SW-1(config-if)#switchport access vlan 100 ---将接口加入VLAN 100
SW-1(config-if)#exit ---退出并保存
SW-1(config)#interface f0/2
SW-1(config-if)#switchport mode access ---设定接口为访问模式
SW-1(config-if)#switchport access vlan 200 ---将接口加入VLAN 200
SW-1(config-if)#exit
SW-2[/b]的配置:[/b][/b]
SW-2(config)#interface f0/1
SW-2(config-if)#switchport mode access
SW-2(config-if)#switchport access vlan 100
SW-2(config-if)#exit
SW-2(config)#interface f0/2
SW-2(config-if)#switchport mode access
SW-2(config-if)#switchport access vlan 200
SW-2(config-if)#exit
SW-3[/b]的配置:[/b][/b]
SW-3(config)#interface f0/1
SW-3(config-if)#switchport mode access
SW-3(config-if)#switchport access vlan 100
SW-3(config-if)#exit
SW-3(config)#interface f0/2
SW-3(config-if)#switchport mode access
SW-3(config-if)#switchport access vlan 200
SW-3(config-if)#exit
好!所有交换机上的VLAN都划分完毕,测试一下看看。



OK!VLAN 200中的PC不能PING通VLAN100中的PC了。
试验完成!



本文出自 “YYJCWXF(三毛)” 博客,请务必保留此出处http://weixianfei.blog.51cto.com/950271/365157
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: