本案例利用三层交换机路由功能,在三层交换机分别创建每个VLAN的SVI接口,用虚拟接口,解决了物理接口短缺的问提。在每个SVI上配置IP地址,作为对应VLAN内主机的网关,三层交换机和二层交换机通过trunk链路相连,在三层交换上利用路由功能解决VLAN间通信
工具/原料
思科模拟器
构建拓扑图
1、三层交换机与二层交换机相连,二层交换机与PC相连。注意端口。PC0和PC2属于vlan10,PC1和PC3属于vlan20。
2、配置IP地址:PC0:192.168.10.10 255.255.255.0 PC1:192.168.20.10 255.255.255.0 PC2:192.168.10.20 255.255.255.0 PC3:192.168.20.30 255.255.255.0 vlan10网关:192.168.10.1 vlan20网关:192.168.20.1 配图例子,按照格式打。
配置二层交换机
1、Switch>enableSwitch#configure terminalEnter configuration c泠贾高框ommands, one per line. End with CNTL/Z.Switch(config)#Switch(config)#vlan 10Switch(config-vlan)#exSwitch(config)#vlan 20Switch(config-vlan)#exSwitch(config)#interface fastEthernet 0/1Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 10Switch(config-if)#exSwitch(config)#interface fastEthernet 0/2Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 20Switch(config-if)#exitSwitch(config)#interface fastEthernet 0/24Switch(config-if)#switchport mode trunkSwitch(config-if)#%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to upswitch2配置一样。如图
配置三层交换机
1、核心交换机Switch(config)#int vlan 10Switch(con酆璁冻嘌fig-if)#%LINK-5-CHANGED: Interface Vlan10, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to upSwitch(config-if)#ip add 192.168.10.1 255.255.255.0Switch(config-if)#no shutSwitch(config-if)#ex Switch(config)#int vlan 20Switch(config-if)#%LINK-5-CHANGED: Interface Vlan20, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to upSwitch(config-if)#ip add 192.168.20.1 255.255.255.0Switch(config-if)#no shutSwitch(config-if)#exSwitch(config)#ip routingSwitch(config)#exSwitch#
2、测试连通性