Spanning treeIntermediate26 min read

What Does Learning state Mean?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security

This page mentions older exam versions. See the Current Exam Context and Legacy Exam Context sections below for the updated mapping.

On This Page

Quick Definition

The learning state is a step a switch port goes through when the Spanning Tree Protocol first activates. In this state, the port listens for network traffic to learn which devices are on which side of the network, but it does not yet forward any actual data. This prevents temporary loops while the switch figures out the safest path. The port stays in learning state for about 15 seconds before moving on.

Commonly Confused With

Learning statevsListening state

The listening state occurs before the learning state. In listening, the switch only listens for BPDU packets to determine the network topology and does not learn MAC addresses from data frames. The learning state builds the MAC address table after topology is determined. Both do not forward data, but listening focuses on BPDUs, while learning focuses on data frame source MACs.

Listening is like a driver checking the map (BPDUs) before starting the car. Learning is like writing down the addresses of houses they see while waiting at a red light, but not driving yet.

Learning statevsForwarding state

The forwarding state is the final state where the port both learns MAC addresses and forwards data frames. The learning state only learns MAC addresses and does not forward. The forwarding state is the only state where user traffic can pass through the port.

A cashier at a store: in learning state, they watch customers and note what they buy, but do not ring up any purchases. In forwarding state, they actually process sales.

Learning statevsBlocking state

In the blocking state, a port does not learn any MAC addresses and does not forward any frames. It only receives BPDUs to listen for topology changes. The learning state is a step moving from blocking toward forwarding, where MAC learning begins. Blocking is completely inactive for user traffic.

Blocking is like a security guard who only watches surveillance feeds (BPDUs) but does not interact with people. Learning is the guard starting to memorize faces (MACs) but still not letting anyone in.

Learning statevsDisabled state

The disabled state means the port is administratively down or failed. It does not participate in STP at all. The learning state is a transitional active state where STP processes run. Disabled ports cannot be in any data-forwarding role.

Disabled is like a store that is permanently closed with a sign on the door. Learning is a store that is open but only for staff to rearrange inventory, not for customers.

Must Know for Exams

The learning state is a staple topic in networking certification exams, particularly those focused on Cisco, Juniper, and CompTIA Network+. In Cisco's CCNA (200-301), STP port states are directly listed in the exam blueprint under the 'Network Access' section. Candidates must know the order of states: blocked, listening, learning, forwarding, and disabled. The learning state specifically is tested in questions about convergence time, MAC address table population, and the function of forward delay timers. Expect multiple-choice questions asking which state comes after listening, or which state allows MAC learning but not forwarding.

In CompTIA Network+ (N10-008), the learning state appears in the context of switch configuration and STP fundamentals. The exam objectives include comparing STP port states and explaining how STP prevents loops. You might see a scenario where a new switch is added and a user reports no connectivity for 30 seconds. The correct answer will reference the listening and learning states. Understanding the learning state helps you eliminate wrong answers like 'the switch is down' or 'the cable is bad'.

In more advanced exams like CCNP ENCOR (350-401), the learning state is examined in relation to RSTP and MST. You must understand how the learning state differs in RSTP, where it happens much faster and is triggered by handshakes rather than timers. Expect lab simulation questions where you must interpret show spanning-tree output and determine whether a port is in learning state. You might also need to troubleshoot a port that is stuck in learning state due to a BPDU conflict or timer misconfiguration.

For Juniper JNCIA-Junos, STP is covered in the 'Layer 2 Switching' section. The learning state is part of the STP state machine. You may need to configure STP parameters or verify the port state with the show spanning-tree interface command. Some questions may ask about the effect of changing the forward-delay timer on the learning state duration.

Common exam question types include: direct recall (what is the purpose of the learning state?), scenario-based (a switch is added and after 15 seconds connectivity is restored, what happened?), and troubleshooting (a port remains in learning state for 30 seconds, what could be the issue?). The learning state is also a correct answer in 'what happens during STP convergence' questions. Always remember that the learning state does NOT forward data frames, only learns MAC addresses. This is a frequent trick in exams where a candidate might think it forwards.

Simple Meaning

