思科模拟器:[18]跨交换机划分Vlan
1、打开Cisco Packet Tracer,点击【交换机】,选择第三个图标2960交换机,按住鼠标左键拖动到工作区。拖动三台交换机,和四台电脑到工作区界面,用直通线连接。
2、核心交换机需要有所有的Vlan,我们点击核心交换机,打开命令行配置Vlan
3、在核心交换机上输入如下代码【Switch>ENSwitch#CONF TEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#VLAN 10Switch(config-vlan)#EXITSwitch(config)#VLAN 20Switch(config-vlan)#EXITSwitch(config)#VLAN 30Switch(config-vlan)#EXITSwitch(config)#】
4、打开交换机0的命令行窗口,首先添加Vlan10和Vlan20,然后将交换机端口加入两个Vlan,代码如下【Switch#CON僻棍募暖FConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Switch(config)#VLAN 10Switch(config-vlan)#EXITSwitch(config)#VLAN 20Switch(config-vlan)#EXITSwitch(config)#INT F0/1Switch(config-if)#SWitchport Access Vlan 10Switch(config-if)#EXITSwitch(config)#INT F0/2Switch(config-if)#SWitchport Access Vlan 20Switch(config-if)#EXIT】
5、打开交换机1的命令行窗口,首先添加Vlan20和Vlan30,然后将交换机端口加入两个Vlan,代码如下【Switch#CON僻棍募暖FConfiguring from terminal, memory, or network [terminal]?Enter configuration commands, one per line. End with CNTL/Z.Switch(config)#VLAN 20Switch(config-vlan)#EXITSwitch(config)#VLAN 30Switch(config-vlan)#EXITSwitch(config)#INT F0/1Switch(config-if)#SWitchport Access Vlan 20Switch(config-if)#EXITSwitch(config)#INT F0/2Switch(config-if)#SWitchport Access Vlan 30Switch(config-if)#EXIT】
6、分别设置每台电脑的IP地址,依次设置为:192.168.1.1;192.168.1.2;192.168.1.3;192.168.1.4
7、打开第一台电脑,进入命令提示符,ping 192.168.1.2,因为不在同一个Vlan,所以ping不通
8、打开第二台电脑,进入命令提示符,ping 192.168.1.3,因为在同一个Vlan,所以可以ping通