Achievable logoAchievable logo
CCNA
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Exam catalog
Mountain with a flag at the peak
Textbook
Introduction
1. Introduction to networking
2. Administering Ethernet LANs
2.1 Wired network access
2.2 Hosts communicating on a Local Area Network
2.3 Virtual LANs (VLANs)
2.4 Layer 2 link redundancy
2.5 Configuring Cisco Switches
3. IP connectivity
4. Network services
5. IPv6
6. Wireless networking
7. Network management and administering network devices
8. Network security fundamentals
9. Network automation and programmability
Wrapping up
Achievable logoAchievable logo
2.3 Virtual LANs (VLANs)
Achievable CCNA
2. Administering Ethernet LANs
Our CCNA course is currently in development and is a work-in-progress.

Virtual LANs (VLANs)

6 min read
Font
Discuss
Share
Feedback

In the previous chapter, you learned how hosts discover the MAC address of the host they want to communicate with. They do this by sending an ARP Request in a broadcast frame. If the target host is online and connected to the LAN, it responds directly (unicast) to the sender with an ARP Reply that includes its MAC address.

Broadcasts are useful when you don’t know where a host is on the LAN. They also help switches learn which switchport a host is connected to. However, broadcasts come with an important drawback.

Imagine a very large LAN made up of many interconnected switches, with endpoint devices connected to most (or all) switchports.

What happens when a switch receives a broadcast frame (after learning the source MAC address)?

(spoiler)

The switch makes copies of the broadcast frame and floods it out of every port, except the port on which the frame was received.

This can significantly impact network performance. It also affects endpoints that receive these broadcast copies. Broadcasts are meant for everyone, so every host that receives a broadcast frame must interrupt its CPU (Central Processing Unit) to process the frame. Even if the IP packet inside the frame isn’t destined for that device’s IP address, the device still has to examine and process the frame.

On a large LAN with hundreds or thousands of endpoints, repetitive broadcasts can become a serious burden because every endpoint receives and processes every broadcast frame.

To address this, Ethernet switches introduced a feature that lets you group physical switchports into separate LANs called “Virtual LANs,” or VLANs.

Virtual LANs (VLANs)

A VLAN segments the broadcast boundary. The area in which broadcasts can propagate is called a Broadcast Domain.

By default:

  • All ports on a switch are in the same broadcast domain.
  • That means they’re all on the same LAN.

When you connect one switch to another, you extend the LAN and also extend the broadcast domain.

When you create a VLAN and move switchports into it, those switchports become part of a different broadcast domain. As a result:

  • Broadcasts propagated within one VLAN can’t reach another VLAN.
  • Broadcasts originating within a particular VLAN can only be seen or received by hosts within that same VLAN.

In short; “VLANs segment Broadcast Domains”

Historically, VLANs were especially helpful because endpoint CPUs were more sensitive to periodic broadcasts due to hardware limitations at the time. Modern CPUs are much more capable, but excessive broadcasts can still cause problems.

Today, VLANs are commonly used as a security and segmentation tool: they separate groups of endpoints so only the intended devices can communicate directly and receive each other’s broadcasts.

By default, all switchports are in the Default VLAN, which is VLAN 1. It’s important to know that you cannot create, modify or delete VLAN 1.

If you want to group endpoints into different VLANs, the steps are:

  1. Create the VLAN
  2. Move the switchport(s) into the new VLAN

This process is straightforward. The key detail to remember is that switches associate learned MAC addresses with:

  • the switchport they were learned on, and
  • the VLAN that switchport is configured to be in.

Take the MAC address table example below. Notice that each MAC address entry includes a VLAN and the port where the MAC address was learned. That VLAN value tells you which VLAN the port belongs to.

(Image 040)

Image Title - MAC Address Table with VLANs

Whenever you see “VLAN 1,” that means the switchport is still using its default factory settings and hasn’t been moved into an administratively created VLAN.

Always remember: hosts can only learn the MAC addresses of other hosts within the same VLAN only. That’s because hosts use ARP to discover MAC addresses, and ARP relies on broadcast frames. Since broadcasts from one VLAN can’t reach another VLAN, hosts in a different VLAN never receive the ARP Request and therefore can’t reply.

