AP Networking • Switching, VLANs & Routing

Layer 2 vs. Layer 3 Switch

Learn the difference by following real forwarding decisions: MAC learning inside VLANs, SVIs and gateways, inter-VLAN routing, route-table evidence, security boundaries, and failure localization.

Independent AP Networking resource • Updated 2026-09-09 • Includes 24 free digital flashcards
Key idea: a multilayer switch can make Layer 2 and Layer 3 decisions in the same chassis. Identify the function the traffic actually requires.
Practice with Flashcards
Decision-first model

Layer 2 and Layer 3 switching are different forwarding decisions that can happen in the same chassis

The useful distinction is not “cheap switch versus expensive switch.” A Layer 2 switch forwards Ethernet frames inside a Layer 2 domain using MAC-address information. A Layer 3 or multilayer switch can do that same switching work and can also forward IP packets between networks using Layer 3 interfaces and a routing table. The AP Networking skill is recognizing which forwarding decision the traffic requires at that moment.

Reasoning sequence: source requirement → intended VLAN → local or remote destination → Layer 2 attachment → gateway/SVI if remote → route → policy → destination/return path → requirement-matched verification.
Functional comparison

Compare what each function knows and what question it answers

Capability or artifactLayer 2 switchingLayer 3 switching
Forwarding objectEthernet frameIP packet between networks
Primary forwarding keyDestination MACDestination IP prefix
Core tableMAC/CAM tableRouting table / Layer 3 forwarding information
VLAN-local forwardingYesYes—the device still contains Layer 2 switching functions
Inter-VLAN forwardingNot by a pure Layer 2 functionYes, when Layer 3 interfaces/routing are configured
Host gateway roleNot as a pure L2 forwarding functionAn SVI or routed interface can be a gateway
Security boundaryVLAN separates Layer 2 domainsLayer 3 policy can control traffic crossing networks

Swipe horizontally to see the full table.

Layer 2 mechanics

A Layer 2 switch learns where MAC addresses appear, not which remote IP route to use

When a frame enters a switch, the source MAC gives the switch evidence about where that source is reachable in the relevant VLAN. For a known destination MAC, the switch can use its learned table to select an outgoing port. VLAN context matters: the same physical switch can maintain logically separate Layer 2 forwarding domains.

Switch-1# show mac address-table
VLAN   MAC Address       Type      Port
10     00aa.1111.2222    DYNAMIC   Gi1/0/4
10     00bb.3333.4444    DYNAMIC   Gi1/0/8
20     00cc.5555.6666    DYNAMIC   Gi1/0/12

This hypothetical table can help trace a host through the switched network. It cannot, by itself, prove that VLAN 10 can route to VLAN 20.

VLAN boundary

VLANs separate Layer 2 forwarding, but VLAN creation alone does not create inter-VLAN communication

Suppose ports Gi1/0/4 and Gi1/0/8 are access ports in VLAN 10 while Gi1/0/12 belongs to VLAN 20. Hosts in VLAN 10 can exchange frames through Layer 2 switching when their addressing and local path are correct. A host in VLAN 10 does not simply send a normal VLAN 10 frame directly to the VLAN 20 host as though the VLAN boundary were absent.

When VLANs correspond to different IP networks, communication between them requires a Layer 3 forwarding function. Review VLANs Explained and Network Switching for the Layer 2 mechanics.

SVI mechanics

An SVI gives a VLAN a Layer 3 presence on a multilayer switch

A switched virtual interface is a logical Layer 3 interface associated with a VLAN. In a common design, VLAN 10 might use network 10.10.10.0/24 with an SVI address of 10.10.10.1, while VLAN 20 uses 10.10.20.0/24 with an SVI at 10.10.20.1. Hosts can use the appropriate SVI address as their default gateway.

interface Vlan10
 ip address 10.10.10.1 255.255.255.0

interface Vlan20
 ip address 10.10.20.1 255.255.255.0

Host A: 10.10.10.25/24  gateway 10.10.10.1
Host B: 10.10.20.80/24  gateway 10.10.20.1

The important concept is functional: the VLAN now has an IP interface capable of participating in Layer 3 forwarding.

Packet walkthrough

Follow one packet from VLAN 10 to VLAN 20

