CCNA Fundamentals and Core Concepts
Network Access
Segmenting Your Network with VLANs
Imagine a busy office where everyone is connected to the same network. The accounting department can see the marketing team's files, and sales traffic slows down everyone's connection. It's chaotic and insecure. Virtual Local Area Networks, or VLANs, solve this by carving one physical network into multiple, separate logical networks.
Think of a single switch as an apartment building. Without VLANs, it's one giant, open-floor loft where everyone lives in the same space. With VLANs, you build walls to create separate apartments. Devices in one VLAN can talk to each other, but they are completely isolated from devices in other VLANs, even if they're all plugged into the same physical switch.
Segmentation divides a network into smaller, isolated zones. This improves security by containing threats and boosts performance by reducing unnecessary broadcast traffic.
Each VLAN is a distinct broadcast domain. This means that a broadcast message sent from a device in VLAN 10 will only be heard by other devices in VLAN 10. Devices in VLAN 20 will never see it. This is how VLANs reduce network chatter and keep traffic contained to the departments where it belongs.
Configuring a VLAN is straightforward. You create the VLAN on the switch and then assign specific ports to it. Any device plugged into a port assigned to VLAN 10 automatically becomes a member of VLAN 10.
Connecting VLANs Across Switches
What happens when the Sales team grows and you need to add a second switch? You'll have Sales staff on two different physical switches, but they still need to be on the same logical network (VLAN 10).
To solve this, you need a way to pass traffic from multiple VLANs over a single link between the switches. This is called trunking. A port configured as a trunk can carry traffic for any and all VLANs. In contrast, a regular port, called an access port, belongs to only one VLAN.
But if traffic from VLAN 10 and VLAN 20 is flowing over the same trunk cable, how does the second switch know which traffic belongs to which VLAN? The answer is VLAN tagging. The standard protocol for this is IEEE 802.1Q. When an Ethernet frame leaves a switch via a trunk port, a small "tag" is added to its header. This tag contains the VLAN ID, like a label that says "This belongs to VLAN 10." The receiving switch reads the tag, knows which VLAN the frame belongs to, and forwards it only to the ports in that VLAN.
// Basic Cisco switch configuration for a trunk port
Switch(config)# interface GigabitEthernet0/1
// Set the port mode to trunk
Switch(config-if)# switchport mode trunk
// Specify the encapsulation protocol (802.1Q is the standard)
Switch(config-if)# switchport trunk encapsulation dot1q
// Optionally, specify which VLANs are allowed on the trunk
Switch(config-if)# switchport trunk allowed vlan 10,20,30
Routing Between VLANs
VLANs are great for isolation, but sometimes you need different VLANs to communicate. For example, maybe the Sales team needs to access a server in the Engineering VLAN. Since switches can't forward traffic between different VLANs, this job falls to a router.
A common and efficient way to set this up is called inter-VLAN routing, often using a configuration known as "router-on-a-stick." Instead of using one physical router port for each VLAN, you use a single physical port configured as a trunk link to the switch. The router then creates virtual sub-interfaces, one for each VLAN it needs to route.
When the PC in VLAN 10 wants to send a packet to the PC in VLAN 20, it sends it to its default gateway, which is the router's virtual sub-interface for VLAN 10. The packet travels up the trunk link, tagged with VLAN 10. The router accepts the packet on its VLAN 10 sub-interface, makes a routing decision, and sends the packet back down the same trunk link from its VLAN 20 sub-interface, now tagged for VLAN 20. The switch receives the tagged packet and forwards it to the PC in VLAN 20.
Adding Wireless Access
Wireless LANs (WLANs) are now a standard part of nearly every network. Integrating them into a VLAN architecture is crucial for maintaining security and organization. A modern wireless access point (AP) can broadcast multiple Service Set Identifiers (SSIDs), which are the network names you see when you connect to Wi-Fi.
Each SSID can be mapped to a specific VLAN. For example, you could have an SSID named "Corporate" that maps to VLAN 10 for employees, and another SSID named "Guest-WiFi" that maps to a separate, restricted VLAN 50. When a user connects to "Guest-WiFi," all their traffic is automatically placed on VLAN 50, keeping it completely separate from the internal corporate network.
Of course, wireless security is paramount. Always use the strongest available encryption protocol, which is currently WPA3 (Wi-Fi Protected Access 3). If WPA3 is not an option, WPA2 is the next best choice. Avoid using older, insecure protocols like WEP or the original WPA, as they are vulnerable to attack.
What is the primary function of a VLAN?
A network administrator needs to connect two switches. The link between them must carry traffic for VLAN 10 (Sales) and VLAN 20 (Marketing). How should the connecting ports on each switch be configured?
By combining VLANs, trunking, inter-VLAN routing, and secure WLANs, you can build a network that is segmented, efficient, and secure, controlling exactly how and where data flows.
