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

VLAN(Virtual Local Area Network)的中文名为"虚拟局域网"。VLAN是一种将局域网设备从逻辑上划分成一个个网段,从而实现虚拟工作组的新兴数据交换技术。这一新兴技术主要应用于交换机和路由器中,但主流应用还是在交换机之中。
实验拓扑:
CCNA入门---三台交换机的VLAN实验_第1张图片
PC IP 地址配置:
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 在指定的范围内通信。
交换机的配置:
SW-1:
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:
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:
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:
下面是 VLAN 信息:
SW-2:
下面是 VLAN 信息:
SW-3:
从上面可以看出, SW-2 SW-3 已经与 SW-1(VTP Server) 同步了 VLAN 信息。
下面我们开始划分 VLAN ,然后看 VTP 的配置修订号变化。
 
SW-1 的配置:
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 的配置:
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 的配置:
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 了。
试验完成!
 

你可能感兴趣的:(入门,VLAN,交换机,实验,CCNA)