联系

网络中的 VLAN – CCNA 简易 VLAN 指南

首页 / 博客

6 分钟阅读
ZILL E ALI2025年7月2日思科网络

VLAN 网络 CCNA 指南:为何使用 VLAN?

本 VLAN 网络 CCNA 指南从 VLAN 实际解决的问题开始。

VLAN(虚拟局域网)让您 将物理网络划分为 多个 逻辑网络。与其购买更多交换机,您可以使用 VLAN 来:

  • 提升安全性
  • 组织部门
  • 减少不必要的流量

将 VLAN 视为 虚拟墙 位于物理网络内部。

什么是 VLAN?

VLANs networking CCNA guide diagram showing one switch split into VLAN 10 and VLAN 20 broadcast domains
VLAN 网络 CCNA 指南:一台物理交换机在逻辑上被划分为两个独立的广播域。

VLAN 是一种 逻辑设备组 在同一网络上,即使它们未物理连接到同一交换机或端口。

例如:

  • VLAN 10 – 会计
  • VLAN 20 – 人力资源
  • VLAN 30 – IT

每个 VLAN 的行为类似于其 独立子网.

为什么 VLAN 很重要?

VLAN 的优势:

  • ✅ 安全性: 隔离敏感设备(例如,人力资源、财务)
  • ✅ 性能: 减少广播流量
  • ✅ 可扩展性: 添加\/移除用户而无需重新布线
  • ✅ 简化管理: 基于逻辑的分组,而非物理布局

CCNA 考试中的 VLAN

VLAN 是 核心主题 在 CCNA 交换技术中。您必须了解:

  • VLAN creation and assignment
  • VLAN trunking
  • 跨 VLAN 路由
  • Default VLANs and native VLANs
  • VLAN IDs and tagging (802.1Q)

How to Configure a VLAN (Cisco CLI)

Let’s say you want to create VLAN 10 and assign it to a port.

✅ You just created VLAN 10 and assigned it to port Fa0/1.

VLAN Access vs Trunk Ports

类型 描述
Access Port Connects to end devices, carries traffic for one VLAN
Trunk Port Connects to another switch, carries multiple VLANs

Trunk ports tag traffic with VLAN IDs using the 802.1Q protocol.

Verifying VLANs on a Switch

Configuring a VLAN and confirming it actually works are two different skills, and the CCNA exam tests both. These three commands answer almost every “why isn’t this VLAN working” question:

Switch# show vlan brief
Switch# show interfaces trunk
Switch# show interfaces fastethernet 0/1 switchport

show vlan brief confirms the VLAN exists and which ports are assigned to it – a surprisingly common exam trap is a VLAN that was created but never actually assigned to the port you expect. show interfaces trunk confirms a trunk link is actually trunking and which VLANs are allowed across it – a trunk port that looks correctly configured but is not in the allowed VLAN list will silently drop that VLAN’s traffic. show interfaces ... switchport on a single port shows its exact mode (access or trunk), its assigned VLAN, and its native VLAN in one place.

VTP: A Word of Caution

VLAN Trunking Protocol (VTP) synchronizes VLAN databases across multiple switches automatically, which sounds convenient until a switch with a higher VTP revision number joins the network and silently overwrites every other switch’s VLAN database – including deleting VLANs that were never meant to be removed. This is a real, well-documented outage pattern, not a theoretical risk, and it is exactly why most production networks either run VTP in transparent mode (the switch keeps its own VLAN database and does not participate in synchronization) or avoid VTP entirely in favor of manually configuring VLANs on each switch:

Switch(config)# vtp mode transparent

For the CCNA exam, know how VTP works and what the three modes (server, client, transparent) do. For a real network, transparent mode or manual VLAN management is the safer default.

CCNA Packet Tracer Lab – VLANs in Action

Scenario:

You have two switches and two departments – Sales and HR.

  • VLAN 10 – Sales (PC0, PC1)
  • VLAN 20 – HR (PC2, PC3)

Steps:

  1. Create VLANs on both switches
  2. Assign access ports
  3. Configure a trunk link between switches
  4. Verify connectivity (same VLAN can ping, different VLANs can’t)

🧠 Tip: You’ll need 跨 VLAN 路由 if devices from different VLANs need to communicate.


🌐 Inter-VLAN Routing

Since VLANs are separate broadcast domains, devices in different VLANs can’t talk unless a router or Layer 3 switch routes traffic between them.

Inter-VLAN Routing via Router-on-a-Stick

📌 Each sub-interface handles one VLAN.

Native VLAN – What You Should Know

该 native VLAN is the untagged VLAN on a trunk port.

  • By default, it’s VLAN 1
  • Both sides of the trunk should use the same native VLAN
  • Security best practice: change the native VLAN to a different unused VLAN

Voice VLANs

A Cisco IP phone with a PC plugged into its back port needs two VLANs on one physical access port – a data VLAN for the PC and a separate voice VLAN for the phone’s own traffic, tagged even though the port is technically an access port. This is configured with a dedicated command, not a second access VLAN:

Switch(config-if)# switchport access vlan 10
Switch(config-if)# switchport voice vlan 150

The voice VLAN keeps phone traffic (which is latency-sensitive) logically separated from PC data traffic on the same cable run, without needing a second physical port or a second cable to the desk. This is a real, common CCNA 200-301 exam topic and a real-world configuration on almost every office deployment that uses Cisco IP phones.

Real-Life VLAN Use Case

Hospital Network Example:

  • VLAN 10: Doctors
  • VLAN 20: Admin
  • VLAN 30: Patient Monitoring
  • VLAN 40: Surveillance

Each group is logically separated, ensuring privacy and performance without buying extra switches.

✅ Routing Explained for CCNA

✅ Subnetting Guide

🌐 思科 VLAN 配置指南

🌐 802.1Q VLAN Tagging – IEEE Overview

FAQ – VLANs

What is a VLAN in simple terms?

A VLAN is a logical group of network devices that act as if they’re on the same network, even if physically separated.

Why are VLANs used?

To segment networks for better performance, security, and management.

What is VLAN tagging?

It’s the process of adding a VLAN ID to a frame (802.1Q) so trunk links can identify which VLAN the data belongs to.

How do VLANs communicate?

They need 跨 VLAN 路由, typically done by a router or Layer 3 switch.

What is the default VLAN?

It’s VLAN 1, assigned to all ports by default on Cisco switches. It’s best practice to move devices off VLAN 1 for security.

如果你更愿意有人一步步带你完成此过程,或者需要特定的 Packet Tracer 实验完成并解释,而不是自己摸索,请查看 CCNA 与 Packet Tracer 辅导 页面了解其工作原理。

作者

ZILL E ALI

拥有 MTCNA 和 MTCRE 认证的网络工程师、ISP 基础设施专家,Developer Zon 创始人。在此撰写关于 MikroTik、Cisco、ISP 基础设施以及偶尔的构建日志。

留下回复

本站使用 Akismet 来减少垃圾评论。了解您的评论数据如何被处理。