This doesn’t mean hosts can’t communicate across VLANs. They can, but they need a router (or a Layer 3 switch that can perform routing). We’ll cover that in the routing chapters (IP connectivity).

Let’s take a look at how intra-VLAN communication works in two scenarios:

Scenario 1: Hosts that are connected to a single switch

If two hosts are connected to the same switch and their ports are configured in the same VLAN, they can communicate directly.

(Image 041)

Image Title - PC A and PC B. Same Switch, Same VLAN

However, if we were to create a new VLAN on SW1 (VLAN 2) and moved PC B into that VLAN, PC A and PC B would never be able to communicate with each other directly, because they would not be able to complete ARP.

(Image)

PC A and PC B not able to communicate on the same switch, different VLAN.

They would both have to be in the same VLAN to communicate directly. Either VLAN 1 or VLAN 2

Scenario 2 spanning across multiple switches

In another scenario, suppose Switch 1 is connected to Switch 2, and another host (PC C) is connected to Switch 2 in the same VLAN, which is a non-default VLAN. Let’s say that PC A, PC B and PC B have had their ports moved into VLAN 2.

(Image 042)

Image Title - SW1 with PC A and PC B. SW2 with PC C. Same VLAN

Would PC C on Switch 2 be able to communicate with PC A and PC B on Switch 1, given they are in the same VLAN?

(spoiler)

No.

The “why” comes from a principle you just saw.

By default, all ports on a Switch are in VLAN 1 , the Default VLAN

PC A and PC B can’t communicate with PC C because the link between Switch 1 and Switch 2 (their GigabitEthernet 0/23 ports) hasn’t been modified. It’s still configured in VLAN 1.

Meanwhile:

  • PC A and PC B on Switch 1 (GigabitEthernet 0/2 and GigabitEthernet 0/3) are configured in VLAN 2.
  • PC C on Switch 2 (GigabitEthernet 0/1) is also configured in VLAN 2.

Broadcasts only propagate within the VLAN they originate from. That means ARP Requests from PC A and PC B (in VLAN 2) can’t cross the inter-switch link, because the inter-switch ports (GigabitEthernet 0/23 on both switches) are still in VLAN 1 and therefore can’t send or receive VLAN 2 traffic.

So:

  • PC C never receives the ARP Requests.
  • PC A and PC B never learn PC C’s MAC address.
  • PC A and PC B can’t build Ethernet frames destined for PC C.

(Image 043)

Image Title - PC A and PC B Frames from VLAN 2 not making it across the inter-Switch link in VLAN 1

Virtual LANs (VLANs)

  • Segment broadcast domains — broadcasts stay within their originating VLAN
  • All ports default to VLAN 1 (the Default VLAN); VLAN 1 cannot be created, modified, or deleted
  • To add a VLAN: create it, then move switchport(s) into it
  • VLANs 1002–1005 are legacy reserved VLANs on Cisco switches; also not user-configurable

Broadcast Domains and MAC Learning

  • Hosts can only learn MAC addresses of hosts in the same VLAN (ARP relies on broadcasts)
  • Switch MAC address table entries include both the port and the VLAN the port belongs to
  • Cross-VLAN communication requires a router or Layer 3 switch

Intra-VLAN Communication Across Switches

  • Inter-switch links default to VLAN 1; VLAN traffic cannot cross a link configured in a different VLAN
  • Dedicating one physical link per VLAN is unscalable (up to 4096 VLANs exist; 0 and 4095 reserved)
  • Solution: configure inter-switch links as trunk ports

802.1Q Trunking

  • Trunk ports carry traffic for multiple VLANs over a single link via VLAN tagging
  • 802.1Q tag adds 4 bytes to a frame containing the VLAN ID; affects MTU considerations
  • Industry standard today; replaced Cisco’s proprietary ISL

Access Ports vs. Trunk Ports

  • Access ports: default mode; frames enter/exit untagged; port belongs to one VLAN
  • Trunk ports: tag outgoing frames with 802.1Q VLAN ID; used for switch-to-switch links
  • Endpoints without 802.1Q support should always connect to access ports