Imagine you are a traffic officer at a new intersection you have never managed before. When you first arrive, you do not immediately wave cars through. Instead, you stand at the edge and watch the cars for a while, noting where they come from and where they go. You are learning the traffic patterns. But while you are learning, you do not direct any cars, because if you made a mistake and sent them the wrong way, a crash could happen. That is exactly what a switch port does during the learning state in Spanning Tree Protocol.

The switch has just turned on or a new cable was plugged in. The port starts in a blocking state to stay safe, then moves to listening to check for other switches. After that, it enters the learning state. Here, the switch looks at every frame that arrives on that port and records the sender's MAC address in its MAC address table. This table is like a giant map that tells the switch, for every device, which port leads to it. Without this map, the switch would have to send every frame to all ports, which wastes bandwidth and can create loops.

But during learning, the switch does not forward any frames out of that port. It only receives and learns. Why? Because if it started forwarding too early, the network might still be figuring out which paths are safe. A loop could form, causing data to bounce forever and crash the network. The learning state gives the network time to stabilize before the port becomes fully active. The duration is set by the forward delay timer, usually 15 seconds. Once the timer expires, the port moves into the forwarding state and begins to send and receive normal data.

This process is critical because networks with many switches need to be sure every switch knows the correct topology before any port starts forwarding. Without the learning state, a switch could accidentally cause a loop right after it powers up. So the learning state is a safety pause, like a photographer waiting for the camera to focus before taking the picture.

Full Technical Definition

The learning state is one of the five port states defined in the IEEE 802.1D Spanning Tree Protocol (STP). The standard STP port states are: disabled, blocking, listening, learning, and forwarding. The learning state specifically follows the listening state and precedes the forwarding state. Its purpose is to allow the switch to dynamically populate its MAC address table with source MAC addresses from incoming frames without yet forwarding those frames through the port. This prevents the formation of temporary loops during the convergence process.

When a port enters the learning state, the switch has already received BPDU (Bridge Protocol Data Unit) information during the listening state and has determined that this port will eventually become a designated or root port. The learning state lasts for the duration of the forward delay timer, which defaults to 15 seconds. During this period, the switch processes every incoming data frame but only inspects the source MAC address. The destination MAC address is not used for forwarding decisions because the port does not yet forward frames. The switch records each unique source MAC address into its forwarding database (FDB), also called the CAM (Content Addressable Memory) table, associating that MAC address with this port ID.

This learning process is essential to avoid flooding in the early moments of network convergence. Without it, when the port finally becomes forwarding, the switch would have to flood frames to unknown destinations until it learned MAC addresses through normal data traffic. The learning state gives the switch a head start by building a base set of MAC address entries before data traffic is allowed. STP uses the forward delay timer to control the time spent in both the learning and listening states. The total convergence time from blocking to forwarding is typically 30 seconds (15 seconds listening + 15 seconds learning) when using default values.

In Rapid Spanning Tree Protocol (RSTP, IEEE 802.1w), the learning state still exists but operates differently. RSTP converges much faster because it uses a handshake process between switches, and the learning state can be as short as a few milliseconds. In RSTP, a port can go directly from discarding to learning if it receives a proposal agreement handshake. The MAC address learning still happens, but the time is drastically reduced. For Cisco's Per-VLAN Spanning Tree Plus (PVST+) and Rapid PVST+, the same concept applies per VLAN, so a port can be in learning state for one VLAN while blocking for another.

The learning state is monitored by network engineers using commands like show spanning-tree interface, which displays the port state. If a port stays in learning state longer than expected, it usually indicates a forward delay timer misconfiguration or a BPDU inconsistency. The standard forward delay can be tuned, but Cisco recommends keeping it at the default in most scenarios. Changing the forward delay affects both listening and learning states equally. The learning state is a critical part of the STP convergence, ensuring that loops are avoided and the switch is prepared to forward traffic efficiently once the port becomes active.

Real-Life Example

Think about a new employee starting work at a busy airline check-in counter. There are many counters, and the employee does not yet know which passengers have which flight numbers or where the bag drop is. On the first day, the manager does not let the new employee serve customers directly. Instead, the employee stands next to an experienced agent and just watches. For the first hour, the new employee listens to every passenger, notes their flight number, and observes which gate they are directed to. The employee is learning the patterns. But the employee does not actually check anyone in or handle luggage because they might make a mistake and send a passenger to the wrong gate, causing chaos.

