Switching and VLANs
Core15
How does a switch learn MAC addresses and decide where to send a frame?
Say this first
It learns from the source MAC of every frame, recording MAC, VLAN and ingress port. To forward, it looks up the destination MAC in that VLAN. A known unicast goes out one port. Unknown unicast, broadcast and multicast (without IGMP snooping) are flooded to every port in the VLAN except the one the frame came in on. Entries age out after 300 seconds of silence on Cisco by default.
Go deeper
The four actions
- Learn. Source MAC plus VLAN maps to the ingress port. If the same MAC shows up on another port, the entry moves.
- Forward. Destination known and on another port: send it out that one port.
- Filter. Destination known and on the same port it arrived on: drop it. You only see this behind a hub or another unmanaged switch.
- Flood. Unknown unicast, broadcast, and multicast the switch has no snooping state for: send to every port in the VLAN, trunks included, except the ingress port.
Aging
The default is 300 seconds on Cisco IOS (
mac address-table aging-time). Every frame from that MAC resets the timer. Topology changes flush or shorten it, which is why a busy spanning tree causes flooding.Looking at it
Output SW1# show mac address-table dynamic vlan 10 Mac Address Table ------------------------------------------- Vlan Mac Address Type Ports ---- ----------- -------- ----- 10 0050.56a1.0101 DYNAMIC Gi1/0/1 10 0050.56a1.0202 DYNAMIC Gi1/0/48 Total Mac Addresses for this criterion: 2The table is keyed on VLAN plus MAC, so the same MAC can live in two VLANs at once.
They will ask next
What happens when the MAC table is full?
The switch cannot learn new addresses, so frames to those hosts are flooded like unknown unicast. A MAC flooding attack (tools like macof) fills the table on purpose so the attacker sees other people's traffic. Port security, which caps MACs per port, is the standard defense.
Does a switch learn from broadcast frames?
Yes. Learning only looks at the source address. Most hosts get learned from their first ARP request, which is a broadcast.
Traps
- Saying a switch learns from destination addresses. It learns only from source addresses.
- Confusing MAC aging (300 seconds) with the ARP timeout (4 hours on Cisco IOS). They are different tables at different layers.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is the difference between store-and-forward and cut-through switching?
Say this first
Store-and-forward receives the whole frame, checks the FCS, then sends it, so corrupt frames die at the first switch and latency grows with frame size. Cut-through starts sending once it has read the destination (and usually the VLAN tag), which cuts latency to well under a microsecond on modern ASICs, but it forwards corrupt frames. Catalyst campus switches are store-and-forward; many low-latency data center switches support cut-through.
Go deeper
The latency math
A store-and-forward switch must receive the full frame before sending. A 1500-byte frame at 1 Gbps takes 1500 x 8 / 10^9 = 12 microseconds to arrive; at 10 Gbps it takes 1.2 microseconds. That cost is paid at every hop. For a campus user it is noise; for trading, HPC and some storage it matters.
When cut-through falls back
- The egress port is busy, so the frame has to be queued anyway.
- The egress port is faster than the ingress port (10G in, 40G out). Starting early would run out of data mid-frame, so the switch buffers the whole frame first.
Error behavior
A cut-through switch has already sent most of a frame when it sees a bad FCS. It cannot drop it, so it ends the frame with a deliberately invalid FCS (Nexus calls this stomping). The bad frame is then counted as a CRC error on every hop downstream, and you have to trace it back to the port where it starts.
Fragment-free
A historic middle ground: wait for the first 64 bytes, which covers a collision fragment on half-duplex Ethernet, then cut through.
They will ask next
In a cut-through fabric you see CRC errors on many switches. How do you find the bad link?
Find the port where errors originate. On Nexus, compare the CRC counter with the stomped CRC counter: if they are equal, the errors came from upstream; if CRC errors exceed stomped ones, the local link or optic is the source. Then walk upstream until you find it.
Traps
- Saying cut-through checks the FCS before forwarding. It cannot; the frame is already leaving.
How did you do?Book 3.1 Switching BasicsBook 3.5 ImplementationOwn pageWalk me through the fields of an Ethernet frame.
Say this first
On the wire: preamble (7 bytes) and SFD (1), then destination MAC (6), source MAC (6), an optional 802.1Q tag (4), EtherType or length (2), payload (46 to 1500) and FCS (4, a CRC-32). The frame counted from destination MAC to FCS is 64 to 1518 bytes, or up to 1522 with one VLAN tag.
Go deeper
Field by field
Field Bytes Notes Preamble 7 Alternating 1s and 0s for clock sync SFD 1 10101011, marks the start of the frameDestination MAC 6 First so a switch can start the lookup early Source MAC 6 What the switch learns from 802.1Q tag 4 Optional. TPID 0x8100plus PCP, DEI, VLAN IDEtherType / length 2 0x0600(1536) and up is an EtherType; 1500 and below is an 802.3 lengthPayload 46 to 1500 Padded up to 46 if shorter FCS 4 CRC-32 over the frame; bad FCS means drop After every frame there is a 12-byte interframe gap. So a 64-byte frame really occupies 84 bytes of wire time, which is why 1 Gbps line rate is 1,488,095 frames per second at minimum size.
EtherTypes worth knowing
0x0800IPv4,0x86DDIPv6,0x0806ARP,0x8100802.1Q,0x88A8802.1ad outer tag,0x8847MPLS,0x88CCLLDP,0x8809slow protocols (LACP).Address bits
The lowest bit of the first byte is the I/G bit: 1 means group (multicast or broadcast). The next bit is U/L: 1 means locally administered.
ffff.ffff.ffffis broadcast; IPv4 multicast maps to0100.5exx.xxxxand IPv6 multicast to3333.xxxx.xxxx.They will ask next
Why is the minimum frame 64 bytes?
Half-duplex CSMA/CD. A sender must still be transmitting when a collision from the far end of a maximum-size 10 Mbps network gets back to it, so the slot time is 512 bit times, which is 64 bytes. Full duplex has no collisions, but the minimum stayed for compatibility.
What are runts and giants?
A runt is shorter than 64 bytes, usually a collision fragment or a faulty NIC. A giant is larger than the port accepts (1518, or 1522 tagged, unless jumbo frames are enabled). Both are dropped and counted in
show interfaces.
Traps
- Counting the preamble in the 64-byte minimum. The minimum runs from destination MAC to FCS.
- Forgetting that a 4-byte tag pushes a full-size frame to 1522 bytes.
How did you do?Book 2.3 FramingBook 2.6 Multi-Access NetworksOwn pagePC1 and PC2 are in VLAN 10 on two switches joined by a trunk. Walk me through what happens when PC1 pings PC2.
Say this first
PC1 sees PC2 is in its own subnet, so it ARPs for PC2's MAC. The broadcast is learned and flooded by SW1, crosses the trunk tagged with VLAN 10, is learned and flooded by SW2, and PC2 answers with a unicast ARP reply. Now both switches know both MACs, and the ICMP echo and reply are forwarded port to port with no flooding. No MAC is rewritten and no TTL is decremented: nothing is routed.
Go deeper
Setup: PC1
10.10.0.11(0050.56a1.0011) on SW1 Gi1/0/1, PC210.10.0.12(0050.56a1.0012) on SW2 Gi1/0/2, trunk on Gi1/0/48 at both ends.- PC1 ANDs
10.10.0.12with its /24 mask: same subnet, so deliver directly. Its ARP cache has no entry for PC2. - PC1 sends an ARP request: destination
ffff.ffff.ffff, source0050.56a1.0011. - SW1 learns
0050.56a1.0011on Gi1/0/1 in VLAN 10 and floods the broadcast to its other VLAN 10 ports and out Gi1/0/48 with an 802.1Q tag, VLAN ID 10. - SW2 learns PC1's MAC on Gi1/0/48 in VLAN 10, strips the tag and floods to its VLAN 10 access ports.
- PC2 recognizes its IP and replies with a unicast ARP reply to
0050.56a1.0011. - SW2 learns PC2 on Gi1/0/2, already knows PC1 is behind Gi1/0/48, and sends the reply tagged. SW1 learns PC2 on Gi1/0/48 and forwards to Gi1/0/1.
- PC1 caches the ARP entry and sends the ICMP echo request as unicast. Both switches forward it without flooding, and the reply comes back the same way.
Each switch recomputes the FCS when it adds or removes the tag, because the frame contents change.
They will ask next
What changes if PC2 is in VLAN 20?
PC1 sees a different subnet, so it ARPs for its default gateway instead. It sends the echo to the gateway's MAC with PC2's IP. The router or SVI rewrites both MACs, decrements the TTL and forwards into VLAN 20, where it may need to ARP for PC2 itself.
Traps
- Saying the switch answers the ARP. A plain layer 2 switch only floods it; PC2 answers.
How did you do?Book 3.2 Switched EthernetBook 3.3 Internet (IP)Own page- PC1 ANDs
A port shows err-disabled. What does that mean and how do you bring it back?
Say this first
The switch shut the port in software because a protection feature tripped: BPDU guard, port security, UDLD, EtherChannel misconfig guard, link flap, storm control and others. I read the reason first, remove the cause, then
shutdownandno shutdown. Automatic recovery exists (errdisable recovery cause ..., 300 seconds by default) but is off until you enable it per cause.Go deeper
Find the reason
Output SW1# show interfaces status err-disabled Port Name Status Reason Err-disabled Vlans Gi1/0/5 Desk 3.12 err-disabled bpduguardThe log line at the moment it happened is just as useful:
Output %SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Gi1/0/5 with BPDU Guard enabled. Disabling port. %PM-4-ERR_DISABLE: bpduguard error detected on Gi1/0/5, putting Gi1/0/5 in err-disable stateCommon reasons
Reason Trigger bpduguardA BPDU arrived on a port with BPDU guard psecure-violationPort security in shutdown mode saw a disallowed MAC udldUDLD found a unidirectional link channel-misconfigEtherChannel bundled on one side only link-flapThe link went up and down too often storm-controlStorm control with action shutdown dhcp-rate-limit,arp-inspectionDHCP snooping or DAI rate limit exceeded Automatic recovery
Cisco IOS errdisable recovery cause bpduguard errdisable recovery cause psecure-violation errdisable recovery interval 300show errdisable recoverylists enabled causes and the time left per port.They will ask next
Why not enable recovery for every cause?
A port that recovers into the same fault fails again every interval. For a loop or a bad fiber that means a repeating outage. I enable it for user-caused events like BPDU guard and port security, with alerting, and investigate UDLD and channel-misconfig by hand.
Is err-disabled the same as administratively down?
No. The config still says
no shutdown; the switch disabled the port.show interfacesreportsdown, line protocol is down (err-disabled).
Traps
- Bouncing the port without reading the reason. It trips again, or the loop it stopped comes back.
How did you do?Own pageWhat are CDP and LLDP, and how do they differ?
Say this first
Both are one-way layer 2 discovery protocols: a device advertises its name, port, platform, addresses and capabilities, and each neighbor caches it. CDP is Cisco proprietary, sent every 60 seconds with a 180-second holdtime to
0100.0ccc.cccc. LLDP is IEEE 802.1AB, sent every 30 seconds with a 120-second TTL to0180.c200.000e, EtherType0x88CC. I use LLDP in multi-vendor networks and turn both off on untrusted ports.Go deeper
Side by side
CDP LLDP Standard Cisco IEEE 802.1AB Timer / hold 60 s / 180 s 30 s / 120 s (4 x 30) Destination MAC 0100.0ccc.cccc0180.c200.000eDefault on Cisco IOS On Off until lldp runPhones Voice VLAN, power LLDP-MED: network policy, power, location LLDP has four mandatory TLVs (chassis ID, port ID, TTL, end) and optional ones such as system name, port description, capabilities and management address. CDPv2 also carries native VLAN and duplex, and logs
%CDP-4-NATIVE_VLAN_MISMATCHand%CDP-4-DUPLEX_MISMATCHwhen neighbors disagree.Defaults elsewhere
NX-OS runs CDP by default and needs
feature lldp. Arista EOS and Junos on EX switches run LLDP by default.Configuration
Cisco IOS lldp run interface GigabitEthernet1/0/1 no cdp enableOutput SW1# show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID SW2 Gig 1/0/48 157 S I C9300-48P Gig 1/0/48They will ask next
How does an IP phone learn its voice VLAN?
A Cisco phone reads it from CDP. Other phones read the LLDP-MED network policy TLV, which carries the VLAN plus the CoS and DSCP to use. On a mixed fleet you run both on phone ports.
Why disable them on edge or internet-facing ports?
They hand out platform, software version and management IP to anyone listening, which is free reconnaissance. Keep them on infrastructure links and phone ports.
Traps
- Saying LLDP needs a reply from the neighbor. Neither protocol has requests or acknowledgments.
- Assuming LLDP is on by default on Cisco IOS. It is off until
lldp run.
How did you do?Own pageWhat is a VLAN and why would you use one?
Say this first
A VLAN is a separate layer 2 broadcast domain carved out of shared switch hardware. Ports in VLAN 10 and VLAN 20 cannot talk at layer 2, even on the same switch; traffic between them must be routed. We use VLANs to keep broadcast domains small, to separate groups like users, phones, cameras and guests for security and policy, and to group devices by role instead of by where they are plugged in.
Go deeper
What you get
- Smaller broadcast domains. ARP, DHCP and other broadcasts stay inside the VLAN.
- A policy point. Traffic between VLANs has to cross a router, layer 3 switch or firewall, which is where ACLs and inspection happen.
- Per-group treatment. Voice gets its own VLAN and QoS; guests get a VLAN that only reaches the internet.
- Flexibility. Two people on different floors can share a VLAN, two people at adjacent desks can be in different ones.
Conventions
One VLAN maps to one IP subnet. Hosts decide "local or via the gateway" by subnet, so mixing subnets in a VLAN or splitting one subnet across VLANs causes confusing failures.
The cost
A VLAN stretched across a whole campus is one large failure domain: a loop or broadcast storm in it reaches every switch. Modern campus designs keep VLANs inside one access block and route above it.
They will ask next
Is a VLAN a security boundary?
It separates traffic at layer 2, but misconfiguration (DTP, native VLAN, VLAN hopping) can break it, and all VLANs share the same hardware. The real enforcement point is the layer 3 boundary, with ACLs or a firewall between VLANs.
Traps
- Saying VLANs split collision domains. Every switch port already is its own collision domain; VLANs split broadcast domains.
How did you do?Book 3.2 Switched EthernetOwn pageWhat are the VLAN ranges, and where does a Cisco switch store its VLAN configuration?
Say this first
The VLAN ID is 12 bits, so 0 to 4095; 0 and 4095 are reserved, leaving 1 to 4094. On Cisco, 1 to 1005 is the normal range (VLAN 1 is the default and cannot be deleted, 1002 to 1005 are reserved for FDDI and Token Ring) and 1006 to 4094 is the extended range. Normal-range VLANs live in
vlan.datin flash, not in the running config, unless the switch runs VTP transparent or off mode.Go deeper
Range Use 0 Reserved (priority-tagged frames carry VLAN 0) 1 Default VLAN, cannot be deleted 2 to 1001 Normal range, VTP versions 1 and 2 can advertise them 1002 to 1005 Reserved legacy FDDI and Token Ring VLANs 1006 to 4094 Extended range: needs VTP transparent or off, or VTPv3 4095 Reserved The vlan.dat trap
write eraseclears the startup config but notvlan.dat. A switch "reset to defaults" still boots with its old VLANs, VTP domain and revision number. To really clear it:Cisco IOS SW1# write erase SW1# delete flash:vlan.dat SW1# reloadIn the running config or not
In VTP server or client mode,
show running-configdoes not list VLANs; back upvlan.dator useshow vlan brief. In transparent or off mode, VLANs appear in the running config and are saved with it.They will ask next
Can you use all 4094 VLANs on a switch?
Rarely. Platforms cap active VLANs and spanning-tree instances well below that. Some also reserve extended-range VLANs internally for routed ports, which
show vlan internal usagelists on platforms that do this, such as the Catalyst 6500.
Traps
- Saying there are 4096 usable VLANs. There are 4094.
- Assuming
write eraseclears VLANs on a Catalyst switch.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is the difference between an access port and a trunk port?
Say this first
An access port belongs to one VLAN and sends and receives untagged frames; end hosts plug in there. A trunk carries many VLANs over one link and marks each frame with an 802.1Q tag, except frames in the native VLAN. Trunks connect switches to switches, routers, firewalls, hypervisors and some APs. A port with a voice VLAN is still an access port, with one extra tagged VLAN for the phone.
Go deeper
Configuration
Cisco IOS interface GigabitEthernet1/0/1 description PC switchport mode access switchport access vlan 10 spanning-tree portfast ! interface GigabitEthernet1/0/48 description Uplink to DSW1 switchport mode trunk switchport trunk allowed vlan 10,20,30 switchport trunk native vlan 999 switchport nonegotiateChecking what a port really is
Output SW1# show interfaces GigabitEthernet1/0/1 switchport Name: Gi1/0/1 Switchport: Enabled Administrative Mode: static access Operational Mode: static access Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: native Negotiation of Trunking: Off Access Mode VLAN: 10 (USERS) Trunking Native Mode VLAN: 1 (default)Administrative mode is what you configured; operational mode is what it actually became. A port in dynamic mode can show "dynamic auto" and "trunk" at the same time.
Who needs a trunk
A hypervisor host with VMs in several VLANs, a firewall with one subinterface per VLAN, an AP that switches several SSIDs locally to their VLANs. An AP that tunnels all client traffic to a controller only needs an access port.
They will ask next
Why set
switchport mode accesswhen a port already works as access?Because the default on most Catalyst switches is dynamic auto. A device that sends DTP could turn the port into a trunk and reach every VLAN. Static access also skips the DTP wait when the link comes up.
Traps
- Saying a trunk carries no untagged traffic. The native VLAN crosses untagged unless you tag it.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is inside an 802.1Q tag?
Say this first
Four bytes inserted after the source MAC. A 2-byte TPID of
0x8100says "tagged frame", then a 2-byte TCI: 3 bits of priority (PCP, the CoS value 0 to 7), 1 bit DEI (drop eligible, once called CFI) and 12 bits of VLAN ID. The original EtherType follows the tag, the FCS is recalculated, and the largest frame grows from 1518 to 1522 bytes.Go deeper
Output | Dest MAC 6 | Src MAC 6 | TPID 0x8100 (2) | PCP 3b | DEI 1b | VID 12b | EtherType 2 | Payload | FCS 4 |The fields in practice
- PCP / CoS. Layer 2 priority. Voice media is usually CoS 5, call signaling CoS 3. It only exists while the frame is tagged, which is why QoS designs carry the marking in DSCP at layer 3 as well.
- DEI. Marks a frame as a candidate to drop first under congestion. Rarely used in enterprise.
- VID. 0 means priority-tagged (a CoS value with no VLAN; the port's VLAN applies). 4095 is reserved.
ISL, for history
Cisco's older trunking protocol encapsulated the whole frame with a 26-byte header and a 4-byte CRC, 30 bytes in all. It is proprietary and gone from current platforms; Catalyst 9000 supports only 802.1Q.
They will ask next
What is a priority-tagged frame and where do you see one?
A frame with an 802.1Q tag whose VLAN ID is 0, used only to carry CoS. A phone configured with
switchport voice vlan dot1psends voice that way, and the switch puts it in the access VLAN.What tag does QinQ add?
An outer service tag, EtherType
0x88A8in 802.1ad, in front of the customer's0x8100tag.
Traps
- Placing the tag before the destination MAC. It sits between the source MAC and the EtherType.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is DTP, and which port modes form a trunk?
Say this first
DTP is Cisco's protocol for negotiating whether a link becomes a trunk.
accessnever trunks.trunkalways trunks and still sends DTP.dynamic desirableactively asks to trunk.dynamic autotrunks only if the other side asks.switchport nonegotiatestops DTP frames. Auto plus auto stays access. Most current Catalyst switches default to dynamic auto, so I set every port to access or trunk explicitly and addnonegotiateon trunks.Go deeper
Result for each pair
access trunk desirable auto access access mismatch access access trunk mismatch trunk trunk trunk desirable access trunk trunk trunk auto access trunk trunk access "Mismatch" means one side tags frames and the other does not: only untagged traffic works, and STP may flag inconsistencies. A side set to
trunkwithnonegotiateagainst a dynamic side gives the same mismatch, because the dynamic side never hears DTP.Details interviewers like
- Dynamic trunking fails when the two switches have different VTP domain names; the switch logs
%DTP-5-DOMAINMISMATCH. - In
show interfaces trunk, an encapsulation ofn-802.1qmeans the trunk was negotiated. - Older platforms such as the Catalyst 2950 and 3550 defaulted to dynamic desirable.
- NX-OS and most other vendors do not run DTP. Against them, set the Cisco side to
trunk.
Output SW1# show interfaces GigabitEthernet1/0/24 switchport | include Administrative Mode|Operational Mode Administrative Mode: dynamic auto Operational Mode: static accessThey will ask next
Does
switchport mode trunkstop DTP?No. The port still sends DTP frames so the other side can follow. Only
switchport nonegotiate(or access mode) stops them.Why does a trunk to a router or a server need
switchport mode trunk?They do not speak DTP. A dynamic auto port facing them never becomes a trunk.
Traps
- Assuming
switchport mode trunkalone disables DTP. - Leaving user ports in dynamic auto. That is exactly what switch spoofing needs.
How did you do?Own page- Dynamic trunking fails when the two switches have different VTP domain names; the switch logs
What is VTP and what do its modes do?
Say this first
VTP is Cisco's protocol for syncing the VLAN database (IDs and names, never port assignments) across the switches of one domain, over trunks. A server creates, changes and deletes VLANs and advertises them. A client takes VLANs from the servers and cannot change them locally. Transparent keeps its own local VLANs and only relays advertisements. Off ignores VTP and does not relay it. Catalyst switches default to server mode with no domain name.
Go deeper
Modes
Mode Create VLANs locally Follows the domain Relays adverts Server Yes Yes Yes Client No Yes Yes Transparent Yes, local only No Yes Off Yes, local only No No In server and client mode the VLANs are not in the running config. In transparent and off mode they are, and they are saved with it.
Versions
- v1: the original.
- v2: adds consistency checks, and a transparent switch relays advertisements without checking the domain name.
- v3: adds a primary server, extended VLANs, private VLANs, MST region sync and a hidden password.
Mechanics
Advertisements go to
0100.0ccc.ccccon trunks only: a summary every 5 minutes and right after every change. Every change on a server raises the configuration revision number. VTP pruning, if enabled, stops flooding a VLAN over a trunk toward switches with no ports in it.Many networks run every switch transparent or off and push VLANs with automation instead.
They will ask next
Does VTP put ports into VLANs?
No. It only syncs which VLANs exist and their names. Port membership is configured on each switch.
What happens if you try to create a VLAN on a client?
The switch refuses it with a message that VLAN configuration is not allowed in client mode.
Traps
- Thinking a client cannot overwrite the domain. In versions 1 and 2, a client with a higher revision number can.
How did you do?Own pageWhat is the difference between router-on-a-stick and SVIs for inter-VLAN routing?
Say this first
Router-on-a-stick routes between VLANs with one router interface split into 802.1Q subinterfaces over a trunk. It is cheap and simple, but every inter-VLAN packet crosses that one link twice and the router's forwarding rate is the ceiling. A layer 3 switch gives each VLAN an SVI and routes in hardware at line rate with no hairpin. Campus networks use SVIs; router-on-a-stick fits a small branch or a lab.
Go deeper
Side by side
Router-on-a-stick SVI on a layer 3 switch Gateway lives on Router subinterface interface VlanNForwarding Router CPU or network processor Switch ASIC Path between VLANs Up the trunk and back down Inside the switch Bottleneck Trunk bandwidth and router throughput Rarely the switch Extra features in the path NAT, firewall, VPN on the router Usually only ACLs Configurations
Cisco IOS ! Router-on-a-stick interface GigabitEthernet0/0/0.10 encapsulation dot1Q 10 ip address 10.10.0.1 255.255.255.0Cisco IOS ! Layer 3 switch ip routing interface Vlan10 ip address 10.10.0.1 255.255.255.0The hairpin
A packet from VLAN 10 to VLAN 20 goes up the trunk tagged 10 and comes back down tagged 20. The trunk carries all inter-VLAN traffic plus everything headed to the WAN, so it saturates early.
They will ask next
When is router-on-a-stick still the right answer?
In a small branch where the router already does NAT, firewalling or VPN, or where you want those features applied between VLANs. A few hundred megabits of internal traffic fits easily.
How do you handle the native VLAN on a router subinterface?
encapsulation dot1Q 1 nativeon the subinterface for that VLAN tells the router to send and expect those frames untagged.
Traps
- Thinking the subinterface number must match the VLAN. Only the VLAN in
encapsulation dot1Qmatters.
How did you do?Book 3.3 Internet (IP)Own pageWhat is EtherChannel, and how do LACP, PAgP and static mode differ?
Say this first
EtherChannel bundles 2 to 8 parallel links into one logical link, so spanning tree sees one port and all links carry traffic. LACP (IEEE 802.3ad, now 802.1AX) negotiates with active and passive modes and works with any vendor. PAgP is Cisco only, with desirable and auto. Static
onnegotiates nothing. LACP forms with active plus active or active plus passive, never passive plus passive. I use LACP active on both ends.Go deeper
Mode combinations
Side A Side B Result active active or passive LACP bundle passive passive No bundle desirable desirable or auto PAgP bundle auto auto No bundle on on Static bundle on anything else Broken: one side bundled, the other not Why not static
oncannot see the far end. If the neighbor is not bundled or is cabled to the wrong switch,onstill bundles, and you get MAC flapping, blackholed traffic or a loop. LACP only bundles a port after exchanging LACPDUs with the same partner.LACP basics
LACPDUs go to
0180.c200.0002(EtherType0x8809), every 30 seconds by default or every second with fast rate. Up to 8 members are active; many platforms allow up to 8 more as hot-standby.Cisco IOS interface range GigabitEthernet1/0/47 - 48 switchport mode trunk channel-group 1 mode active interface Port-channel1 switchport mode trunk switchport trunk allowed vlan 10,20,30They will ask next
What does spanning tree see?
One logical port, Po1, with one cost. A member failing is handled by EtherChannel and does not cause a spanning-tree topology change as long as the bundle stays up.
Can one side run LACP and the other PAgP?
No. Both ends must run the same protocol.
Traps
- Choosing
onbecause it is simpler. It is the one mode that cannot detect a far end that is not bundled.
How did you do?Own pageHow does a voice VLAN work on an access port with a phone and a PC behind it?
Say this first
The phone learns the voice VLAN from the switch through CDP or LLDP-MED. It tags its own voice frames with that VLAN and CoS 5, and passes the PC's frames through untagged, so they land in the access (data) VLAN. The port is still an access port; it just accepts one extra tagged VLAN. Voice and data get separate subnets, separate policy and separate QoS on one cable.
Go deeper
Configuration
Cisco IOS vlan 10 name DATA vlan 110 name VOICE ! interface GigabitEthernet1/0/5 switchport mode access switchport access vlan 10 switchport voice vlan 110 spanning-tree portfast trust device cisco-phonetrust device cisco-phone(Catalyst 9000 syntax; older switches usemls qos trust device cisco-phone) trusts markings only while CDP sees a Cisco phone on the port.Verify
Output SW1# show interfaces GigabitEthernet1/0/5 switchport | include Access Mode|Voice Access Mode VLAN: 10 (DATA) Voice VLAN: 110 (VOICE)show cdp neighborsshows the phone with capabilityP.Non-Cisco phones
They read the voice VLAN from the LLDP-MED network policy TLV. Enable
lldp run, and on some platforms define anetwork-policy profilethat names the voice VLAN and apply it to the port.With 802.1X
Multi-domain authentication (MDA) authenticates the phone into the voice domain and the PC into the data domain on the same port.
They will ask next
Why not just make the phone port a trunk?
A trunk exposes every allowed VLAN to whatever is plugged in behind the phone, runs DTP and changes how spanning tree treats the port. A voice VLAN limits the port to exactly two VLANs and keeps access-port protections.
What happens if CDP is disabled on the port?
A Cisco phone never learns the voice VLAN and sends voice untagged in the data VLAN, unless LLDP-MED or a manual setting on the phone provides it.
Traps
- Calling a voice VLAN port a trunk. It is an access port that also accepts one tagged VLAN.
How did you do?Own page
Working15
What is unknown unicast flooding, and what causes it in a network with no loops?
Say this first
A switch floods a unicast frame to the whole VLAN when it has no MAC entry for the destination. A little is normal. A lot usually means asymmetric routing where the MAC entry ages out (300 seconds) long before the router's ARP entry (4 hours), frequent topology changes flushing the table, a full MAC table, or hosts that receive but never send.
Go deeper
The classic case: asymmetric routing
DSW1 and DSW2 both have an SVI in VLAN 10. Traffic to server SRV1 leaves through DSW1, but SRV1 replies through its HSRP gateway on DSW2. DSW1 never sees a frame sourced by SRV1, so its MAC entry expires after 300 seconds. Its ARP entry is still valid for hours, so DSW1 keeps routing packets to SRV1's MAC, misses in the MAC table, and floods every one of them to all of VLAN 10.
Fixes, in order of preference:
- Make routing symmetric (align HSRP active with the routing path).
- Make MAC aging at least as long as the ARP timeout, or shorten ARP on the SVI below 300 seconds
(
arp timeout 240underinterface Vlan10).
Other causes
- Topology changes. 802.1D shortens aging to 15 seconds after a TCN; RSTP flushes at once. Access ports without PortFast create a topology change every time a PC boots.
- Full MAC table, from an attack or simply too many VMs for the platform.
- Silent receivers, such as a syslog collector that never transmits.
- Microsoft NLB in unicast mode, which floods by design.
How to spot it
Look for output traffic on access ports whose hosts are idle, or capture on a quiet port and look for unicast frames to other MACs.
They will ask next
Why is it also a security problem?
Every port in the VLAN gets a copy of the flooded flow, so any host can read traffic meant for someone else without doing anything active.
How do you keep unknown unicast off a specific port?
switchport block unicaston that interface. It suits ports where port security already pins the legitimate MACs, so nothing the host needs is lost.
Traps
- Blaming spanning tree for every flood. Check MAC and ARP timers and routing symmetry first.
- Raising MAC aging everywhere without thinking. Very long aging slows recovery when a host really moves.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is the difference between CAM and TCAM in a switch?
Say this first
CAM is exact-match memory: give it VLAN plus MAC and it returns the port in one lookup, so it holds the MAC table. TCAM stores a value and a mask, so each bit can be 0, 1 or don't-care. That lets it do longest-prefix-match routing, ACL, QoS and PBR lookups in one parallel step. TCAM is costly, hot and small, so its size sets how many routes and ACL entries a switch can hold in hardware.
Go deeper
Why the mask matters
An ACL entry
permit tcp 10.10.0.0 0.0.0.255 any eq 443becomes a TCAM row where the first 24 bits of the source must match and the last 8 are don't-care, alongside protocol and port fields. A packet is compared against every row at once and the first matching row (highest priority) wins. A route lookup works the same way, with longer prefixes placed first.Carving up TCAM
Catalyst switches divide TCAM with SDM templates: more space for routes, or for ACLs, or for IPv6.
show sdm prefershows the current split, and changing it needs a reload. Nexus uses TCAM carving commands for the same idea.When it runs out
The switch logs a resource error. Routes or ACL entries that do not fit are either not installed or handled by the CPU in software, which is many times slower and can push the CPU to 100%. Symptoms look random: some prefixes are slow, some ACL lines do not work.
They will ask next
Why not keep routes in ordinary RAM like a server does?
Software routers do, using tree structures. A hardware switch must look up every packet at line rate, hundreds of millions per second, and TCAM returns the answer in one step. Many modern ASICs also use hash and algorithmic tables in SRAM to save TCAM space.
Traps
- Saying the MAC table lives in TCAM. It is an exact-match table; TCAM is for masked lookups.
How did you do?Book 3.5 ImplementationOwn pageHow do MTU and jumbo frames work on a switch, and what breaks when they do not match?
Say this first
The layer 2 MTU is the largest payload a port will carry, 1500 bytes by default. Jumbo frames raise it to about 9000 bytes for storage, vMotion and overlays. A switch drops oversized frames silently and only counts them, with no ICMP back, so a mismatch looks like small packets working while big transfers hang. Every layer 2 hop and both hosts must agree.
Go deeper
Layer 2 MTU and IP MTU
- Layer 2 MTU: largest frame payload a switch port accepts and forwards.
- IP MTU: largest IP packet a routed interface sends without fragmenting. A layer 3 switch has both:
a switching MTU and an
ip mtuon each SVI or routed port. - Only a router can fragment or send ICMP "fragmentation needed". A switch just drops.
Syntax differs a lot by platform
Platform Command Catalyst 9000 system mtu 9198(global)Catalyst 3560/3750 system mtu jumbo 9000, then reloadNexus 9000 mtu 9216per interfaceArista EOS mtu 9214per interfaceJunos set interfaces xe-0/0/1 mtu 9216(counts the Ethernet header)Linux ip link set dev eth0 mtu 9000What breaks
- Ping works, SSH works, file copies or iSCSI stall: the handshake is small, the data is not.
- VXLAN adds 50 bytes over IPv4, so the underlay needs at least 1550 for 1500-byte guest frames.
- On routed links an IP MTU mismatch also blocks OSPF adjacencies in EXSTART.
Test it properly
Cisco IOS SW1# ping 10.0.0.2 size 9000 df-bitShell ping -M do -s 8972 10.0.0.28972 = 9000 minus 20 (IP header) minus 8 (ICMP header).
They will ask next
What is a baby giant?
A frame slightly over 1518 bytes because of extra headers: 1522 with one 802.1Q tag, 1526 with QinQ, 4 more bytes per MPLS label. Most switches accept one tag by default; QinQ and MPLS need a small MTU increase.
Should you enable jumbo frames everywhere?
A common design is to set every switch to its maximum MTU, since a switch is just a pipe, and then choose the real MTU on the hosts per VLAN. All hosts in one VLAN must use the same value, because nothing in layer 2 can fragment between them.
Traps
- Testing with a plain ping. Without DF and a large size, the stack fragments and the test passes on a broken path.
- Mixing up Junos MTU, which includes the 14-byte Ethernet header, with Cisco MTU, which does not.
How did you do?Book 2.3 FramingOwn pageYou see MAC flapping messages in the log. What do they mean and what causes them?
Say this first
The switch keeps learning the same MAC in the same VLAN on two different ports, back and forth.
%SW_MATM-4-MACFLAP_NOTIFnames the MAC, the VLAN and both ports. A single move is normal (a VM or a laptop moved). Constant flapping usually means a layer 2 loop, an EtherChannel bundled on one side only, server NIC teaming sending one MAC out two independent ports, or two FHRP routers both active.Go deeper
Output %SW_MATM-4-MACFLAP_NOTIF: Host 0050.56a1.2c3d in vlan 10 is flapping between port Gi1/0/12 and port Gi1/0/47Read the pattern
- Many MACs, between an uplink and some access port, high CPU, line-rate broadcast: a loop. Contain it first by shutting the access port, then find out why STP did not block.
- One or two MACs, between two ports cabled to the same server: NIC teaming or Linux bonding in a mode that needs a port-channel (balance-rr, balance-xor, 802.3ad) against plain access ports. Fix it with LACP on both sides or switch to active-backup.
- MACs moving between the members of what should be a bundle: the far side is not bundled.
- The HSRP virtual MAC flapping between two uplinks: both routers think they are active, usually because their hellos do not reach each other.
Tools
show mac address-table address 0050.56a1.2c3dshows where it is now. Follow the MAC hop by hop toward the port where it really lives, and look atshow spanning-treeand interface rates along the way.They will ask next
Does the switch stop the flapping by itself?
On Catalyst it is only a log message. Some platforms, such as Nexus, can be configured to shut a port when a MAC keeps moving. The real protection is spanning tree with BPDU guard on edge ports, plus storm control.
Traps
- Treating the message as cosmetic. Constant flapping means frames are going the wrong way right now.
- Rebooting the switch to stop the messages. The cause is outside the switch.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is switch stacking, and how is it different from a chassis or a pair of switches running MLAG?
Say this first
A stack joins several fixed switches with dedicated stack cables into one logical switch: one control plane on the active member, a hot standby, one config and one management IP, and EtherChannels that can span members. A chassis does the same with line cards and redundant supervisors. MLAG (vPC on Nexus) keeps two separate control planes that cooperate to present one port-channel, so each switch can be upgraded on its own.
Go deeper
How a Catalyst stack behaves
- Members are numbered, and the number is in the interface name:
Gi2/0/1is port 1 on member 2. A Catalyst 9300 stack holds up to 8 members. - Roles are active, standby and member. At stack formation the highest stack priority wins (1 to 15, default 1), with the lowest MAC as the final tie breaker. A running active is not pre-empted when you add a higher-priority switch.
- Active and standby run SSO. Every member forwards in hardware locally, so traffic between two ports on the same member never crosses the stack ring.
- Cross-stack EtherChannel: one uplink from each of two members, so losing a member keeps the uplink.
Tradeoffs to say out loud
Stack Chassis MLAG / vPC Control planes 1 1 (dual supervisor) 2 Upgrade Whole stack, usually one reload Supervisor by supervisor on many platforms One switch at a time Config One One Two, kept consistent Failure domain Software bug hits all members Same Smaller StackWise Virtual on Catalyst 9000 joins two switches over ordinary Ethernet links into one control plane, the modern form of VSS.
They will ask next
What happens when the active member fails?
The standby takes over with SSO and a new standby is elected. Ports on the failed member go down; the rest keep forwarding while protocols resume on the new active.
How do you choose which member becomes active?
Set its stack priority, for example
switch 1 priority 15from privileged EXEC on Catalyst 9300. It takes effect at the next election, not immediately.
Traps
- Saying a stack removes all single points of failure. One control plane means one bad image or bug affects every member.
How did you do?Own page- Members are numbered, and the number is in the interface name:
How can an attacker hop between VLANs, and how do you stop it?
Say this first
Two ways. Switch spoofing: the attacker's machine speaks DTP to a port left in a dynamic mode, a trunk forms, and the attacker can send into and receive from every allowed VLAN. Double tagging: from the native VLAN, the attacker sends a frame with two tags; the first switch strips the outer tag as native and forwards it, and the next switch delivers it into the inner VLAN. Static access ports with
nonegotiatestop the first; an unused or tagged native VLAN stops the second.Go deeper
Switch spoofing
Tools such as Yersinia send DTP desirable frames. If the access port is dynamic auto or desirable, it becomes a trunk. The attacker then tags frames with any VLAN ID and sees broadcast and flooded traffic from all allowed VLANs.
Double tagging
- The attacker is in VLAN 1, which is also the native VLAN on the uplink trunk.
- They send a frame with an outer tag of 1 and an inner tag of 20.
- SW1 accepts the frame into VLAN 1 and consumes the outer tag. VLAN 1 is native on the trunk, so SW1 sends the frame out without adding a tag, which leaves the inner tag 20 as the first tag on the wire.
- SW2 reads tag 20 and delivers the frame into VLAN 20.
It is one way only: replies go back with a single tag and never reach the attacker's VLAN. It is still enough for a crafted UDP attack.
Hardening
Cisco IOS interface range GigabitEthernet1/0/1 - 44 switchport mode access switchport nonegotiate switchport access vlan 10 interface range GigabitEthernet1/0/45 - 46 description unused switchport mode access switchport access vlan 998 shutdown interface GigabitEthernet1/0/48 switchport mode trunk switchport nonegotiate switchport trunk native vlan 999 switchport trunk allowed vlan 10,20,30 ! vlan dot1q tag nativeVLAN 999 has no access ports; VLAN 998 is a parking lot for unused ports.
They will ask next
Why is double tagging one way only?
The victim's reply travels with a single tag for its own VLAN. Nothing strips or adds a tag to move it back into the attacker's VLAN, so the reply never arrives.
Traps
- Changing the native VLAN number but leaving user ports in that VLAN. The attacker just needs to be in the native VLAN.
How did you do?Book 3.2 Switched EthernetBook 8.1 Trust and ThreatsOwn pageExplain the VTP revision number disaster. How does it happen and how do you prevent it?
Say this first
Every change on a VTP server raises the configuration revision. A switch accepts any advertisement with the same domain name and password and a higher revision, and replaces its whole VLAN database with it. Plug in an old lab switch with the same domain and a higher revision, and its VLAN list, often missing most production VLANs, overwrites the domain. Ports in deleted VLANs go inactive everywhere. Prevent it by resetting the revision before connecting any switch, or by running transparent, off or VTPv3.
Go deeper
How it unfolds
- A switch comes back from the lab or an RMA. It still has domain
CORP, the same password, and revision 41 from months of lab changes. Production is at revision 12. - Someone plugs it into a free port. Both sides are dynamic, so DTP forms a trunk on its own.
- The lab switch advertises revision 41. Every switch in
CORPaccepts it and replaces its VLAN list. - VLANs that only existed in production vanish. Access ports in them show as inactive, SVIs go down, trunks stop carrying them. The whole site loses those VLANs at once.
Check before connecting
Output SW9# show vtp status | include Mode|Domain|Revision VTP Domain Name : CORP VTP Pruning Mode : Disabled VTP Operating Mode : Server Configuration Revision : 41Reset the revision to 0
Change the domain to a dummy name and back, or switch to transparent and back:
Cisco IOS SW9(config)# vtp mode transparent SW9(config)# vtp mode clientRecovery if it already happened
Disconnect the culprit first. Recreate the missing VLANs on a real server; the revision rises again and every switch learns them back. Ports return as soon as their VLAN exists. Keep VLAN lists in backups or a source of truth so you can rebuild names quickly.
Prevention
Transparent or off mode everywhere, or VTPv3 with a primary server, plus
switchport mode accessandnonegotiateso a stray switch cannot form a trunk in the first place.They will ask next
Why does client mode on the newcomer not protect you?
In VTP versions 1 and 2, clients advertise too, and a higher revision from a client wins just like one from a server. Only the revision and the domain and password matter.
Would the VTP password have stopped it?
Only if the lab switch had a different password. Switches configured from the same template usually share it.
Traps
- Believing a brand-new switch is the risk. A factory-fresh switch has revision 0 and no domain; reused switches are the danger.
How did you do?Own page- A switch comes back from the lab or an RMA. It still has domain
Why does show interfaces trunk list the VLANs four times, and how is the allowed list different from pruning?
Say this first
The sections narrow down: VLANs allowed by config; of those, the ones that exist and are active on this switch; of those, the ones in spanning-tree forwarding state on this port and not pruned. A VLAN has to survive all of them to cross. The allowed list is static config per trunk. VTP pruning is dynamic: a switch tells its neighbor which VLANs it needs, and the neighbor stops flooding the rest over that trunk.
Go deeper
Output SW1# show interfaces trunk Port Mode Encapsulation Status Native vlan Gi1/0/48 on 802.1q trunking 999 Port Vlans allowed on trunk Gi1/0/48 10,20,30,40 Port Vlans allowed and active in management domain Gi1/0/48 10,20,30 Port Vlans in spanning tree forwarding state and not pruned Gi1/0/48 10,20- VLAN 40 is allowed but does not exist in SW1's VLAN database, so it drops out of the second list.
- VLAN 30 exists but is either blocked by spanning tree on this port or pruned.
show spanning-tree vlan 30tells you which: anAltn BLKrole on Gi1/0/48 means STP.
Editing the allowed list safely
Cisco IOS interface GigabitEthernet1/0/48 switchport trunk allowed vlan add 50 switchport trunk allowed vlan remove 40Without
addorremove, the command replaces the whole list.VTP pruning
Enabled domain-wide with
vtp pruningon a server. VLAN 1 and 1002 to 1005 are never pruned.switchport trunk pruning vlanlimits which VLANs are eligible on a trunk.They will ask next
Allowed lists or VTP pruning, which do you prefer?
Allowed lists. They are explicit, visible in the config, work with any vendor, and work in VTP transparent or off mode, where pruning does not apply.
Traps
- Typing
switchport trunk allowed vlan 50on a live trunk. It removes every other VLAN.
How did you do?Book 3.2 Switched EthernetOwn pageHosts in one VLAN cannot reach each other across a trunk, but other VLANs work. What do you check?
Say this first
I walk that VLAN through every filter on both ends of the link: is the link really trunking, does the VLAN exist and is it active on both switches, is it in the allowed list on both sides, is it pruned, is spanning tree blocking it on that port only, and do the native VLANs match. Most often the VLAN is missing on one switch or an allowed list was edited without
add.Go deeper
Order of checks
show interfaces trunkon both ends. Statustrunking, and the VLAN present in all four sections.show vlan id 30on both switches. The VLAN must exist and beactive.act/lshutmeans someone typedshutdownundervlan 30;susmeans suspended.- VTP: a client that never received the VLAN, or a transparent switch where nobody created it.
show spanning-tree vlan 30. Is this port blocking for this VLAN alone? Look for*ROOT_Inc,*LOOP_Incor*PVID_Incin the type column.- Native VLAN mismatch: CDP logs
%CDP-4-NATIVE_VLAN_MISMATCH, and untagged traffic lands in the wrong VLAN. - If the far end is not a switch: the port group VLAN on the hypervisor, the subinterface on the firewall or router.
show mac address-table vlan 30on each switch. Do the hosts' MACs appear on the trunk port at the far end?
Each step tells you which side to look at next, so you never change anything blind.
They will ask next
The trunk shows the VLAN in all four sections on both ends, and it still fails. What next?
Leave the trunk and check the hosts' ports: right access VLAN, port up, MAC learned. Then check anything in the path that filters by VLAN or MAC, such as VLAN ACLs, port security or private VLANs.
Traps
- Checking only one end. The allowed list and the VLAN database are per switch, and either side can drop the VLAN.
How did you do?Own pageWhat is the difference between an SVI and a routed port on a layer 3 switch, and when do you use each?
Say this first
An SVI (
interface Vlan10) is a virtual routed interface for a whole VLAN. It serves many layer 2 ports and is the gateway for hosts. A routed port (no switchportplus an IP) turns one physical port into a plain router interface: no VLAN, no spanning tree, no DTP. I use SVIs for host gateways and routed ports for links between layer 3 switches, because a routed port goes down the moment the link fails and there is no layer 2 path that could loop.Go deeper
Configuration
Cisco IOS interface Vlan10 description Users gateway ip address 10.10.0.1 255.255.255.0 ! interface GigabitEthernet1/0/48 description Routed uplink to CORE1 no switchport ip address 10.0.0.1 255.255.255.254Why routed uplinks converge faster
- An SVI stays up while any port in its VLAN is up and forwarding. If an uplink in a "transit VLAN" fails but another port in that VLAN is up, the SVI never goes down and the routing protocol waits for its dead timer.
- A routed port goes down with the link. OSPF or EIGRP drop the neighbor and reroute immediately.
- No spanning tree runs on a routed port, so there is no blocked link and no loop risk between the layer 3 switches.
Where SVIs still belong between switches
A layer 2 trunk between two distribution switches that share VLANs (for HSRP and for stretched access VLANs) still needs SVIs on both. The routed uplinks go north to the core.
They will ask next
Can a routed port carry several VLANs?
On platforms that support layer 3 subinterfaces, yes:
interface Gi1/0/48.100withencapsulation dot1Q 100. Otherwise you trunk and use SVIs.Can you bundle routed ports?
Yes. Configure the members and the port-channel with
no switchportand put the IP on the port-channel interface.
Traps
- Building every point-to-point uplink as a dedicated VLAN with SVIs. It pulls spanning tree and autostate into the routed core for nothing.
How did you do?Own pageAn SVI shows up/down. Why, and what is autostate?
Say this first
An SVI comes up only when its VLAN exists in the VLAN database, the SVI is not shut down, and at least one layer 2 port in that VLAN is up and forwarding in spanning tree. That last rule is autostate. With no active ports the SVI shows up/down, its connected route is withdrawn and the switch stops advertising the subnet, which is what you want when nothing in the VLAN can be reached.
Go deeper
Output DSW1# show ip interface brief | include Vlan Vlan10 10.10.0.2 YES NVRAM up up Vlan30 10.30.0.2 YES NVRAM up downChecklist for a down SVI
- Does the VLAN exist?
show vlan id 30. On IOS, creatinginterface Vlan30does not create VLAN 30. - Is any access port in VLAN 30 up?
show interfaces status vlan 30. - Is VLAN 30 allowed, active and forwarding on some trunk?
show interfaces trunk. - Is spanning tree blocking every port in VLAN 30 on this switch?
- Is the SVI itself shut? That shows
administratively downinstead.
Excluding ports from the calculation
switchport autostate excludeon a port stops it from counting, for example a SPAN destination or a monitoring port that should not keep a VLAN's SVI alive. NX-OS can turn autostate off per SVI withno autostate.They will ask next
Why is autostate a good thing?
Without it, a switch with no live ports in VLAN 30 would keep advertising 10.30.0.0/24 and attract traffic it can only drop. Autostate makes the route follow reality.
Traps
- Creating the SVI and assuming the VLAN exists. Check
show vlanon the same switch.
How did you do?Own page- Does the VLAN exist?
What is the difference between a layer 3 switch and a router?
Say this first
Both route IP. A layer 3 switch routes in ASICs at line rate across many Ethernet ports at a low cost per port, but with limited route and ACL tables, small buffers and a narrow feature set. A router forwards in software or a network processor and is built for the edge: WAN interfaces, full BGP tables, NAT and IPsec at scale, deep buffers and per-flow shaping. In a campus the layer 3 switch routes between VLANs; the router or firewall sits at the WAN and internet edge.
Go deeper
Layer 3 switch Router Forwarding Fixed-function ASIC CPU or programmable network processor Ports Dense Ethernet Fewer, mixed: Ethernet, LTE, serial, SFP Route scale Bounded by TCAM Large, full internet tables on edge routers Features ACLs, basic QoS, some NAT and MPLS on newer models NAT, IPsec, zone firewall, hierarchical shaping, SD-WAN Buffers Shallow Deeper Cost per port Low High The line is blurring. Campus switches now do VXLAN and some MPLS, data center switches hold large tables, and routers carry switch modules. The useful question is: what must this box do, at what scale, with which features in the forwarding path?
They will ask next
Why not take a full internet routing table on a campus core switch?
The full IPv4 table is around a million prefixes, far beyond what campus switch hardware tables hold. At the edge you take a default route or a partial table on the switch, or put a real router there.
Traps
- Saying a layer 3 switch cannot run routing protocols. It runs OSPF, EIGRP and BGP; the limits are scale and features.
How did you do?Book 3.5 ImplementationOwn pageWhat must match for ports to bundle into an EtherChannel, and what happens when one does not?
Say this first
All members must agree with each other and with the port-channel: speed and duplex, layer 2 or layer 3, access or trunk mode, the same access VLAN or the same allowed and native VLANs, and the same channel protocol and partner. A member that disagrees is suspended (
sinshow etherchannel summary) with a log message giving the reason, while the rest of the bundle keeps working. I make every change on the port-channel interface, which applies it to all members.Go deeper
What a suspended member looks like
Output ASW2# show etherchannel summary | begin Group Group Port-channel Protocol Ports ------+-------------+-----------+----------------------------------------------- 1 Po1(SU) LACP Gi1/0/47(P) Gi1/0/48(s)Output %EC-5-CANNOT_BUNDLE2: Gi1/0/48 is not compatible with Gi1/0/47 and will be suspended (vlan mask is different)Someone added a VLAN on Gi1/0/48 directly instead of on Po1.
Flags worth knowing
Pbundled,ssuspended,Istand-alone,Hhot-standby,Ddown. On the port-channel,SUis layer 2 and in use,RUlayer 3 and in use,SDlayer 2 and down.Partner checks
LACP also checks that every member reaches the same partner system ID. A member cabled to a different switch cannot join the bundle. On Catalyst 9000, a member whose far end does not run LACP logs
%ETC-5-L3DONTBNDL2: Gi1/0/47 suspended: LACP currently not enabled on the remote port.Changing a live bundle
Cisco IOS interface Port-channel1 switchport trunk allowed vlan add 40Done on the port-channel, the change reaches both members at once and nothing gets suspended.
They will ask next
How do you build a bundle without hitting mismatches?
Default the member ports, configure them identically with
interface range, addchannel-group, then make all later changes on the port-channel interface only.
Traps
- Editing a member interface instead of the port-channel. The member drifts from the bundle and gets suspended.
How did you do?Own pageHow does EtherChannel load balancing work, and why is one link often busier than the others?
Say this first
It does not spread packets round robin. Each switch hashes fields of every frame, such as MACs, IPs or layer 4 ports, into a bucket that maps to one member, so a flow always uses one link and stays in order. The spread is only as good as the variety in the hashed fields: hash on MACs toward a single router and nearly everything lands on one link. Each side hashes its own outbound traffic, so I set the method on both ends; Catalyst sets it globally with
port-channel load-balance.Go deeper
Choosing inputs
Method Good when src-mac,dst-mac,src-dst-macMany hosts talk across a pure layer 2 bundle src-dst-ipRouted traffic, or few MACs but many IPs Layer 4 options ( src-dst-port, or mixed IP and port on newer platforms)Few hosts with many sessions, such as server to backup target Defaults vary by platform, and many Catalyst switches default to a MAC-based method, so check and change it.
Cisco IOS DSW1(config)# port-channel load-balance src-dst-ipOutput DSW1# show etherchannel load-balance EtherChannel Load-Balancing Configuration: src-dst-ip EtherChannel Load-Balancing Addresses Used Per-Protocol: Non-IP: Source XOR Destination MAC address IPv4: Source XOR Destination IP address IPv6: Source XOR Destination IP address DSW1# test etherchannel load-balance interface port-channel 1 ip 10.10.0.10 10.20.0.10 Would select Gi1/0/48 of Po1Why 2, 4 or 8 links
Many Catalyst ASICs hash into 8 buckets. With 2, 4 or 8 members each gets an equal share. With 3 members the split is 3:3:2; with 5 it is 2:2:2:1:1.
Polarization
If every layer in a design uses the same hash on the same fields, the second layer receives only flows that already hashed one way, and some of its links sit idle. Use different inputs at different layers, or a per-switch hash seed where the platform offers one.
They will ask next
One backup job saturates one member while the other is idle. Can hashing fix it?
Not for a single flow: one TCP session always maps to one link, so it tops out at one member's speed. Run parallel streams with a layer 4 hash, or move to faster links.
Traps
- Expecting a 2 x 10G bundle to give one TCP session 20 Gbps.
How did you do?Own pageWhat is the native VLAN, and why do people say you should change it?
Say this first
The native VLAN is the one VLAN on an 802.1Q trunk whose frames cross untagged. It is VLAN 1 by default. I change it to an unused VLAN and tag it or prune it, because leaving user traffic in the native VLAN enables double-tagging attacks and a native VLAN mismatch quietly leaks traffic between VLANs.
Go deeper
What it does
802.1Q inserts a 4-byte tag after the source MAC. Frames in the native VLAN skip the tag. A switch that receives an untagged frame on a trunk puts it in its own configured native VLAN.
Why it matters
- Double tagging. An attacker in the native VLAN sends a frame with two tags. The first switch strips the outer tag (it matches the native VLAN) and forwards the frame, still tagged with the inner VLAN, across the trunk. The next switch delivers it into the victim VLAN. It is one way only, but it works.
- Mismatch. If one side uses native VLAN 1 and the other uses 99, untagged frames jump between
VLAN 1 and VLAN 99. CDP logs
%CDP-4-NATIVE_VLAN_MISMATCH, and STP blocks the port for PVST+ with an inconsistent state.
What I configure
Cisco IOS interface GigabitEthernet1/0/48 switchport mode trunk switchport trunk native vlan 999 switchport trunk allowed vlan 10,20,30 switchport nonegotiate ! vlan dot1q tag nativeVLAN 999 has no access ports.
vlan dot1q tag nativemakes the switch tag even the native VLAN.They will ask next
Can you have a trunk with no native VLAN at all?
Not on Cisco: a trunk always has a native VLAN. You make it harmless by choosing an unused VLAN, tagging it with
vlan dot1q tag native, and removing it from the allowed list.Which control traffic still uses VLAN 1?
CDP, VTP, DTP and PAgP keep using VLAN 1 even after you change the native VLAN or remove VLAN 1 from the allowed list. That is why you cannot delete VLAN 1 on a Cisco switch. You make it harmless instead: no user ports, no SVI, and never the native VLAN.
Traps
- Saying the native VLAN carries "management traffic". It carries whatever is untagged, nothing more.
- Forgetting that both ends must agree. The mismatch is the most common real outage here.
How did you do?Book 3.2 Switched EthernetOwn page
Expert6
What does VTP version 3 change, and would you run it?
Say this first
VTPv3 adds a primary server. Only the switch promoted with
vtp primarycan change the database; other servers just store and relay it. A switch with a higher revision but a different primary server ID cannot take over the domain, which removes the classic disaster. It also carries extended VLANs (1006 to 4094), private VLANs and MST region config, supports a hidden password and off mode, and can be disabled per trunk. A mistake on the primary still spreads everywhere in seconds.Go deeper
Setup
Cisco IOS SW1(config)# vtp domain CORP SW1(config)# vtp version 3 SW1(config)# vtp mode server SW1(config)# vtp password Str0ngSecret hidden SW1(config)# end SW1# vtp primary vlanvtp primaryis an EXEC command, not a config line. It asks for confirmation and for the password. Other switches runvtp mode server(secondary servers) orclient.Separate features
The VLAN database and the MST region config are separate VTPv3 features, each with its own primary (
vtp primary mst). That lets you keep the MST name, revision and VLAN-to-instance mapping identical on every switch, which is the hardest part of running MST.Per-port control
no vtpon an interface stops VTP on that trunk, useful at the edge of the domain.Would I run it
It is safe from the stray-switch problem, and MST sync is a real benefit. The remaining risk is human: a VLAN deleted on the primary disappears from every switch. Shops with good automation often prefer transparent or off mode plus a source of truth that pushes VLANs.
They will ask next
How do you move the primary role to another switch?
Run
vtp primaryon the new switch. It announces itself and the domain follows it; the old primary becomes a secondary server.
Traps
- Assuming VTPv3 protects you from a mistake made on the primary. It protects you from the wrong switch, not the wrong command.
How did you do?Own pageWhat are private VLANs and when would you use them?
Say this first
Private VLANs split one VLAN and one subnet into isolated pieces at layer 2. A primary VLAN holds secondary VLANs: one isolated VLAN, whose ports only talk to promiscuous ports, and any number of community VLANs, whose ports talk to each other and to promiscuous ports. The promiscuous port, usually the gateway or firewall, talks to everyone. They suit DMZs, hosting, and guest or hotel networks, where hosts share a subnet but should not reach each other.
Go deeper
Who can talk to whom
From / to Promiscuous Same community Other community Isolated Promiscuous Yes Yes Yes Yes Community Yes Yes No No Isolated Yes No No No Configuration on a Catalyst
Needs VTP transparent or off mode (or VTPv3).
Cisco IOS vtp mode transparent vlan 201 private-vlan isolated vlan 202 private-vlan community vlan 200 private-vlan primary private-vlan association 201,202 ! interface GigabitEthernet1/0/10 switchport mode private-vlan host switchport private-vlan host-association 200 201 ! interface GigabitEthernet1/0/48 description Firewall switchport mode private-vlan promiscuous switchport private-vlan mapping 200 201,202 ! interface Vlan200 ip address 10.200.0.1 255.255.255.0 private-vlan mapping 201,202The SVI mapping lets hosts in the secondary VLANs reach their gateway. Across switches, secondary VLANs ride a normal trunk as ordinary VLANs, and every switch needs the same PVLAN definitions.
Hosts going through the router
Isolated hosts cannot ARP each other. If you want them to talk only through the gateway, where an ACL can inspect it, enable
ip local-proxy-arpon the SVI.They will ask next
What is
switchport protected?Private VLAN edge: protected ports on the same switch cannot exchange traffic with each other at layer 2. It needs no VLAN setup but only works within one switch.
How many isolated VLANs can a primary VLAN have?
One. It can have many community VLANs.
Traps
- Forgetting
private-vlan mappingon the SVI, which leaves secondary-VLAN hosts without a gateway.
How did you do?Book 3.2 Switched EthernetOwn pageWhat is QinQ and when would you use it?
Say this first
QinQ (802.1ad provider bridging) adds a second, outer VLAN tag in front of the customer's tag, so a provider can carry all of a customer's VLANs through its network inside one service VLAN. The standard outer tag uses EtherType
0x88A8; Ciscodot1q-tunnelports on many Catalyst platforms use0x8100for both. Each tag adds 4 bytes, so a full-size customer frame becomes 1526 bytes and the core MTU has to allow it.Go deeper
Where it fits
- Metro Ethernet: one service VLAN per customer, with the customer's own VLANs untouched inside it.
- Multi-tenant data centers and labs that need to overlap VLAN IDs between tenants.
- Scale: 4094 outer by 4094 inner identifiers.
Catalyst provider edge port
Cisco IOS vlan 100 name CUST-A ! interface GigabitEthernet1/0/10 description Customer A handoff switchport access vlan 100 switchport mode dot1q-tunnel l2protocol-tunnel cdp l2protocol-tunnel stp l2protocol-tunnel vtp ! system mtu 1504Every frame from the customer, tagged or not, gets an outer tag of 100 on the provider trunks and loses it again at the far tunnel port.
Layer 2 protocol tunneling
Without
l2protocol-tunnel, the provider switch would process or drop the customer's CDP, STP and VTP. With it, those frames are carried across so the customer's sites see each other as directly connected.They will ask next
How does QinQ compare with VXLAN?
Both stretch layer 2 for many tenants. VXLAN uses a 24-bit VNI (about 16 million segments) inside UDP over a routed IP underlay, so it gets ECMP and needs no spanning tree in the core. QinQ is simpler but runs over a layer 2 provider network.
Traps
- Forgetting the MTU. Two tags on a 1500-byte payload make a 1526-byte frame.
How did you do?Book 3.2 Switched EthernetOwn pageWhat does EtherChannel misconfig guard do, and why does configuring only one side as "on" cause trouble?
Say this first
With
on, a switch bundles its ports without asking the neighbor. If the neighbor is not bundled, one side sees one logical link and the other sees separate links, and traffic comes back up the bundle it went down. STP's EtherChannel misconfig guard, on by default on Catalyst, detects this from the BPDUs arriving on the bundle and err-disables the members with reason channel-misconfig. With LACP on one side andonon the other, the LACP side suspends its ports while theonside believes the bundle is up.Go deeper
Case 1: on against unbundled ports
The unbundled neighbor floods a broadcast received on one link out its other link, straight back into the bundle. The bundled side relearns its own hosts' MACs on the port-channel and starts sending their traffic the wrong way. The guard catches it:
Output %SPANTREE-2-CHNL_MISCFG: Detected loop due to etherchannel misconfiguration of Gi1/0/47 %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Gi1/0/47, putting Gi1/0/47 in err-disable state %PM-4-ERR_DISABLE: channel-misconfig (STP) error detected on Gi1/0/48, putting Gi1/0/48 in err-disable stateCase 2: on against LACP
The LACP side never hears a partner. On Catalyst 9000 it suspends its members:
Output %ETC-5-L3DONTBNDL2: Gi1/0/47 suspended: LACP currently not enabled on the remote port.The
onside showsPo1(SU)with both members(P)and keeps sending flooded traffic into links the neighbor drops. Redundancy is gone and nothing on theonside says so.Recovery
Make both ends match, ideally LACP active, then bounce the port-channel to clear the err-disable:
Cisco IOS DSW1(config)# interface Port-channel1 DSW1(config-if)# shutdown DSW1(config-if)# no shutdownThe guard itself is
spanning-tree etherchannel guard misconfig, enabled by default.They will ask next
What is the difference between a stand-alone (I) and a suspended (s) member?
Both heard no LACP or PAgP partner. Stand-alone ports keep working as ordinary individual ports; suspended ports pass no traffic. Which one you get depends on the platform and settings: Catalyst 9000 suspends as shown above, and NX-OS suspends by default through
lacp suspend-individual.
Traps
- Clearing the err-disable before fixing both ends. The guard trips again, or worse, it does not and the misdirected traffic returns.
How did you do?Own pageHow does LACP decide which links are active when you have more than eight, and what are LACP rate and priority for?
Say this first
Many platforms allow 16 ports in an LACP bundle: 8 active and up to 8 hot-standby. The switch with the better system ID (lower system priority, then lower MAC) decides which ports are active, choosing the lowest port priority and then the lowest port number. Hot-standby ports (
H) replace a failed active member. Rate slow sends LACPDUs every 30 seconds with a 90-second timeout; fast sends every second with a 3-second timeout. Priorities default to 32768.Go deeper
Controls
Cisco IOS lacp system-priority 100 ! interface GigabitEthernet1/0/1 lacp port-priority 100 lacp rate fast channel-group 1 mode active ! interface Port-channel1 lacp max-bundle 4 port-channel min-links 2lacp max-bundlecaps active members; the rest wait in hot-standby.port-channel min-linkstakes the whole bundle down when fewer members are up, so routing moves traffic to another path instead of squeezing it into half the bandwidth.lacp rate fastcatches a member that stays up but stops passing frames, for example through a media converter, in about 3 seconds instead of 90.
Reading the neighbor
Output DSW1# show lacp 1 neighbor Flags: S - Device is requesting Slow LACPDUs F - Device is requesting Fast LACPDUs A - Device is in Active mode P - Device is in Passive mode Channel group 1 neighbors LACP port Admin Oper Port Port Port Flags Priority Dev ID Age key Key Number State Gi1/0/47 SA 32768 aabb.cc00.0500 12s 0x0 0x1 0x130 0x3D Gi1/0/48 SA 32768 aabb.cc00.0500 9s 0x0 0x1 0x131 0x3DSame Dev ID on both members means both reach the same partner. State
0x3Dmeans active, aggregatable, in sync, collecting and distributing.They will ask next
Why would you use min-links on a routed bundle?
With 4 x 10G and two members down, the bundle is still up at 20G and routing keeps sending 40G of traffic into it. With
port-channel min-links 3it goes down and the routing protocol shifts traffic to a healthy path.
Traps
- Assuming more than 8 members can forward at once. The extra members are hot-standby.
How did you do?Own pageHow does a layer 3 switch route a packet between two VLANs in hardware?
Say this first
The host sends the frame to its gateway's MAC, the SVI's MAC. The switch sees its own router MAC as the destination, so it routes instead of bridging: a longest-prefix lookup in the FIB (held in TCAM) returns an adjacency with the rewrite information. The ASIC swaps the source MAC to the SVI's and the destination MAC to the host's, decrements the TTL, fixes the IP checksum and recomputes the FCS, then sends it out the right port in the egress VLAN, all at line rate. Only exceptions go to the CPU.
Go deeper
Step by step
PC1
10.10.0.10in VLAN 10 sends to PC210.20.0.10in VLAN 20. Both gateways are SVIs on DSW1.- PC1 sends the frame to the MAC of
interface Vlan10, with PC2's IP as destination. - DSW1 receives it in VLAN 10. The destination MAC is its router MAC, so the frame goes to the layer 3 lookup instead of the MAC table.
- The FIB returns the host entry for
10.20.0.10, learned from ARP, pointing at an adjacency on Vlan20. - The adjacency holds the new header: destination MAC of PC2, source MAC of the Vlan20 SVI, VLAN 20.
- The MAC table for VLAN 20 gives the egress port. TTL goes from 128 to 127 and the frame leaves.
What goes to the CPU (punted)
- No ARP entry yet for PC2: the glean adjacency sends the packet to the CPU, which ARPs.
- TTL expiring (traceroute), packets addressed to the switch itself, IP options.
- Features the hardware cannot do on that platform.
Commands
show ip cef 10.20.0.10 detailshows the FIB entry,show adjacency vlan 20 detailthe rewrite, andshow ip arp vlan 20the ARP entries the adjacencies are built from.They will ask next
Why is the first ping to a new host often lost?
The first packet hits a glean adjacency. The switch ARPs for the host and typically drops that first packet while it waits, so the first echo times out and the rest succeed.
All SVIs on many Catalyst switches share one MAC. Is that a problem?
No. MAC tables are per VLAN, so the same router MAC in VLAN 10 and VLAN 20 never collide.
Traps
- Saying the switch looks up the destination MAC in the MAC table and floods. A frame addressed to the router MAC is routed, not bridged.
How did you do?Book 3.5 ImplementationBook 3.3 Internet (IP)Own page- PC1 sends the frame to the MAC of