Native VLAN

  • Frames belonging to the Native VLAN exit a trunk port untagged
  • Default Native VLAN is VLAN 1 on all trunk ports
  • Native VLAN must match on both ends of a trunk link
    • Mismatch causes untagged frames to join the wrong VLAN on the receiving switch (“VLAN hopping”) — a security risk

Sign up for free to take 10 quiz questions on this topic

Previous
Next  | 2.4.1 Link redundancy and the need for Spanning-Tree (STP)
All rights reserved ©2016 - 2026 Achievable, Inc.

Virtual LANs (VLANs)

In the previous chapter, you learned how hosts discover the MAC address of the host they want to communicate with. They do this by sending an ARP Request in a broadcast frame. If the target host is online and connected to the LAN, it responds directly (unicast) to the sender with an ARP Reply that includes its MAC address.

Broadcasts are useful when you don’t know where a host is on the LAN. They also help switches learn which switchport a host is connected to. However, broadcasts come with an important drawback.

Imagine a very large LAN made up of many interconnected switches, with endpoint devices connected to most (or all) switchports.

What happens when a switch receives a broadcast frame (after learning the source MAC address)?

(spoiler)

The switch makes copies of the broadcast frame and floods it out of every port, except the port on which the frame was received.

This can significantly impact network performance. It also affects endpoints that receive these broadcast copies. Broadcasts are meant for everyone, so every host that receives a broadcast frame must interrupt its CPU (Central Processing Unit) to process the frame. Even if the IP packet inside the frame isn’t destined for that device’s IP address, the device still has to examine and process the frame.

On a large LAN with hundreds or thousands of endpoints, repetitive broadcasts can become a serious burden because every endpoint receives and processes every broadcast frame.

To address this, Ethernet switches introduced a feature that lets you group physical switchports into separate LANs called “Virtual LANs,” or VLANs.

Virtual LANs (VLANs)

A VLAN segments the broadcast boundary. The area in which broadcasts can propagate is called a Broadcast Domain.

By default:

  • All ports on a switch are in the same broadcast domain.
  • That means they’re all on the same LAN.

When you connect one switch to another, you extend the LAN and also extend the broadcast domain.

When you create a VLAN and move switchports into it, those switchports become part of a different broadcast domain. As a result:

  • Broadcasts propagated within one VLAN can’t reach another VLAN.
  • Broadcasts originating within a particular VLAN can only be seen or received by hosts within that same VLAN.

In short; “VLANs segment Broadcast Domains”

Historically, VLANs were especially helpful because endpoint CPUs were more sensitive to periodic broadcasts due to hardware limitations at the time. Modern CPUs are much more capable, but excessive broadcasts can still cause problems.

Today, VLANs are commonly used as a security and segmentation tool: they separate groups of endpoints so only the intended devices can communicate directly and receive each other’s broadcasts.

By default, all switchports are in the Default VLAN, which is VLAN 1. It’s important to know that you cannot create, modify or delete VLAN 1.

If you want to group endpoints into different VLANs, the steps are:

  1. Create the VLAN
  2. Move the switchport(s) into the new VLAN

This process is straightforward. The key detail to remember is that switches associate learned MAC addresses with:

  • the switchport they were learned on, and
  • the VLAN that switchport is configured to be in.

Take the MAC address table example below. Notice that each MAC address entry includes a VLAN and the port where the MAC address was learned. That VLAN value tells you which VLAN the port belongs to.

(Image 040)

Image Title - MAC Address Table with VLANs

Whenever you see “VLAN 1,” that means the switchport is still using its default factory settings and hasn’t been moved into an administratively created VLAN.

Always remember: hosts can only learn the MAC addresses of other hosts within the same VLAN only. That’s because hosts use ARP to discover MAC addresses, and ARP relies on broadcast frames. Since broadcasts from one VLAN can’t reach another VLAN, hosts in a different VLAN never receive the ARP Request and therefore can’t reply.

This doesn’t mean hosts can’t communicate across VLANs. They can, but they need a router (or a Layer 3 switch that can perform routing). We’ll cover that in the routing chapters (IP connectivity).

Let’s take a look at how intra-VLAN communication works in two scenarios:

Scenario 1: Hosts that are connected to a single switch

