(Case + Cisco configured simulator) three switches to communicate between different VLAN by
As shown, in which PC1 and 4 are located sales VLAN10, PC2 and PC5 located marketing VLAN20, PC3 and PC5 is located in the Ministry of Finance VLAN30, each host's IP address and subnet mask listed below will explain how to configure the use of three communicate with each other to switch between different VLAN.
SW1 command:
en // enter privileged mode
conf t // global mode
vlan 10 // create a VLAN10
name xiaoshou // VLAN name to sell here instead of using Pinyin
ex // go back one level (in fact, this step can be omitted next step directly, without having to exit)
vlan 20 // create VLAN20
name shichang // renamed Market
ex // Exit
vlan 30 // create VLAN30
name caiwu // named Finance
ex // exit to previous level
int range f0 / 1-5 // configure multiple ports 1-5 to add a range
sw mode acc // change the port mode access port
sw acc vlan 10 // these ports will be divided into VLAN10
an ex // on exit
int r f0/6-10
sw mo acc
sw acc vlan 20
ex
int r f0//11-15
sw mo acc
sw acc vlan 30
ex
int f0 / 24 // port connected to three switches
sw mo trunk //开启trunk
end // return to privileged mode
w // Save
Three switches configuration:
in
conf t
ip routing // turn routing function
vlan 10 // create VLAN
name xiaoshou
vlan 20
name shichang
vlan 30
name caiwu
ex
int vlan 10 // virtual interface configuration is equivalent to one block as the VLAN
ip add 192.168.1.1 255.255.255.0 // to configure the IP address and subnet mask as the default gateway VLAN10 in the PC, to manually configure the default gateway in the PC
no sh // open port
int vlan 20 //
ip add 192.168.2.1 255.255.255.0 // as a default gateway in the PC VLAN20
no sh
int vlan 30
ip add 192.168.3.1 255.255.255.0 // as a default gateway in the PC VLAN30
no sh
ex
Interface connected int f0 / 24 // entry and switcher
sw tr en dot1q // package configured to 802.1q
sw mo tr // port to trunk mode (if three switches and a switcher located in the same port number, then when one end of the port dubbed trunk port, the other end will be automatically configured as a trunk port)
end // exit to privileged mode
w // Save
As shown, in which PC1 and 4 are located sales VLAN10, PC2 and PC5 located marketing VLAN20, PC3 and PC5 is located in the Ministry of Finance VLAN30, each host's IP address and subnet mask listed below will explain how to configure the use of three communicate with each other to switch between different VLAN.
SW1 command:
en // enter privileged mode
conf t // global mode
vlan 10 // create a VLAN10
name xiaoshou // VLAN name to sell here instead of using Pinyin
ex // go back one level (in fact, this step can be omitted next step directly, without having to exit)
vlan 20 // create VLAN20
name shichang // renamed Market
ex // Exit
vlan 30 // create VLAN30
name caiwu // named Finance
ex // exit to previous level
int range f0 / 1-5 // configure multiple ports 1-5 to add a range
sw mode acc //更改端口模式为access口
sw acc vlan 10 //将这些端口划分到VLAN10
ex //退出上一级
int r f0/6-10
sw mo acc
sw acc vlan 20
ex
int r f0//11-15
sw mo acc
sw acc vlan 30
ex
int f0/24 //与三层交换机相连的端口
sw mo trunk //开启trunk
end //退回到特权模式
w // 保存
三层交换机配置:
en
conf t
ip routing //开启路由功能
vlan 10 //创建VLAN
name xiaoshou
vlan 20
name shichang
vlan 30
name caiwu
ex
int vlan 10 //配置虚接口 就等于把这个VLAN当做一个街口
ip add 192.168.1.1 255.255.255.0 //给配置IP地址 以及子网掩码 会作为VLAN10中PC机的默认网关 ,默认网关要在PC机中手动配置
no sh //打开端口
int vlan 20 //
ip add 192.168.2.1 255.255.255.0 //会作为VLAN20中PC机的默认网关
no sh
int vlan 30
ip add 192.168.3.1 255.255.255.0 //会作为VLAN30中PC机的默认网关
no sh
ex
int f0/24 //进入与二层交换机相连的接口
sw tr en dot1q // 配置封装为802.1q
sw mo tr //将端口改为trunk 模式 (如果三层交换机和二层交换机位于同一个端口号,那么当有一端的端口配成trunk口时,另一端会自动配置成trunk口)
end //退出到特权模式
w //保存