Multi-layer switches are used to implement communication between different VLANs.
The lab image is included in the attachment.
Basic Configuration
PC1 IP: 192.168.1.1 subnet mask: 255.255.255.0 Gateway: 16.01.254
PC2 IP: 192.168.2.1 subnet mask: 255.255.255.0 Gateway: 16.02.254
PC3 IP: 192.168.3.1 subnet mask: 255.255.255.0 Gateway: 16.03.254
A layer-2 switch SW1 and layer-3 Switch SW2 are also required.
The port of PC1 is connected to port f0/2 of the SW1 switch, and port f0/3 of the SW1 switch,
PC3 port is connected to switch SW1 port f0/4, and switch SW1 port f0/1 and layer-3 Switch f0/1
Connected.
Then configure the command for the device
Configure switch SW1
Switch> enable // Switch Mode
Switch # configureterminal
Enterconfigurationcommands, oneperline. EndwithCNTL/Z.
Switch (config) # hostnameSW1 // modify the Host Name
SW1 (config) # vlan10 // create a VLAN
SW1 (config-vlan) # vlan20
SW1 (config-vlan) # vlan30
SW1 (config-vlan) # exit // exit
SW1 (config) # interfacefastEthernet0/2 // enter the port
SW1 (config-if) # switchportmodeaccess // change the port mode to access
SW1 (config-if) # switchportaccessvlan10 // Add port f0/2 To VLAN10
SW1 (config-if) # exit
SW1 (config) # interfacefastEthernet0/3
SW1 (config-if) # switchportmodeaccess
SW1 (config-if) # switchportaccessvlan20
SW1 (config-if) # noshutdown
SW1 (config-if) # exit
SW1 (config) # interfacefastEthernet0/4
SW1 (config-if) # switchportmodeaccess
SW1 (config-if) # switchportaccessvlan30
SW1 (config-if) # noshutdown
SW1 (config-if) # eixt
SW1 (config) # exit
SW1 #
% SYS-5-CONFIG_ I: Configuredfromconsolebyconsole
SW1 # showvlan // view VLAN
VLANNameStatusPorts
----------------------------------------------------------------------------
1defaactiveactivefa0/1, Fa0/5, Fa0/6, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
Fa0/16, Fa0/17, Fa0/18, Fa0/19
Fa0/20, Fa0/21, Fa0/22, Fa0/23
Fa0/24, Gig0/1, Gig0/2
10VLAN0010activeFa0/2
20VLAN0020activeFa0/3
30VLAN0030activeFa0/4
1002fddi-defaact Act/unsup
1003token-ring-defaultact/unsup
1004fddinet-defaultact/unsup
1005trnet-defaultact/unsup
VLANTypeSAIDMTUParentRingNoBridgeNoStpBrdgModeTrans1Trans2
--------------------------------------------------------------------
1enet000011500 ----- 00
10enet1000101500 ----- 00
20enet1000201500 ----- 00
30enet1000301500 ----- 00
1002fddi1010021500 ----- 00
1003tr1010031500 ----- 00
1004fdnet1010041500 --- ieee-00
1005trnet1010051500 --- ibm-00
RemoteSPANVLANs
------------------------------------------------------------------------------
PrimarySecondaryTypePorts
---------------------------------------------------------------------------
Go to layer-3 Switch SW2 for command configuration
Switch> enable
Switch # configureterminal
Enterconfigurationcommands, oneperline. EndwithCNTL/Z.
Switch (config) # hostname SW2
SW2 (config) # vlan10
SW2 (config-vlan) # vlan20
SW2 (config-vlan) # vlan30
SW2 (config-vlan) # exit
SW2 (config) # iprouting // enable the routing function
SW2 (config) # interfacevlan10 // enter the virtual LAN
SW2 (config-if )#
% LINK-5-CHANGED: InterfaceVlan10, changedstatetoup
SW2 (config-if) # ipaddress192.168.1.2520.5.255.255.0 // configure the IP address the same as that of the PC gateway.
SW2 (config-if) # noshutdown // open the port
SW2 (config-if) # exit
SW2 (config) # interfacevlan20
SW2 (config-if )#
% LINK-5-CHANGED: InterfaceVlan20, changedstatetoup
SW2 (config-if) # ipaddress192.168.2.2520.5.255.255.0
SW2 (config-if) # noshutdown
SW2 (config-if) # exit
SW2 (config) # inter
SW2 (config) # interfacevlan30
SW2 (config-if )#
% LINK-5-CHANGED: InterfaceVlan30, changedstatetoup
SW2 (config-if) # ipaddress192.168.3.2520.5.255.255.0
SW2 (config-if) # noshutdown
SW2 (config-if) # exit
SW2 (config) # interfacef0/1
SW2 (config-if) # switchporttrunkencapsulationdot1q // modify the Encapsulation Format of a layer-3 Switch
SW2 (config-if) # switchportmodetrunk // change the port f0/1 mode to trunk
SW2 (config-if )#
% LINEPROTO-5-UPDOWN: LineprotocolonInterfaceFastEthernet0/1, changedstatetodown
% LINEPROTO-5-UPDOWN: LineprotocolonInterfaceFastEthernet0/1, changedstatetoup
% LINEPROTO-5-UPDOWN: LineprotocolonInterfaceVlan10, changedstatetoup
% LINEPROTO-5-UPDOWN: LineprotocolonInterfaceVlan20, changedstatetoup
% LINEPROTO-5-UPDOWN: LineprotocolonInterfaceVlan30, changedstatetoup
SW2 (config-if) # end
SW2 #
% SYS-5-CONFIG_ I: Configuredfromconsolebyconsole
SW2 # showinterfacestrunk // view trunk Information
PortModeEncapsulationStatusNativevlan
Fa0/1on802. 1qtrunking1
PortVlansallowedontrunk
Fa0/11-1005
PortVlansallowedandactiveinmanagementdomain
Fa0/11, 10, 20, 30
PortVlansinspanningtreeforwardingstateandnotpruned
Fa0/11, 10, 20, 30
Switch # showinter
Switch # showinterfacesvlan
% Incompletecommand.
SW2 # showvlan
VLANNameStatusPorts
----------------------------------------------------------------------------
1defaactiveactivefa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/12, Fa0/13
Fa0/14, Fa0/15, Fa0/16, Fa0/17
Fa0/18, Fa0/19, Fa0/20, Fa0/21
Fa0/22, Fa0/23, Fa0/24, Gig0/1
Gig0/2
10VLAN0010active
20VLAN0020active
30VLAN0030active
1002fddi-defaact Act/unsup
1003token-ring-defaultact/unsup
1004fddinet-defaultact/unsup
1005trnet-defaultact/unsup
VLANTypeSAIDMTUParentRingNoBridgeNoStpBrdgModeTrans1Trans2
--------------------------------------------------------------------
1enet000011500 ----- 00
10enet1000101500 ----- 00
20enet1000201500 ----- 00
30enet1000301500 ----- 00
1002fddi1010021500 ----- 00
1003tr1010031500 ----- 00
1004fdnet1010041500 --- ieee-00
1005trnet1010051500 --- ibm-00
RemoteSPANVLANs
------------------------------------------------------------------------------
PrimarySecondaryTypePorts
---------------------------------------------------------------------------
SW2 #
SW2 # showiproute // view the route table
Codes: C-connected, S-static, I-IGRP, R-RIP, M-mobile, B-BGP
D-EIGRP, EX-EIGRPexternal, O-OSPF, IA-OSPFinterarea
N1-OSPFNSSAexternaltype1, N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1, E2-OSPFexternaltype2, E-EGP
I-IS, L1-IS-ISlevel-1, L2-IS-ISlevel-2, ia-IS-ISinterarea
*-Candidatedefault, U-per-userstaticroute, o-ODR
P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
C192.168.1.0/24 isdirectlyconnected, Vlan10
C192.168.2.0/24 isdirectlyconnected, Vlan20
C192.168.3.0/24 isdirectlyconnected, Vlan30
Switch #
Lab results
PC> ping192.168.2.1
Pinging192.168.2.1with32bytesofdata:
Requesttimedout.
Replyfrom192.168.2.1: bytes = 32 time = 1 msTTL = 127
Replyfrom192.168.2.1: bytes = 32 time = 0 msTTL = 127
Replyfrom192.168.2.1: bytes = 32 time = 0 msTTL = 127
Pingstatisticsfor192.168.2.1:
Packets: Sent = 4, stored ED = 3, Lost = 1 (25% loss ),
Approximateroundtriptimesinmilli-seconds:
Minimum = 0 ms, Maximum = 1 ms, Average = 0 ms
PC> ping192.168.3.1
Pinging192.168.3.1with32bytesofdata:
Requesttimedout.
Replyfrom192.168.3.1: bytes = 32 time = 0 msTTL = 127
Replyfrom192.168.3.1: bytes = 32 time = 0 msTTL = 127
Replyfrom192.168.3.1: bytes = 32 time = 0 msTTL = 127
Pingstatisticsfor192.168.3.1:
Packets: Sent = 4, stored ED = 3, Lost = 1 (25% loss ),
Approximateroundtriptimesinmilli-seconds:
Minimum = 0 ms, Maximum = 0 ms, Average = 0 ms