That hour of watching is exactly the learning state in STP. The new employee (the switch port) is receiving information (source MAC addresses) and storing it in their mental map (the MAC address table). They are not yet taking action (forwarding frames). The airline needs to make sure the employee has a solid understanding of the routes before they start directing passengers, because the cost of a mistake is a delayed flight or a missed connection.

In the network world, that chaos is a loop. If the switch port started sending frames before it knew which MAC addresses were reachable through that port, a frame could be sent back to the same switch that sent it, creating an endless cycle. That cycle would use up bandwidth and crash the network. So the learning state is that necessary training period. Once the manager is confident the new employee knows the basic routes, they let them start serving. That is the forwarding state. The learning state ensures the switch has a basic understanding of the network before it becomes fully active, making the whole system safer and more efficient.

Why This Term Matters

The learning state directly impacts network stability and performance. In any switched network with redundant links, STP is the protocol that prevents loops. Without the learning state, a switch would start forwarding data immediately upon a link coming up, before it knew the network topology. This could cause a loop instantly, flooding the network with broadcast storms and bringing down the entire system. For IT professionals managing enterprise networks, understanding the learning state is key to troubleshooting slow convergence, dropped connections, and MAC address table issues.

For example, if a network engineer plugs in a new switch and users immediately start complaining about slow performance or intermittent connectivity, the culprit may be the STP learning state. The port stays in learning state for 15 seconds by default, during which no data passes. That 15-second delay can cause timeouts for critical applications like database queries or VoIP calls. Engineers often need to adjust timers or use features like PortFast, which bypasses the learning state for end-user devices, allowing immediate forwarding. But PortFast must only be used on ports that connect to single devices, not to other switches, or loops can occur.

Another real-world concern is network convergence after a link failure. When a switch detects a failure, it recalculates the spanning tree. Ports that were in blocking state may move through listening and learning again. That 30-second downtime can be devastating for real-time applications. Rapid Spanning Tree Protocol reduces this time significantly, but the learning state is still present. Professionals need to know how to optimize these timers or implement RSTP to meet service-level agreements.

the learning state affects MAC address table stability. If a port flaps between states, the switch may constantly learn and unlearn MAC addresses, causing the table to churn. This can lead to high CPU usage on the switch and intermittent connectivity. Monitoring tools often track MAC address table changes as a symptom of STP instability. Understanding the learning state helps engineers interpret these alerts and take corrective action, such as adjusting STP priorities or replacing faulty cabling.

How It Appears in Exam Questions

Exam questions about the learning state usually fall into three categories: definition, order of operations, and practical troubleshooting. For definition questions, you might see: 'During which STP port state does a switch learn MAC addresses but does not forward frames?' The answer is the learning state. Another variant: 'Which STP port state immediately follows the listening state?' That is the learning state. These are straightforward recall items, and the correct answer is often the learning state because it is the only state that specifically combines MAC learning with no forwarding.

Order of operations questions often present a numbered list of events and ask you to arrange them correctly. For example: 1. Port moves to forwarding state. 2. Port learns MAC addresses. 3. Port listens for BPDUs. 4. Port is in blocking state. The correct sequence is 4, 3, 2, 1. Here, step 2 (learning MAC addresses) corresponds to the learning state. These questions test your understanding of the STP state machine sequence.

Scenario-based questions describe a real-life network change. For instance: 'A network administrator adds a new switch to the network. Users connected to that switch report that they have no connectivity for about 30 seconds, after which everything works normally. Which STP states did the ports on the new switch go through?' The answer is blocking, listening, learning, forwarding. Sometimes the question will specify that connectivity is restored after 15 seconds, indicating the learning state finished but listening also took 15. The key is to recognize that the learning state timer causes the delay.

