应用:采用SVI 接口作为各个Vlan 的网关

Switch(config-vlan)#exit
Switch(config)#vlan 3
Switch(config-vlan)#exit
Switch(config)#int vlan 2
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to upSwitch(config-if)#ip add 192.168.12.254 255.255.255.0 //配上ip作vlan的网关
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int vlan 3
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up
Switch(config-if)#ip add 192.168.13.254 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#exit
Switch(config)#int f0/7
Switch(config-if)#switchport mode trunk //配置成trunk
Switch(config-if)#exit
Switch(config)#int f0/15
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#ip routing //开启路由功能
