Switches forward frames by VLAN and learn MAC addresses as traffic flows. Spanning tree, DTP and EtherChannel negotiate between the two ends of each link, as on real Catalyst switches.
Puts it in VLAN 10. If the VLAN doesn't exist yet the port is inactive until it does.
In privileged EXEC
show vlan brief
Each VLAN and its access ports.
show interfaces status
Each port's status, VLAN, duplex and speed.
show mac address-table
The MAC addresses learnt, per VLAN and port.
show interfaces Fa0/1 switchport
The port's administrative and operational mode, access and native VLAN.
Trunks and DTP
A link trunks when both ends agree: trunk with trunk, dynamic auto or dynamic desirable; or dynamic desirable with dynamic auto. Two dynamic auto ends stay access, as on a real 2960. A native VLAN mismatch logs %CDP-4-NATIVE_VLAN_MISMATCH on both switches.
Switch (2960)
Under interface Gi0/1
switchport mode trunk
Always trunk (and keep sending DTP).
switchport trunk native vlan 99
Untagged frames belong to VLAN 99.
switchport trunk allowed vlan 10,20,99
Carry only these VLANs (add, remove, except, all and none work too).
switchport nonegotiate
Stops DTP on a trunk or access port.
switchport mode dynamic desirable
Asks the other end to trunk.
switchport mode trunk
Back to a fixed trunk.
In privileged EXEC
show interfaces trunk
Each trunk with its native VLAN, allowed VLANs and the VLANs forwarding.
switchport trunk encapsulation dot1q is accepted, as a 3560 configuration has it. Trunks are always 802.1Q: ISL isn't simulated.
IP phones: voice VLAN and PoE
An IP phone sits between the switch port and a computer: the phone's own frames are tagged with the port's voice VLAN, which the phone learns from CDP, and the computer's frames pass through untagged into the access VLAN. Without a voice VLAN (or with CDP off on the port) the phone sends untagged frames in the access VLAN, with the computer. A PoE switch powers the phone from the port; with no power the phone is dark and the port shows notconnect. Clicking a phone shows its Settings > Network Configuration screen.
Switch (2960)
Under interface Fa0/1
switchport voice vlan 20
The voice VLAN, announced to the phone by CDP. The port stays an access port for the data VLAN.
power inline never
No power on the port (auto, the default, powers a phone it detects; static reserves the power).
In privileged EXEC
show power inline
The PoE budget (available, used, remaining) and each port's admin and operational state, watts and device.
show interfaces fa0/1 switchport
The access VLAN and the voice VLAN of the port.
show cdp neighbors
Phones show as SEP followed by their MAC address, capability H P M, platform IP Phone.
Spanning tree
Every switch runs spanning tree per VLAN. The simulator elects the root bridge, root ports, designated and alternate ports from the bridge IDs, costs and port IDs, and blocks the right end. PVST+ (the default), Rapid PVST+ and MST are all there, with their own show output.
Switch (2960)
In global configuration
spanning-tree mode rapid-pvst
Rapid PVST+ (pvst and mst are the other modes).
spanning-tree vlan 10 priority 4096
Sets the bridge priority for VLAN 10 (in steps of 4096).
spanning-tree vlan 20 root primary
Makes this switch the root for VLAN 20 (secondary for the backup root).
Under interface Gi0/1
spanning-tree cost 10
The port's cost, to steer which uplink is the root port.
spanning-tree port-priority 64
The port's priority, the tie-breaker between parallel links.
Under interface Fa0/1
spanning-tree portfast
An edge port: forwards at once (use it only towards hosts).
spanning-tree bpduguard enable
Err-disables the port if a BPDU arrives.
In global configuration
spanning-tree portfast default
PortFast on every access port.
spanning-tree portfast bpduguard default
BPDU Guard on every PortFast port.
Under interface Fa0/24
spanning-tree guard root
Root guard: the port must stay designated. Superior BPDUs (a switch that would become root) hold it blocked as root-inconsistent until they stop; logs %SPANTREE-2-ROOTGUARD_BLOCK. Use it on designated ports only.
Under interface Gi0/2
spanning-tree guard loop
Loop guard: a root or alternate port that stops hearing BPDUs goes loop-inconsistent (blocked) instead of becoming designated and forwarding. It recovers when BPDUs return (none turns both guards off).
In global configuration
spanning-tree loopguard default
Loop guard on every point-to-point port (not edge ports, not ports with root guard).
Under interface Gi0/2
spanning-tree bpdufilter enable
The port neither sends nor hears BPDUs, so both ends act as designated. On a link between switches it opens a loop, unless loop guard is on the far end.
In privileged EXEC
show spanning-tree
The root, this bridge, and each port's role, state and cost, per VLAN.
show spanning-tree vlan 10
The same for one VLAN.
show spanning-tree root
The root bridge of each VLAN and the way to it.
show spanning-tree summary
The mode and the global features (PortFast, BPDU Guard and loop guard defaults).
show spanning-tree inconsistentports
The ports root guard or loop guard holds blocked, per VLAN. In show spanning-tree they show BKN* and *ROOT_Inc or *LOOP_Inc.
show interfaces status err-disabled
Ports err-disabled, and why.
MST
Switch (2960)
In global configuration
spanning-tree mode mst
Multiple Spanning Tree.
Under spanning-tree mst configuration
name CAMPUS
The region name. Switches in one region need the same name, revision and VLAN map.
revision 1
The region's revision number.
instance 1 vlan 10,20
Maps VLANs to instance 1.
show pending
The region configuration as it will be when you leave this mode.
In global configuration
spanning-tree mst 1 priority 4096
This switch's priority in instance 1.
In privileged EXEC
show spanning-tree mst configuration
The region name, revision and VLAN map in use.
show spanning-tree mst
Each instance's root and port roles.
In global configuration
spanning-tree mode pvst
Back to PVST+.
EtherChannel
Members bundle when both ends agree (LACP active/passive, PAgP desirable/auto, or on with on) and their settings match. A member that differs is suspended. The bundle is one link for spanning tree.
Switch (2960)
Under interface range Gi0/1 - 2
channel-group 1 mode active
Bundles the ports into Port-channel 1 with LACP (passive, desirable, auto and on work too).
Under interface Po1
switchport mode trunk
Configure the bundle on the port-channel; the members follow.
In global configuration
port-channel load-balance src-dst-ip
How flows are spread over the members (src-mac, dst-mac, src-dst-mac, src-ip, dst-ip, src-dst-ip).
In privileged EXEC
show etherchannel summary
Each bundle, its protocol and its members with their flags (P bundled, I stand-alone, s suspended, D down).
show etherchannel port-channel
The bundle in detail.
show etherchannel load-balance
The load-balancing method.
show lacp neighbor
The LACP partner on each member.
Under interface range Gi0/1 - 2
no channel-group
Takes the ports out of the bundle.
SVIs and inter-VLAN routing
A 2960 has one management SVI and a default gateway. A 3560 with ip routing routes between its SVIs and routed ports, and takes static routes. Routers do router-on-a-stick with subinterfaces (see Routing).
Layer 3 switch (3560)
In global configuration
ip routing
Turns the switch into a router.
vlan 10
The VLAN the SVI serves.
Under interface vlan 10
ip address 10.0.10.1 255.255.255.0
The SVI's address: the gateway of VLAN 10. It is up once an up port is in VLAN 10.
no shutdown
Brings the SVI up.
In privileged EXEC
show interfaces vlan 10
The SVI's status, line protocol and address.
show ip route
The routing table: connected SVIs and static routes.
Switch (2960)
Under interface vlan 99
ip address 10.0.99.2 255.255.255.0
The management address of a Layer 2 switch.
In global configuration
ip default-gateway 10.0.99.1
Where the switch sends traffic for other subnets.
SPAN and RSPAN
Switch (2960)
In global configuration
monitor session 1 source interface Fa0/1 both
Copies what Fa0/1 sends and receives (rx, tx) to the session.
monitor session 1 destination interface Fa0/10
Sends the copies to Fa0/10, where an analyser listens. The port stops being a normal port.
Under vlan 900
remote-span
Makes VLAN 900 an RSPAN VLAN, to carry the copies to another switch.