1. Host decision10.10.10.25/24 recognizes 10.10.20.80 as remote.
2. First frameThe host sends toward its VLAN 10 gateway/SVI MAC.
3. L2 deliverySwitching gets the frame to the Layer 3 gateway function.
4. Route decisionThe switch examines destination IP 10.10.20.80 and selects VLAN 20's connected network.
5. New L2 deliveryThe packet is delivered using Layer 2 information appropriate to VLAN 20.

The IP destination remains the final host. The Layer 2 header is local to the relevant segment and is not simply carried unchanged across the Layer 3 boundary.

Route-table evidence

Connected VLAN interfaces can create directly connected Layer 3 networks

L3-Switch# show ip route
C  10.10.10.0/24 is directly connected, Vlan10
L  10.10.10.1/32 is directly connected, Vlan10
C  10.10.20.0/24 is directly connected, Vlan20
L  10.10.20.1/32 is directly connected, Vlan20
S  10.50.0.0/16 via 10.10.20.254

In this hypothetical output, 10.10.10.0/24 and 10.10.20.0/24 are directly connected networks. A destination in 10.50.0.0/16 instead uses the listed next hop. The presence of these routes is evidence that the device has Layer 3 forwarding information; it is not proof that every policy, return path, or application works.

Same chassis, two behaviors

A multilayer switch does not route every frame merely because routing is enabled

If 10.10.10.25 sends to 10.10.10.80 and both are correctly placed in VLAN 10 with the same subnet, their exchange can remain a Layer 2 switched flow. If 10.10.10.25 sends to 10.10.20.80, the source identifies a remote network and sends to its gateway; that traffic requires the Layer 3 function.

Exam clue: ask whether the destination is local to the sender's IP network. That often tells you whether the immediate problem is primarily a switching path or a routed path.
Routed ports vs. SVIs

Layer 3 switching is not limited to SVIs

SVIs are especially useful when a Layer 3 interface represents a VLAN, but multilayer switches can also support routed physical interfaces depending on platform and design. A routed interface participates as a Layer 3 link rather than acting as an ordinary Layer 2 access port for a user VLAN.

For AP Networking reasoning, focus on the artifact: an IP-addressed Layer 3 interface plus routing information indicates a routed function. Do not assume every physical port on a multilayer switch behaves identically.

Trunks and Layer 3

A trunk can carry multiple VLANs without itself proving that inter-VLAN routing works

A trunk is a Layer 2 mechanism for carrying traffic associated with multiple VLANs across a link. Seeing VLAN 10 and VLAN 20 allowed on a trunk is evidence about Layer 2 carriage. Inter-VLAN communication still depends on an available Layer 3 gateway, routes, policy, and return path.

Evidence boundary: “the VLAN is allowed on the trunk” does not mean “the destination network is routable and permitted.” Keep Layer 2 carriage evidence separate from Layer 3 forwarding evidence.
Design tradeoff

Why place Layer 3 forwarding inside a campus switching design?

Routing close to VLAN boundaries can reduce unnecessary path length and provide high-capacity inter-VLAN forwarding. It can also make the distribution/core design more structured because IP boundaries can constrain Layer 2 failure domains. But the best design depends on requirements: policy enforcement, redundancy, operational skills, failure behavior, hardware capabilities, WAN/Internet connectivity, and where security inspection must occur.

A Layer 3 switch is therefore not “better” in every position. It is useful where both switching and routed boundaries fit the network's requirements.

Security

Segmentation is only useful when the permitted crossing paths match policy

Putting students, staff, servers, and management systems into separate VLANs creates logical boundaries, but it does not answer which groups should communicate. Once Layer 3 forwarding exists between those networks, ACLs, firewall policy, or other controls may be required to enforce the intended access model.

★ Routing Practice • Layer 2 vs. Layer 3 Switch

A five-minute warm-up for Layer 2 vs. Layer 3 Switch

Tomorrow’s opening question can pick up where this page leaves off: have students trace the connection and explain why traffic takes that path. The 300 Bell Ringers give you short questions and teacher answers you can use without preparing a new starter each morning.

300 AP Networking Bell Ringers
$74.99
BUY TEACHER PACK → See what is included in the 300 Bell Ringers →
Instant Access • Full-Year Teacher Resource

A strong verification plan therefore includes both a positive test for required traffic and a negative test for traffic that must remain blocked. Routing success without policy verification is incomplete.

Worked case 1