Troubleshooting questions are more advanced. A sample question: 'A switch port is showing in the learning state for an unusually long time. Which of the following is the most likely cause?' Possible answers include a forward delay timer misconfiguration, a BPDU filter enabled, or a duplex mismatch. The correct choice is usually the forward delay timer being set too high. Another troubleshooting pattern: 'After a cable is replaced, the port stays in learning state and never transitions to forwarding. What should the engineer check?' The answer often relates to STP configuration, such as the port being configured as a root guard or BPDU guard, or a topology change that recalculates the spanning tree.

Some Cisco-specific questions use the output of show spanning-tree vlan 1. They might show a port in 'learning' state and ask why it is not forwarding. The reason could be that the port is a designated port waiting for the forward delay timer to expire. Or the question might show that the port role is 'Altn' (alternate) and is in learning state, which is a trick because alternate ports are usually in blocking state in classic STP, but in RSTP they can be in discarding, not learning. Watch for those nuances.

In all cases, the learning state is a frequent exam topic because it is a clear, testable concept that separates candidates who memorize from those who understand. You need to know that MAC learning occurs, forwarding does not, and the default timer is 15 seconds. Also know that PortFast bypasses the learning state for access ports. This is often the solution in scenario questions where immediate connectivity is required.

Practise Learning state Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

You are studying for your CCNA exam and you set up a small lab with three switches: Switch A, Switch B, and Switch C. They are connected in a triangle to provide redundancy. Initially, all ports are active on Switch A. You plug in Switch B for the first time. On Switch B, the ports that connect to Switch A start in the blocking state. After about 20 seconds, the ports on Switch B transition to listening and then to learning. You monitor the switch using the command show spanning-tree vlan 1. On interface GigabitEthernet 0/1, you see 'Port State: learning'. The switch is now receiving frames from Switch A and recording the source MAC addresses in its MAC address table. For example, it learns that the MAC address of the computer connected to Switch A is reachable through this port. But the port does not forward any frames yet. If you were to check the MAC address table with show mac address-table, you would see entries with the 'Learned' source, but the port would still be in learning state.

Meanwhile, a user on Switch B tries to ping a server on Switch A. The ping fails because the port is in learning state and cannot forward ICMP packets. The user sees a 'Request timed out' message. After another 15 seconds, the port transitions to forwarding. The ping now works, and the user is happy. This 30-second delay is the combined listening and learning state times. In the exam, you might be asked: 'How long does the learning state last by default?' The answer is 15 seconds. You might also be asked: 'Why did the ping fail during that period?' Because the port was in learning state and could not forward frames.

Now imagine that instead of using the default settings, you configure spanning-tree portfast on the port connecting Switch B to a single computer. If you did that on the port connecting to another switch, it would be dangerous, but if the port is for a single PC, PortFast makes the port skip the learning state and go directly to forwarding. In the lab, if you enable PortFast on the switch-to-switch link by mistake, you could cause a loop. The learning state is there to prevent exactly that. So this scenario illustrates both the normal operation and the power of configuration choices regarding the learning state.

Common Mistakes

Thinking the learning state forwards data frames.

The learning state only learns MAC addresses from received frames but does not forward any frames. Forwarding happens only in the forwarding state.

Remember: Learning = Learn MACs, no forwarding. Forwarding = Learn MACs AND forward frames.

Believing the learning state lasts only a few seconds because of RSTP.

In classic STP, the learning state lasts 15 seconds by default. In RSTP, it can be much shorter (milliseconds), but the classic STP default is still an exam point.

For classic STP, always think 15 seconds for learning. For RSTP, know it is faster but still exists.

Confusing the learning state with the listening state.

In the listening state, the switch processes BPDUs but does not learn MAC addresses from data frames. Learning state does learn MAC addresses. They are sequential and differ in purpose.

Listening = BPDU processing only. Learning = MAC address learning. Both do not forward data.

Assuming that PortFast eliminates the learning state entirely.

PortFast does not eliminate the learning state; it bypasses it by placing the port directly into forwarding state. The learning state still exists as a concept, and the port skips it. Understanding this difference matters for exams.

PortFast means the port does NOT go through learning state, but the learning state concept remains unchanged.

Thinking a port in learning state is in error-disabled state.

Error-disabled is a different state caused by violations like BPDU guard or port security. Learning is a normal transitional state, not an error.

Check the switch output carefully. Learning state is shown as 'learning', not 'err-disabled'.