If two hosts are connected to the same switch and their ports are configured in the same VLAN, they can communicate directly.

(Image 041)

Image Title - PC A and PC B. Same Switch, Same VLAN

However, if we were to create a new VLAN on SW1 (VLAN 2) and moved PC B into that VLAN, PC A and PC B would never be able to communicate with each other directly, because they would not be able to complete ARP.

(Image)

PC A and PC B not able to communicate on the same switch, different VLAN.

They would both have to be in the same VLAN to communicate directly. Either VLAN 1 or VLAN 2

Scenario 2 spanning across multiple switches

In another scenario, suppose Switch 1 is connected to Switch 2, and another host (PC C) is connected to Switch 2 in the same VLAN, which is a non-default VLAN. Let’s say that PC A, PC B and PC B have had their ports moved into VLAN 2.

(Image 042)

Image Title - SW1 with PC A and PC B. SW2 with PC C. Same VLAN

Would PC C on Switch 2 be able to communicate with PC A and PC B on Switch 1, given they are in the same VLAN?

(spoiler)

No.

The “why” comes from a principle you just saw.

By default, all ports on a Switch are in VLAN 1 , the Default VLAN

PC A and PC B can’t communicate with PC C because the link between Switch 1 and Switch 2 (their GigabitEthernet 0/23 ports) hasn’t been modified. It’s still configured in VLAN 1.

Meanwhile:

  • PC A and PC B on Switch 1 (GigabitEthernet 0/2 and GigabitEthernet 0/3) are configured in VLAN 2.
  • PC C on Switch 2 (GigabitEthernet 0/1) is also configured in VLAN 2.

Broadcasts only propagate within the VLAN they originate from. That means ARP Requests from PC A and PC B (in VLAN 2) can’t cross the inter-switch link, because the inter-switch ports (GigabitEthernet 0/23 on both switches) are still in VLAN 1 and therefore can’t send or receive VLAN 2 traffic.

So:

  • PC C never receives the ARP Requests.
  • PC A and PC B never learn PC C’s MAC address.
  • PC A and PC B can’t build Ethernet frames destined for PC C.

(Image 043)

Image Title - PC A and PC B Frames from VLAN 2 not making it across the inter-Switch link in VLAN 1

Key points

Virtual LANs (VLANs)

  • Segment broadcast domains — broadcasts stay within their originating VLAN
  • All ports default to VLAN 1 (the Default VLAN); VLAN 1 cannot be created, modified, or deleted
  • To add a VLAN: create it, then move switchport(s) into it
  • VLANs 1002–1005 are legacy reserved VLANs on Cisco switches; also not user-configurable

Broadcast Domains and MAC Learning

  • Hosts can only learn MAC addresses of hosts in the same VLAN (ARP relies on broadcasts)
  • Switch MAC address table entries include both the port and the VLAN the port belongs to
  • Cross-VLAN communication requires a router or Layer 3 switch

Intra-VLAN Communication Across Switches

  • Inter-switch links default to VLAN 1; VLAN traffic cannot cross a link configured in a different VLAN
  • Dedicating one physical link per VLAN is unscalable (up to 4096 VLANs exist; 0 and 4095 reserved)
  • Solution: configure inter-switch links as trunk ports

802.1Q Trunking

  • Trunk ports carry traffic for multiple VLANs over a single link via VLAN tagging
  • 802.1Q tag adds 4 bytes to a frame containing the VLAN ID; affects MTU considerations
  • Industry standard today; replaced Cisco’s proprietary ISL

Access Ports vs. Trunk Ports

  • Access ports: default mode; frames enter/exit untagged; port belongs to one VLAN
  • Trunk ports: tag outgoing frames with 802.1Q VLAN ID; used for switch-to-switch links
  • Endpoints without 802.1Q support should always connect to access ports

Native VLAN

  • Frames belonging to the Native VLAN exit a trunk port untagged
  • Default Native VLAN is VLAN 1 on all trunk ports
  • Native VLAN must match on both ends of a trunk link
    • Mismatch causes untagged frames to join the wrong VLAN on the receiving switch (“VLAN hopping”) — a security risk

More from Administering Ethernet LANs

  • Wired network access