利用三层交换机vlan间通信
分类:网络技术日期:2010-11-20 - 16:02:24作者:老谢
首先在交换机上配置vlan
配置过程如下
Switch>en
Switch#conf termi
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int fa 0/2
Switch(config-if)#sw access vlan 2
Switch(config-if)#int fa 0/3
Switch(config-if)#sw access vlan 2
Switch(config-if)#int fa 0/4
Switch(config-if)#sw access vlan 3
Switch(config-if)#int fa 0/5
Switch(config-if)#sw access vlan 3
Switch(config-if)#int fa 0/1
Switch(config-if)#sw mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#no shutdown
我们现在分别ping一下看看
vlan2内的192.168.1.3可以ping通
vlan3的192.168.2.2掉包
我们开始配置路由器
Switch>enable
Switch#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 2
Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int fa 0/1
Switch(config-if)#sw mode trunk
Switch(config-if)#no shutdown
Switch(config-if)#int vlan 2
%LINK-5-CHANGED: Interface Vlan2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to upSwitch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#int vlan3
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to upSwitch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#end
配置完毕,我们可以show下路由表
下面我们ping试试看
vlan2和vlan3已经可以正常通信
在学思科华为?