From point A to point B
Point A: you already know how a switch decides and how you get in to manage it, but your whole network is a single broadcast domain and one redundant cable could bring it down. Point B: by the end you will split the network into VLANs, join them with trunks, route between them, let Spanning Tree cut the loops and add links together with EtherChannel.
This chapter covers almost all of the Network Access domain of the v1.1 exam, worth 20%: topics 2.1 (data and voice VLANs, the default VLAN and inter-VLAN connectivity), 2.2 (trunks, 802.1Q and the native VLAN), 2.4 (EtherChannel with LACP) and 2.5 (Rapid PVST+ and its protections).
What a VLAN is
A VLAN (virtual LAN) is a group of ports that forms its own broadcast domain, even if it shares the switch with other groups. With VLANs you separate departments without buying more hardware.
One VLAN, one broadcast domain, one subnet. Diagram: The House of Routing.
VLANs help you:
- Cut broadcasts: each VLAN only receives its own broadcasts.
- Improve security: devices in one VLAN do not see another VLAN’s frames.
- Organize the network by role: sales, engineering, guests or voice, wherever each person sits.
The design rule is simple: each VLAN has its own IP subnet. For two VLANs to talk you need a layer 3 device: a router or a layer 3 switch.
| Range | Use |
|---|---|
| 0 and 4095 | Reserved: cannot be used |
| 1 | Default VLAN: every port starts in it. It cannot be deleted. |
| 2 to 1001 | Normal range: stored in the vlan.dat file in flash |
| 1002 to 1005 | Reserved for FDDI and Token Ring: cannot be deleted |
| 1006 to 4094 | Extended range |
For your notes. The 802.1Q VID field has 12 bits: 212 = 4096 values, minus 0 and 4095, leaves 4094 usable VLANs.
Creating VLANs and assigning ports
First you create the VLAN, then you put each port in access mode and assign it. An access port belongs to a single data VLAN and its frames travel untagged.
SW1(config)# vlan 10
SW1(config-vlan)# name SALES
SW1(config-vlan)# vlan 20
SW1(config-vlan)# name ENGINEERING
SW1(config-vlan)# exit
SW1(config)# interface range fastethernet0/1 - 12
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport access vlan 10
SW1(config-if-range)# exit
SW1(config)# interface fastethernet0/13
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 20
SW1(config-if)# end
SW1# show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/14, Fa0/15, Fa0/16, Gi0/2
10 SALES active Fa0/1, Fa0/2, Fa0/3, Fa0/4 ...
20 ENGINEERING active Fa0/13
If you assign a port to a VLAN that does not exist, the switch creates it automatically. If you delete a VLAN with no vlan 20, its ports go inactive until you move them to another VLAN.
The voice VLAN
An IP phone usually has a PC plugged in behind it. The same port carries two VLANs: the data VLAN, untagged, and the voice VLAN, tagged with 802.1Q so the switch can prioritize it. The switch tells the phone which voice VLAN to use through CDP (or LLDP-MED).
SW1(config)# interface fastethernet0/5
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config-if)# switchport voice vlan 11
Verify with show interfaces fa0/5 switchport: you will see Access Mode VLAN: 10 and Voice VLAN: 11.
802.1Q trunks and the native VLAN
When a VLAN stretches across several switches, the link between them must carry traffic from many VLANs. That link is a trunk, and to know which VLAN each frame belongs to, the switch tags it.
Access ports toward the devices and a trunk between switches. Diagram: The House of Routing.
The 802.1Q tag sits between the source MAC and the Type field. Diagram: The House of Routing.
The standard is IEEE 802.1Q. It does not encapsulate the frame: it inserts a 4-byte tag with the 12-bit VLAN identifier (VID), and the switch recalculates the FCS. Cisco’s proprietary protocol, ISL, encapsulated the whole frame with 30 extra bytes; it is obsolete and current switches no longer support it.
The native VLAN is the only one that crosses the trunk untagged. By default it is VLAN 1. Both ends must use the same one: otherwise traffic from one VLAN shows up in another and CDP warns with a native VLAN mismatch message. A good practice is to change it to an unused VLAN.
SW1(config)# interface gigabitethernet0/1
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk native vlan 999
SW1(config-if)# switchport trunk allowed vlan 10,20,999
SW1(config-if)# switchport nonegotiate
SW1(config-if)# end
SW1# show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gi0/1 on 802.1q trunking 999
Port Vlans allowed on trunk
Gi0/1 10,20,999
Port Vlans allowed and active in management domain
Gi0/1 10,20,999
Port Vlans in spanning tree forwarding state and not pruned
Gi0/1 10,20,999
On switches that still accept ISL you must first choose the encapsulation with switchport trunk encapsulation dot1q. With switchport trunk allowed vlan you limit which VLANs cross the trunk (it also accepts add, remove, except and all): that way one VLAN’s broadcasts do not reach switches that do not need it.
DTP and VTP
DTP (Dynamic Trunking Protocol) is a Cisco protocol that negotiates whether a link between switches will be a trunk or an access link. Each port has an administrative mode:
| Mode | What it does |
|---|---|
switchport mode access | Always access. Never forms a trunk. |
switchport mode trunk | Always trunk. Sends DTP messages unless you use nonegotiate. |
switchport mode dynamic desirable | Actively asks for a trunk |
switchport mode dynamic auto | Waits for the other side to ask. It is the default on many Catalyst switches. |
| Side A \ Side B | dynamic auto | dynamic desirable | trunk | access |
|---|---|---|---|---|
| dynamic auto | Access | Trunk | Trunk | Access |
| dynamic desirable | Trunk | Trunk | Trunk | Access |
| trunk | Trunk | Trunk | Trunk | Does not work properly |
| access | Access | Access | Does not work properly | Access |
Two ports in dynamic auto keep waiting and do not form a trunk. Since an attacker could negotiate a trunk with DTP, the recommendation is to set the mode by hand (access or trunk) and turn DTP off with switchport nonegotiate.
VTP (VLAN Trunking Protocol) is another Cisco protocol that copies the VLAN database from a server switch to the clients over the trunks. It has the server, client and transparent modes (and, in version 3, off). It is no longer part of the CCNA v1.1 exam topics and many networks leave it in transparent or off, because a switch with a higher revision number can wipe the VLANs of the whole domain.
Inter-VLAN routing
Each VLAN is a different subnet, so to go from one to another the traffic must be routed. There are two common ways:
Router-on-a-stick and the layer 3 switch. Diagram: The House of Routing.
Router-on-a-stick
A router connects to the switch with a single trunk and creates one subinterface per VLAN. Each subinterface is its VLAN’s default gateway.
R1(config)# interface gigabitethernet0/0
R1(config-if)# no shutdown
R1(config-if)# interface gigabitethernet0/0.10
R1(config-subif)# encapsulation dot1q 10
R1(config-subif)# ip address 10.1.10.1 255.255.255.0
R1(config-subif)# interface gigabitethernet0/0.20
R1(config-subif)# encapsulation dot1q 20
R1(config-subif)# ip address 10.1.20.1 255.255.255.0
R1(config-subif)# interface gigabitethernet0/0.999
R1(config-subif)# encapsulation dot1q 999 native
The subinterface number does not have to match the VLAN, but matching them avoids mistakes. The word native tells the router which VLAN arrives untagged.
Layer 3 switch
A multilayer switch routes in hardware, without the bottleneck of a single link. You create one SVI per VLAN and turn routing on:
MLS1(config)# ip routing
MLS1(config)# interface vlan 10
MLS1(config-if)# ip address 10.1.10.1 255.255.255.0
MLS1(config-if)# no shutdown
MLS1(config-if)# interface vlan 20
MLS1(config-if)# ip address 10.1.20.1 255.255.255.0
MLS1(config-if)# no shutdown
MLS1(config-if)# interface gigabitethernet1/0/24
MLS1(config-if)# no switchport
MLS1(config-if)# ip address 10.1.99.1 255.255.255.252
With no switchport, a port stops being layer 2 and becomes a routed port, useful for the link to a router or to the core.
The problem with loops
Redundant links keep a broken cable from cutting off a whole floor. But at layer 2 redundancy creates a problem: frames have no TTL field like IP packets, so a broadcast that enters a loop never dies.
Without STP, a broadcast circles forever. Diagram: The House of Routing.
- Broadcast storm: each switch floods the frame out of every port and the copies multiply until they saturate the links and the CPU.
- Unstable MAC table: the switch sees the same source MAC arrive on different ports and changes the entry over and over.
- Duplicate frames: the destination receives several copies of the same frame.
The solution is Spanning Tree Protocol (STP), originally defined in IEEE 802.1D. STP keeps the redundant links connected, but blocks the ports needed so there is a single path between each pair of switches. If an active link fails, it unblocks the backup.
How Spanning Tree elects
Switches exchange messages called BPDUs (bridge protocol data units) and use them to build a loop-free tree in four steps.
Root bridge, root ports, designated ports and the blocked port. Diagram: The House of Routing.
- Elect the root bridge. The switch with the lowest Bridge ID wins. The Bridge ID has 8 bytes: the priority (32768 by default, in multiples of 4096), the extended system ID (the VLAN number) and the switch’s MAC. That is why, in VLAN 1, a switch with the factory priority shows 32769. If they all have the same priority, the lowest MAC wins, usually the oldest switch’s.
- Elect one root port on each non-root switch. It is the port with the lowest cumulative cost to the root. On a tie, the port receiving the BPDU from the neighbor with the lowest Bridge ID wins; then the lowest neighbor port priority and, last, the lowest neighbor port number.
- Elect one designated port on each segment. It is the port offering the lowest cost to the root on that link. All the root bridge’s ports are designated.
- Block the rest. Ports that are neither root nor designated are blocked.
| Link speed | STP cost (short method, 802.1D-1998) | Cost (long method, 802.1D-2004) |
|---|---|---|
| 10 Mb/s | 100 | 2,000,000 |
| 100 Mb/s | 19 | 200,000 |
| 1 Gb/s | 4 | 20,000 |
| 10 Gb/s | 2 | 2,000 |
Do not leave the election to chance: the root bridge should be a robust distribution or core switch. With root primary the switch sets priority 24576 (or lower if needed to win) and with root secondary, 28672.
DSW1(config)# spanning-tree vlan 10,20 root primary
DSW2(config)# spanning-tree vlan 10,20 root secondary
! or, with an exact value in multiples of 4096:
DSW1(config)# spanning-tree vlan 10 priority 4096
States and timers
In classic STP, a port does not start forwarding right away: first it listens and learns, so it does not create a temporary loop.
The 802.1D states and the RSTP states. Diagram: The House of Routing.
| State | Receives BPDUs? | Learns MACs? | Forwards frames? |
|---|---|---|---|
| Blocking | Yes | No | No |
| Listening | Yes, and sends them too | No | No |
| Learning | Yes, and sends them too | Yes | No |
| Forwarding | Yes, and sends them too | Yes | Yes |
| Disabled | No (port shut down) | No | No |
Listening and learning are transitional states; blocking, forwarding and disabled are stable. The default timers are:
- Hello: 2 s. How often the root bridge sends a BPDU.
- Max Age: 20 s. How long a switch waits without BPDUs before declaring the path lost.
- Forward Delay: 15 s. How long each of the listening and learning states lasts.
An indirect topology change can take 20 + 15 + 15 = 50 seconds to converge. Too long for a modern network: that is why RSTP exists.
RSTP and Rapid PVST+
RSTP (IEEE 802.1w, now part of 802.1D-2004) keeps the STP election but converges in one or two seconds: switches negotiate directly with a proposal and agreement exchange instead of waiting for timers. Also, every switch sends its own BPDUs every 2 s and considers a neighbor lost after three missed hellos (6 s).
| RSTP port role | Function |
|---|---|
| Root | The best path to the root, as in STP |
| Designated | The port that forwards on each segment, as in STP |
| Alternate | Alternative path to the root. It discards traffic and replaces the root port instantly if it fails. |
| Backup | Backup for a designated port on the same shared segment. It is rare. |
| Disabled | Port shut down |
RSTP cuts the states down to three: discarding (which merges blocking, listening and disabled), learning and forwarding. It also classifies links: point-to-point (full duplex between switches, where fast negotiation works), shared (half duplex, where it behaves like STP) and edge (toward end devices, like PortFast).
Cisco’s variants
| Mode | Standard | Instances |
|---|---|---|
| PVST+ | 802.1D with Cisco enhancements | One per VLAN |
| Rapid PVST+ | 802.1w with Cisco enhancements | One per VLAN |
| MST | IEEE 802.1s | Several VLANs per instance |
Having one instance per VLAN lets you share the load: one switch can be the root for VLAN 10 and another for VLAN 20, so both links are used.
SW1(config)# spanning-tree mode rapid-pvst
SW1(config)# end
SW1# show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 24586
Address 0011.1111.1111
Cost 4
Port 25 (GigabitEthernet0/1)
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10)
Address 0022.2222.2222
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- ----------
Gi0/1 Root FWD 4 128.25 P2p
Gi0/2 Altn BLK 4 128.26 P2p
Fa0/1 Desg FWD 19 128.1 P2p Edge
Read the output like this: the root has priority 24586 (24576 + VLAN 10), this switch reaches it through Gi0/1 with cost 4, Gi0/2 is the alternate port and Fa0/1 is an edge port toward an end device.
PortFast and STP protections
These features tune STP at the edges of the network and protect it from mistakes and attacks:
| Feature | Where it is used | What it does |
|---|---|---|
| PortFast | Ports toward PCs, printers and servers | Goes straight to forwarding, without waiting for listening or learning |
| BPDU Guard | PortFast ports | If it receives a BPDU, it shuts the port into the err-disabled state |
| BPDU Filter | Special cases | Stops sending BPDUs. Configured per interface it also ignores received ones, which disables STP on that port: use it very carefully. |
| Root Guard | Designated ports of the root or distribution switch | If it receives a superior BPDU, it puts the port in root-inconsistent and recovers it on its own once the BPDUs stop |
| Loop Guard | Root and alternate ports | If it stops receiving BPDUs, it puts the port in loop-inconsistent instead of moving it to forwarding |
SW1(config)# interface range fastethernet0/1 - 24
SW1(config-if-range)# spanning-tree portfast
SW1(config-if-range)# spanning-tree bpduguard enable
SW1(config-if-range)# exit
! or for every access port with PortFast:
SW1(config)# spanning-tree portfast default
SW1(config)# spanning-tree portfast bpduguard default
DSW1(config)# interface gigabitethernet1/0/10
DSW1(config-if)# spanning-tree guard root
DSW2(config)# interface gigabitethernet1/0/1
DSW2(config-if)# spanning-tree guard loop
shutdown and no shutdown (or with errdisable recovery).EtherChannel with LACP
If you connect two switches with four cables, STP blocks three. EtherChannel groups those links into one logical interface, the port-channel: STP sees a single link, all four forward and, if one fails, the channel keeps working with the rest.
Four physical links, one logical interface. Diagram: The House of Routing.
| Protocol | Modes | Forms the channel if… |
|---|---|---|
| LACP (IEEE 802.3ad standard, now 802.1AX) | active · passive | At least one side is active. Passive with passive does not form a channel. |
| PAgP (Cisco proprietary) | desirable · auto | At least one side is desirable. Auto with auto does not form a channel. |
| Static | on | Both sides are on. There is no negotiation or error detection. |
An EtherChannel supports up to 8 active links (LACP lets you configure 16: 8 active and 8 on standby). All members must match in speed, duplex and layer 2 mode: the same access VLAN, or the same trunk mode, native VLAN and allowed VLAN list.
SW1(config)# interface range gigabitethernet0/1 - 2
SW1(config-if-range)# channel-group 1 mode active
SW1(config-if-range)# exit
SW1(config)# interface port-channel 1
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20,999
SW1(config-if)# end
SW1# show etherchannel summary
Flags: D - down P - bundled in port-channel
s - suspended S - Layer2 R - Layer3 U - in use
Group Port-channel Protocol Ports
------+-------------+-----------+---------------------------
1 Po1(SU) LACP Gi0/1(P) Gi0/2(P)
Po1(SU) means a layer 2 channel in use; (P) shows that the port is in the channel. If you see (s) or (I), check that the members’ configuration matches on both sides.
Layer 3 EtherChannel
Between layer 3 switches, the channel can be a routed link: the members and the port-channel take no switchport and the IP goes on the logical interface.
MLS1(config)# interface range gigabitethernet1/0/1 - 2
MLS1(config-if-range)# no switchport
MLS1(config-if-range)# channel-group 2 mode active
MLS1(config-if-range)# exit
MLS1(config)# interface port-channel 2
MLS1(config-if)# no switchport
MLS1(config-if)# ip address 10.1.99.1 255.255.255.252
Load sharing is not per packet but per flow: the switch hashes MAC addresses, IP addresses or ports (port-channel load-balance src-dst-ip, for example) to pick the link for each conversation.
Layer 2 troubleshooting
To diagnose, separate what each device does into three planes:
- Data plane: forwarding the user’s frames and packets (the MAC table, flooding, forwarding).
- Control plane: the protocols that decide how traffic is forwarded (STP, DTP, LACP, CDP and, at layer 3, routing protocols).
- Management plane: how you administer the device (console, SSH, SNMP, API).
With that in mind, work from the bottom up and use one command for each step:
| Step | What you check | Command |
|---|---|---|
| 1 | Real topology and neighbors | show cdp neighbors |
| 2 | Interface state, speed and duplex | show interfaces status |
| 3 | That the access port is in the right VLAN and the VLAN exists | show vlan brief · show interfaces fa0/1 switchport |
| 4 | That the trunk is up, with the VLAN allowed and the same native VLAN | show interfaces trunk |
| 5 | Who the root is and which ports STP blocks | show spanning-tree vlan 10 |
| 6 | That the EtherChannel members are bundled | show etherchannel summary |
| 7 | Where the switch learned the destination MAC | show mac address-table address … |
For your notes. Write the seven steps above on a card and use them in every lab that fails.
What you take away
- A VLAN is a broadcast domain and a subnet. VLAN 1 is the factory default; usable VLANs go from 1 to 4094.
- An access port carries one untagged data VLAN and, optionally, a tagged voice VLAN (
switchport voice vlan). - 802.1Q inserts 4 bytes with a 12-bit VID. The native VLAN travels untagged and must match on both ends.
- Set the mode with
switchport mode accessortrunkand turn DTP off withswitchport nonegotiate. Auto with auto does not form a trunk. - Route between VLANs with router-on-a-stick (
encapsulation dot1qsubinterfaces) or with SVIs andip routingon a layer 3 switch. - STP elects the root by lowest Bridge ID, one root port per switch, one designated port per segment and blocks the rest. Costs: 100, 19, 4 and 2.
- 802.1D takes up to 50 s (20 + 15 + 15); RSTP converges in 1 or 2 s with the alternate and backup roles and the discarding, learning and forwarding states.
- Rapid PVST+ creates one instance per VLAN.
root primarysets 24576 androot secondary, 28672. - PortFast with BPDU Guard on user ports; Root Guard protects the root; Loop Guard prevents loops if BPDUs are lost.
- EtherChannel bundles up to 8 links into a port-channel. LACP: active or passive (passive with passive does not form a channel).
In the next chapter you move into IPv4 addressing: how an address is written, what a mask is and how you split a network into subnets, exactly what each VLAN needs.
Slides
These slides support the guided class: view them here, full screen, or download the PDF for your notes. Part 1 goes with videos 1, 2, 10 and 11; Part 2 with videos 3 to 7 and 12; and Part 3 with videos 8, 9 and 13.
Class videos
The videos are in Spanish. The translation of the videos is in development.
Each part of the chapter has its own video. Tap a card and the video opens right here, over the page; use the Close button or the Esc key to go back to where you were. Use them alongside the slides of the same part.
- Chapter 3 · Part 1VLAN and trunk fundamentals IWatch video
- Chapter 3 · Part 2VLAN and trunk fundamentals IIWatch video
- Chapter 3 · Part 3STP fundamentalsWatch video
- Chapter 3 · Part 4Electing the STP treeWatch video
- Chapter 3 · Part 5BPDUs, timers and STP configurationWatch video
- Chapter 3 · Part 6STP enhancements and setupWatch video
- Chapter 3 · Part 7Rapid Spanning Tree fundamentalsWatch video
- Chapter 3 · Part 8EtherChannel fundamentalsWatch video
- Chapter 3 · Part 9Troubleshooting fundamentalsWatch video
- Chapter 3 · Part 10Configuring VLANs and trunks IWatch video
- Chapter 3 · Part 11Configuring VLANs and trunks IIWatch video
- Chapter 3 · Part 12Configuring Spanning TreeWatch video
- Chapter 3 · Part 13Configuring EtherChannelWatch video
When you play a video, it loads from YouTube (no cookies until you open it). See the full playlist on YouTube.
Packet Tracer labs
The labs are in Spanish. The translation of the labs is in development.
Download each lab's files and open them with Cisco Packet Tracer. Tap the name to see the two downloads.
Lab 1VLANs, trunk and router-on-a-stick
On switch SW_CCS_01 you create VLANs 100 and 200, assign the access ports, turn DTP off and bring up the trunk to the router, which routes between the VLANs with subinterfaces. Console and enable password: gj123.
Lab 2Spanning Tree: choosing the root bridge
You check which switch is the root in VLANs 1 and 2 and use spanning-tree vlan root primary to move each root to the right switch. Console and enable password: gj123.
Lab 3Layer 2 and layer 3 EtherChannel
Open topology to practice link aggregation with LACP between layer 2 switches and toward a layer 3 switch. It only includes the practice file.
Chapter assessment
There are 100 single-choice questions, split into 10 tabs of 10. Each tab mixes every topic in the chapter and rises in level: questions 1 to 3 are low difficulty, 4 to 8 are medium and 9 to 10 are high.
We do not save your answers. They run in your browser and, if you close or reload the page, you start from zero. Getting it wrong here is the cheapest way to learn.
Additional resources
These links take you to official sites outside this portal. Use them to practice, go further and confirm what you learned.
To study and practice
- Cisco U.: Implementing and Administering Cisco Solutions (CCNA) pathu.cisco.com
- Cisco Learning Network: community, forums and study resourceslearningnetwork.cisco.com
- Cisco Packet Tracer at Networking Academynetacad.com
Exam and certification
- Official CCNA 200-301 v1.1 exam topics (PDF)learningcontent.cisco.com
- Official CCNA certification pagecisco.com
Standards and references
- IEEE 802.1Q: Bridges and Bridged Networks (VLAN, STP, RSTP and MSTP)standards.ieee.org
- IEEE 802.1AX: Link Aggregation (LACP)standards.ieee.org
- Cisco: Understanding Rapid Spanning Tree Protocol (802.1w)cisco.com
Source and credits. Chapter built from Jesús Espinoza’s “VLAN, Trunk and VTP”, “STP and EtherChannel” and “Switching troubleshooting and control planes” notes (CCNA 200-301, parts 1 to 3), paraphrased, updated and aligned with the official CCNA 200-301 v1.1 exam topics. Text drafted with AI assistance; original diagrams by The House of Routing. Technical details were checked against official Cisco documentation and IEEE standards.
