三层交换机实现vlan间的通信

拓扑图

用三层交换机实现vlan间的通信

首先要用到vtp协议

switch 1 配置

Switch(config)#vtp domain test

switch 2 配置

Switch(config)#vtp domain test
Changing VTP domain name from NULL to test
Switch(config)#vtp mode client
Setting device to VTP CLIENT mode.
Switch(config)#

switch 3 ,4,5与2一致

 在switch 1上创建vlan

Switch(config)#
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#exit

在switch 5和switch 4 上配置中继链路

switch 5

Switch(config)#
Switch(config)#int range f0/1-3
Switch(config-if-range)#switchport mode trunk

switch 4

Switch(config)#
Switch(config)#int f0/24
Switch(config-if)#switchport mode trunk

在switch 1上为vlan10,20,30设置地址(这个地址便是各个vlan的网管)

witch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip addr 192.168.1.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#ip addr 192.168.2.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
Switch(config-if)#ip addr 192.168.3.254 255.255.255.0
Switch(config-if)#exit

打开三层路由器的路由转发工能

Switch(config)#ip routing

配置结束,用ping命令检查实验结果

pc 1 ping pc 6   

vlan10 可与vlan 30 通信

pc2 ping  pc7

vlan 10 可与vlan 20 通信

vlan间通信以实现,实验完成

猜你喜欢

转载自www.cnblogs.com/knightysa/p/9178815.html