Two VLAN 10 hosts fail: the route table is not the first unresolved dependency

Host A and Host B are intended to be in VLAN 10. Both use 10.10.10.0/24 addresses, but they cannot communicate. Before changing an SVI or adding routes, verify link state, access-port VLAN membership, host prefix configuration, local address resolution, and MAC learning.

If Host A appears in the MAC table on the expected VLAN 10 port but Host B appears under VLAN 20, that artifact points to an attachment/segmentation mismatch. Adding a route would treat the symptom as a Layer 3 problem even though the intended same-VLAN path is wrong.

Switching & VLAN Lab • 120 Missions

Let students try Layer 2 vs. Layer 3 Switch for themselves

Reading the explanation is a start. In the browser simulator, students work through a broken network, choose what to test and see whether their fix worked. It gives them another chance to use what they learned about Layer 2 vs. Layer 3 Switch.

AP Networking Browser Troubleshooting Simulator
$29.99
120 Missions • 60 Failure Patterns • Offline Copy
GET THE SIMULATOR → See all 120 missions & features
Worked case 2

Same-VLAN traffic works, but VLAN 10 cannot reach VLAN 20

Host A can reach another VLAN 10 host and can reach 10.10.10.1, its SVI gateway. Those successes preserve substantial evidence: Host A's local attachment, VLAN 10 path, and tested gateway reachability are working. The next discriminating artifacts are the Layer 3 switch's SVI state, route table, policy, destination VLAN path, and return path.

This is more efficient than restarting troubleshooting at the cable because successful local tests have already bounded the failure.

Routing Exam Practice • Layer 2 Vs Layer 3 Switch

Check whether Layer 2 vs. Layer 3 Switch has really stuck

Once students have worked through this topic, give them questions mixed in with the rest of the course. The Exam Prep Vault includes practice exams, multiple-choice questions and artifact labs so they cannot rely on a chapter heading to tell them what to do.

AP Networking Complete Exam Prep Vault
$39.99
GET THE EXAM PREP VAULT → See the Exam Prep Vault contents →
4 Practice Exams • 320 MCQs • 60 Artifact Labs
Worked case 3

The route exists, but an ACL blocks the required application

VLAN 10 has 10.10.10.0/24, VLAN 20 has 10.10.20.0/24, and the Layer 3 switch shows both as connected. Ping to the gateway succeeds, but TCP traffic to a server in VLAN 20 fails. A valid connected route is not enough to label this a routing failure.

Policy evidence (hypothetical):
permit tcp 10.10.10.0/24 10.10.20.50 eq 443
deny   ip  10.10.10.0/24 10.10.20.0/24

Required service: TCP/8443

The required port is not covered by the permit. The smallest justified change would target the actual requirement rather than broadly allowing all inter-VLAN traffic. Verification should prove TCP/8443 works and unrelated denied traffic remains denied.

Premium Switching Feedback

Spend less time marking explanations about Layer 2 vs. Layer 3 Switch

When students explain their answer, it takes more than a right-or-wrong check to see what they understand. The Grading Copilot helps you review how they used the clues, where their explanation falls short and what feedback to give next. You make the final grading decision.

AP Networking Artifact Analysis Grading Copilot
$49.99
8 Criteria • 5 Task Modes • Offline Premium Copy
GET THE GRADING COPILOT → See the free Copilot preview
Worked case 4

The SVI is unavailable while local Layer 2 switching still works

Two hosts in VLAN 30 can communicate with each other, but neither can reach remote networks through the expected VLAN 30 gateway. This pattern is compatible with a failure in a dependency required for routed traffic but not same-VLAN traffic—such as gateway/SVI availability or Layer 3 configuration.

Evidence boundary: local success does not prove the SVI is healthy. It proves the tested local switched path works. Inspect the gateway address, SVI operational state, and routing function next.

Worked case 5

A trunk carries both VLANs, yet inter-VLAN traffic still fails

An uplink shows VLANs 10 and 20 allowed, and MAC addresses from both VLANs are learned across it. That is useful Layer 2 evidence. If VLAN 10 still cannot reach VLAN 20, inspect whether the Layer 3 gateway interfaces exist and are usable, whether routing is enabled/configured as required, whether policy permits the flow, and whether the destination can return traffic.

NEW • COMPLETE 180-DAY TEACHER CURRICULUM

