一、搭建拓扑
二、配置接入层交换机
switch0
Switch>
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#ex
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#int f0/1
Switch(config-if)#swi acc vlan 10
Switch(config-if)#ex
Switch(config)#int f0/11
Switch(config-if)#swi acc vlan 20
Switch(config-if)#ex
Switch(config)#int f0/24
Switch(config-if)#swi mode tr
Switch(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 up
Switch(config-if)#
switch0同switch1
三、配置汇聚层三层交换机
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#ex
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#int
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up
% Incomplete command.
Switch(config)#
Switch(config)#
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip addr 202.206.79.100 255.255.255.0
Switch(config-if)#ex
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#
Switch(config-if)#ip addr 202.206.78.100 255.255.255.0
Switch(config-if)#ex
Switch(config)#ip routi
Switch(config)#ip routing
Switch(config)#ex
四、测试
vlan内通信
pc0 ping pc3
vlan间通信
pc0 ping pc2