This document refers to IOSv-L2 switch.
After starting the switch, you can open a console to manage and configure it and use the following commands to configure the switch:
?
: Command shows a list of available commands. You can add a command name to get help on a specific command.
sh enable
: Enter privileged mode. This is required to configure the switch.conf t
: Enter terminal configuration modeinterface <interface>
: Enter interface configuration modeexit
: Exit from the current mode
show interfaces
: Show interfacesshow interfaces status
: Show interface statusesshow interfaces description
: Show interface descriptionsshow interfaces <interface>
: Show detailed information about the interface
-
vlan <vlan-id>
: Create a VLAN. VLAN ID must be between 1 and 4094. Enters VLAN configuration mode. -
name <name>
: Set the name of the VLAN. -
show vlan
: Show VLANs -
show interfaces switchport
: Show switchport configurationRun the following commands in interface configuration mode to configure an access port:
switchport mode access
: Configure interface as access portswitchport access vlan <vlan-id>
: Assign the access port a VLAN
Run the following commands in interface configuration mode to configure a trunk port:
switchport trunk encapsulation dot1q
: Configure trunk encapsulation as 802.1Qswitchport mode trunk
: Configure interface as trunk portswitchport trunk allowed vlan <vlan-id>
: Assign allowed VLANs to the trunk port
spanning-tree vlan 1
: Enable STP for VLAN 1show spanning-tree
: Show STP configurationsspanning-tree priority <value>
: Change switch priority valuespanning-tree vlan 1 root primary
: Set switch as primary root bridgeclear spanning-tree [interface]
: Clear STP for an interfacespanning-tree port-priority [interface] [priority]
: Set priority for an interfaceüno spanning-tree vlan 1
: Disable STP for VLAN 1