Teach Layer 2 vs. Layer 3 Switch as part of a planned school year

This page gives you one topic. The 180-Day Teacher Curriculum puts it into a full course plan, with daily teaching notes, student activities and checks for understanding. Use it when you need to know what comes before this lesson and what to teach next.

AP Networking Complete 180-Day Teacher Curriculum
$199.99
180 Lessons • 180 Daily Simulators • 36 Teaching Weeks
GET THE 180-DAY CURRICULUM → See 3 free curriculum examples

The trunk artifact narrows the problem; it does not finish the diagnosis.

Failure localization matrix

Use successful tests to decide which switching layer to inspect next

ObservationWhat it supportsNext discriminating evidence
No link on access portLittle Layer 1 evidenceNIC, cable, port state
Link works; same-VLAN peer failsPhysical attachment existsVLAN membership, IP/prefix, ARP, MAC table
Same-VLAN peer works; SVI gateway failsLocal Layer 2 path worksGateway address, SVI state, local gateway resolution
Gateway works; other VLAN failsHost-to-gateway path worksRoute, policy, destination VLAN, return path
Other VLAN numeric IP works; service failsTested IP path worksExact service, ACL/firewall, listener/state

Swipe horizontally to see the full table.

Evidence boundaries

One artifact should never be allowed to prove an unrelated function

Artifact/resultReasonable inferenceWhat remains unproven
MAC learned in VLAN 10Layer 2 learning for that source/contextSVI/routing/policy
VLAN 10 allowed on trunkConfigured Layer 2 carriage permits VLAN 10End-to-end VLAN path and Layer 3 reachability
Host reaches VLAN 10 SVITested host-to-gateway path worksRoute and policy beyond gateway
Connected route for VLAN 20Device has a Layer 3 forwarding entry for networkDestination host/service and security permission
Required app succeedsTested service path worksThat forbidden paths remain blocked

Swipe horizontally to see the full evidence table.

Misconceptions

Six Layer 2 vs. Layer 3 switch traps to avoid

  • “A Layer 3 switch routes everything.” Same-VLAN traffic can still be switched locally.
  • “Creating VLANs automatically enables communication between them.” It does not.
  • “A trunk is a route.” A trunk carries Layer 2 VLAN traffic; routing is a different function.
  • “A connected route proves the application works.” Policy, return path, and service state remain separate.
  • “If it is called a switch, it cannot be a default gateway.” An SVI on a multilayer switch can serve that role.
  • “If routing works, segmentation is secure.” Required and forbidden flows still need policy verification.
AP Networking response model

Build answers from the observed artifact instead of reciting device definitions

Claim: identify whether the failure or forwarding action is Layer 2 or Layer 3.

Exact evidence: cite the VLAN, MAC entry, SVI, route, gateway test, or policy result that supports the claim.

Mechanism: explain how that artifact affects frame or packet forwarding.

Boundary: state what the evidence does not yet prove.

Next evidence: choose the test that separates the remaining plausible causes.

Verification: retest the required traffic and, for policy changes, verify prohibited traffic remains blocked.

Design decision

Choose Layer 2 or Layer 3 placement from requirements, not from a device-name preference

RequirementLikely design implicationEvidence to validate
Endpoints share one VLANLayer 2 access forwarding is centralPort/VLAN state and MAC learning
Multiple VLANs must communicateLayer 3 gateway/routing function requiredSVIs/interfaces, routes, policy
Failure domains should be boundedConsider deliberate Layer 3 boundariesTopology plus controlled failure behavior
Sensitive VLANs need restricted accessPlace enforceable policy at crossing pathPositive and negative flow tests
High inter-VLAN demandCapacity of Layer 3 path mattersUtilization, latency, loss, failover capacity

Swipe horizontally to see the complete decision table.

Free digital flashcards

24 Layer 2 vs. Layer 3 switch digital flashcards

Use these cards to practice forwarding keys, MAC and route tables, VLANs, SVIs, gateways, inter-VLAN routing, troubleshooting boundaries, policy, and verification. The goal is not just recall: say what evidence would prove each answer before revealing it.

All Layer 2/Layer 3 cards
Click or press Enter/Space to reveal.
Name the evidence boundary before moving on.
0 seen•24 cards
Continue studying

Connect Layer 2 and Layer 3 switching to the rest of the packet path