Exam Trap — Don't Get Fooled

{"trap":"A question states: 'A switch port receives data frames during the learning state. What does the switch do with these frames?' Some candidates choose 'They are forwarded out the port' because they think 'learn' means forward."

,"why_learners_choose_it":"The word 'learn' implies processing traffic, and many assume that if the switch looks at the frame, it must also send it out. They confuse the learning function with forwarding.","how_to_avoid_it":"Remember the rule: In learning state, the switch processes ONLY the source MAC address for the MAC address table.

It does NOT forward the frame. The frame is discarded after learning. Always think of learning as a one-way street: the switch receives, learns, but does not send."

Step-by-Step Breakdown

1

Blocking State (Initial Safe Hold)

When a switch port first comes up, it is placed in the blocking state. In this state, the port does not learn MAC addresses, does not forward data frames, and only listens for BPDUs from other switches. This prevents any immediate loop while the switch figures out the network topology. The port stays here for at least 20 seconds (max age timer) if no BPDU is received, or it can progress faster if a superior BPDU is received.

2

Listening State (Topology Discovery)

After blocking, the port moves to listening state. Now the switch actively listens for BPDUs to decide the port role (root, designated, or alternate). Still no MAC learning and no data forwarding. The port listens for 15 seconds by default (forward delay timer). During this time, the switch exchanges BPDUs to determine the best path to the root bridge.

3

Learning State (MAC Table Population)

Once the port role is determined and it will become a forwarding port, the switch moves to learning state. Now, the switch receives data frames and records the source MAC addresses in its MAC address table. However, it does NOT forward these frames. This lasts for another 15 seconds (forward delay timer). This step builds the MAC table so that when the port becomes active, it can immediately switch frames based on known MAC addresses, reducing flooding.

4

Forwarding State (Normal Operation)

After the learning state timer expires, the port transitions to forwarding state. In this state, the port learns MAC addresses from incoming frames and forwards frames to their destinations. All normal data traffic now flows through this port. The port remains in forwarding state unless a topology change occurs, which may bring it back to blocking or learning.

5

Topology Change (Repeat the Cycle)

If a link fails or a new switch is added, the root bridge sends a topology change notification. Switches then flush their MAC tables and the affected ports may re-enter blocking, then listening, then learning, then forwarding. This cycle repeats to ensure a loop-free topology after every change.

Practical Mini-Lesson

The learning state is not just a theoretical concept; it directly affects how you design and troubleshoot networks. As a network professional, you will encounter the learning state every time a switch boots, a new cable is plugged in, or a link fails and recovers. The default 30-second convergence (listening + learning) is often unacceptable in modern networks. That is why understanding the learning state is the foundation for implementing faster convergence mechanisms.

One of the first practical changes you will make is enabling PortFast on access ports that connect to end devices like PCs, printers, and IP phones. PortFast makes the port skip the listening and learning states, going directly to forwarding. But you must ensure the port truly only connects to a single device, not another switch. If you use PortFast on a switch-to-switch link, you risk creating a loop before STP can detect it. Cisco's BPDU Guard feature is often paired with PortFast to shut down the port if a BPDU is received, preventing accidental loops.

In a production environment, you might need to tune the forward delay timer if your network has longer propagation delays, like in a large campus with fiber links. The forward delay timer can be adjusted globally with the spanning-tree vlan X forward-time command. Decreasing it below the default 15 seconds can cause loops, because switches might not have enough time to learn the topology. Increasing it can cause longer outages. The learning state timer is directly affected by this setting.

For example, if you have a network that requires a 20-second forward delay, the learning state would last 20 seconds as well. That means 40 seconds total of no data flowing through the port. That can cause TCP timeouts, dropped voice calls, and application errors. You might need to implement RSTP or use features like UplinkFast or BackboneFast to reduce convergence. But all these optimizations still respect the basic concept of the learning state: the switch must learn MAC addresses before forwarding is safe.

When you configure a new switch in the field, you should always check the STP state of the uplink ports. Use the command show spanning-tree interface fastethernet 0/1. If you see 'learning', you know the switch is still converging. If it stays there for more than 30 seconds, there is likely a discrepancy in the STP parameters or a physical issue. Common causes are a duplex mismatch (which causes BPDU loss) or a bad cable that causes intermittent link flaps. The learning state is your diagnostic clue.

Finally, remember that in a vPC (Virtual Port Channel) environment or using stackwise, the learning state still applies, but the behavior is slightly different because multiple switches act as one. The underlying principle remains: never forward on a new link until the MAC table is populated with the correct mapping. The learning state is the mechanism that enforces this discipline. By mastering it, you build the intuition needed to design resilient, loop-free networks that converge quickly when changes happen.

Memory Tip

LLF = Listen, Learn, Forward. The 'Learn' phase is where you learn MACs but do not forward. The middle L in the sequence reminds you: Listen (first L), Learn (second L), Forward (F). Learning is the second stop before the green light.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Legacy Exam Context

Older materials may mention these exam versions, but learners should use the current objectives for their target exam.

N10-008N10-009(current version)

Related Glossary Terms

Frequently Asked Questions

Does the learning state exist in Rapid Spanning Tree Protocol (RSTP)?

Yes, RSTP has a learning state, but it functions differently. In RSTP, a port can move directly from discarding to learning via a handshake process, and the time spent in learning is usually milliseconds, not the default 15 seconds.

Can I skip the learning state completely?

Yes, by enabling PortFast on a port. This makes the port immediately go to forwarding, bypassing both listening and learning. However, you should only use PortFast on ports that connect to end devices, not to other switches, to avoid loops.

What happens if I configure the forward delay timer to 30 seconds?

Both the listening and learning states will last 30 seconds each, resulting in 60 seconds before the port starts forwarding. This can cause long connectivity outages and application timeouts.

Does the learning state affect the MAC address table size?

No, the MAC address table size is a hardware limitation. The learning state just populates the table with entries. If the table is full, new MAC addresses will not be learned, but that is a separate issue from the learning state.

Why does a port stay in learning state for 30 seconds?

By default, the learning state timer is 15 seconds. If you see 30 seconds, it could be due to a misconfigured forward delay timer set to 30 seconds, or the port might have moved back to listening and then learning again because of a topology change.

In a Cisco switch, how can I see if a port is in learning state?

Use the command 'show spanning-tree interface interface-id' or 'show spanning-tree vlan vlan-id'. The output will show the port role and state, such as 'learning'.

Is the learning state used in MST (Multiple Spanning Tree)?

Yes, MST uses the same basic port states as RSTP, including the learning state. The states are discarding, learning, and forwarding. MST inherits the learning mechanism from RSTP.

What is the difference between learning state and listening state in terms of BPDUs?

In the listening state, the switch processes BPDUs to determine the port role and network topology. In the learning state, the switch continues to process BPDUs but also begins learning MAC addresses from data frames. Both states do not forward data.

Summary

The learning state is a critical transitional phase in the Spanning Tree Protocol that allows a switch port to build its MAC address table before it begins forwarding user data. It sits between the listening state and the forwarding state in the standard STP sequence. During the learning state, the switch inspects incoming data frames, extracts the source MAC address, and records it in the MAC address table. However, the port does not forward any frames during this time. This deliberate delay prevents network loops and ensures that when the port becomes fully active, it already has a map of which devices are reachable through that link.

For IT certification candidates, understanding the learning state is essential for passing exams like CCNA, CompTIA Network+, and JNCIA. It appears in questions about port state sequences, convergence timing, MAC learning, and troubleshooting delayed connectivity. The default 15-second timer is a frequent target for exam questions, as is the fact that no data forwarding occurs. Common mistakes include confusing learning with listening, thinking learning forwards frames, or assuming PortFast eliminates the concept entirely.

In real-world networking, the learning state is a double-edged sword. It is vital for preventing loops, but its 15-second delay can cause unacceptable downtime. Professionals balance this by using PortFast on access ports, deploying Rapid STP, and tuning timers where necessary. The learning state remains a foundational concept for any network engineer who works with Ethernet switches. Mastering it gives you the confidence to design, configure, and troubleshoot resilient layer 2 networks. Remember the memory aid: Listen, Learn, Forward, the second step is where you build your map before you drive.