1、利用三层交换机实现不同 VLAN 之间的互访交换机 switch0 和 switch1 创建 4 个 vlan,vlan 10,vlan 20,vlan30,vlan 40,将每个交换机的fa0/1-3,fa0/4-6,fa0/7-9,fa0/10-12 分别分配给以上四个 vlan,再在三层交换机上进行配置,要求实现不同 vlan 之间能够互访。一、拓扑图二、交换机的配置1、switch0 的配置SwitchenSwitch#vlan database% Warning: It is recommended to configure VLAN from config mode,as VLAN
2、 database mode is being deprecated. Please consult userdocumentation for configuring VTP/VLAN in config mode.Switch(vlan)#vlan 10VLAN 10 added:Name: VLAN0010Switch(vlan)#vlan 20VLAN 20 added:Name: VLAN0020Switch(vlan)#vlan 30VLAN 30 added:Name: VLAN0030Switch(vlan)#vlan 40VLAN 40 added:Name: VLAN004
3、0Switch(vlan)#exitAPPLY completed.ExitingSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#interface range fa0/1-3Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 10Switch(config-if-range)#exitSwitch(config)#interface
4、range fa0/4-6Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 2% Access VLAN does not exist. Creating vlan 2Switch(config-if-range)#switchport access vlan 20Switch(config-if-range)#exitSwitch(config)#interface range fa0/7-9Switch(config-if-range)#switchpor
5、t mode accessSwitch(config-if-range)#switchport access vlan 30Switch(config-if-range)#exitSwitch(config)#interface range fa0/10-12Switch(config-if-range)#switchport mode accessSwitch(config-if-range)#switchport access vlan 40Switch(config-if-range)#exitSwitch(config)#interface fa0/24Switch(config-if
6、)#switchport mode trunkSwitch(config-if)#switchport trunk allowed vlan allSwitch(config-if)#exitSwitch(config)#2、switch1 的配置同 switch0 的配置一样3、Multilayer Switch0SwitchenableSwitch#vlan database% Warning: It is recommended to configure VLAN from config mode,as VLAN database mode is being deprecated. Pl
7、ease consult userdocumentation for configuring VTP/VLAN in config mode.Switch(vlan)#vlan 10VLAN 10 added:Name: VLAN0010Switch(vlan)#vlan 20VLAN 20 added:Name: VLAN0020Switch(vlan)#vlan 30VLAN 30 added:Name: VLAN0030Switch(vlan)#vlan 40VLAN 40 added:Name: VLAN0040Switch(vlan)#exitAPPLY completed.Exit
8、ingSwitch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#ip routingSwitch(config)#interface vlan 10Switch(config-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
9、 address 192.168.0.254 255.255.255.0Switch(config-if)#no shutdownSwitch(config-if)#exitSwitch(config)#interface 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 address 192.1
10、68.1.254 255.255.255.0Switch(config-if)#no shutdownSwitch(config-if)#exitSwitch(config)#interface vlan 30%LINK-5-CHANGED: Interface Vlan30, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to upSwitch(config-if)#ip address 192.168.2.254 255.255.255.0Switch(con
11、fig-if)#no shutdownSwitch(config-if)#exitSwitch(config)#interface vlan 40%LINK-5-CHANGED: Interface Vlan40, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan40, changed state to upSwitch(config-if)#ip address 192.168.3.254 255.255.255.0Switch(config-if)#no shutdownSwitch(config-if)#ZSwitch#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#三、电脑的配置三、测试连通性Pc0 ping 其它电脑