2.1 Configure and verify VLANs that span several switches
CCNA 200-301 v1.1 · 2.0 Network Access
A VLAN splits one switch into several separate broadcast domains. Hosts in VLAN 10 never see the broadcasts of VLAN 20, even on the same switch, and they need a router or a Layer 3 switch to talk to each other. For the CCNA you configure access ports for data and voice, know what is special about VLAN 1, and route between VLANs.
What you must know
- Create and name a VLAN, put an access port in it, and add a voice VLAN for an IP phone.
- Explain why VLAN 1 is the default, what still runs in it, and why unused ports belong in an unused, shut VLAN.
- Compare the three ways to route between VLANs: one router port per VLAN, router-on-a-stick and SVIs on a Layer 3 switch.
- Bring an SVI up/up and say the three conditions it needs.
- Read
show vlan briefandshow interfaces switchportto prove which VLAN a port is in.
Access ports for data and voice
An access port belongs to exactly one data VLAN and sends and receives untagged frames. The host on it does not know VLANs exist; the switch adds the VLAN internally and keeps the frame inside that VLAN.
vlan 10
name USERS
vlan 20
name VOICE
!
interface GigabitEthernet0/1
switchport mode access
switchport access vlan 10
!
interface GigabitEthernet0/2
switchport mode access
switchport access vlan 10
switchport voice vlan 20An IP phone has a small switch inside: the PC plugs into the phone and the phone plugs into the switch. With switchport voice vlan 20 the switch tells the phone through CDP (or LLDP-MED) to tag its own voice frames with VLAN 20, while the PC's frames stay untagged in data VLAN 10. The port is still an access port; show interfaces switchport lists both VLANs.
The default VLAN
Every port starts in VLAN 1, the default VLAN. It cannot be renamed or deleted. Control protocols such as CDP, VTP, DTP and PAgP still send their frames in VLAN 1 on trunks, and VLAN 1 is the default native VLAN, so an attacker on an unconfigured port lands in the same VLAN as the switches' own traffic.
- Put every user port in a deliberate VLAN, not VLAN 1.
- Move unused ports to an unused VLAN and
shutdownthem. - Manage the switch through its own management VLAN SVI, not
interface vlan 1. - VLANs 1002 to 1005 are reserved for old Token Ring and FDDI and cannot be deleted either. Normal VLANs are 1 to 1005; extended VLANs are 1006 to 4094.
Inter-VLAN connectivity
Each VLAN is its own IP subnet, so traffic between VLANs must be routed. The hosts send it to their default gateway, which must have an address in their VLAN.
| Method | How it works | When to use it |
|---|---|---|
| One router port per VLAN | Each VLAN gets its own access link to a separate router interface. | Almost never: it burns a router and switch port per VLAN. |
| Router-on-a-stick | One trunk to the router, one subinterface per VLAN with encapsulation dot1Q <vlan>. | Small sites with a router and a Layer 2 switch. |
| SVIs on a Layer 3 switch | ip routing, then interface vlan <n> with an address per VLAN. The switch routes in hardware. | Campus networks: the usual answer. |
ip routing
!
interface Vlan10
ip address 10.1.10.1 255.255.255.0
no shutdown
interface Vlan20
ip address 10.1.20.1 255.255.255.0
no shutdownAn SVI is up/up only when the VLAN exists in the VLAN database, at least one port in that VLAN (an access port or a trunk carrying it) is up and forwarding, and the SVI is not shut down. Forget ip routing and the SVIs answer pings from their own VLAN but the switch will not route between them.
Commands
show vlan brief | Every VLAN, its name and status, and the access ports in it. Trunk ports are not listed here. |
show interfaces switchport | Per port: administrative and operational mode, access VLAN, voice VLAN, native VLAN and trunking VLANs. |
show interfaces status | Every port with its VLAN (or trunk), speed, duplex and connected state. |
show ip interface brief | SVIs and their up/down state, with addresses. |
show mac address-table vlan 10 | The MAC addresses learned in one VLAN and the ports behind them. |
Exam traps
show vlan briefdoes not show trunk ports. A port missing from the list is often a trunk, not a fault.switchport access vlan 30on a VLAN that does not exist creates the VLAN for you ("% Access VLAN does not exist. Creating vlan 30").- Delete a VLAN and its access ports stay assigned to it but go inactive: their hosts lose connectivity until the VLAN is created again.
- An SVI stays down/down if no port in its VLAN is up, even when its configuration is perfect.
- The voice VLAN is configured on an access port. The phone tags voice frames; the switch port is not a trunk.
Check yourself
- PC1 is in VLAN 10 and PC3 in VLAN 20 on the same switch. Why can they not ping each other?
- They are in different broadcast domains and subnets. Traffic between them must go through a router or an SVI on a Layer 3 switch, and each PC needs a default gateway in its own VLAN.
interface vlan 30shows down/down. The VLAN exists. What else do you check?- That at least one port in VLAN 30 (an access port or a trunk carrying it) is up and forwarding, and that the SVI is not administratively shut down.
- Which VLAN does a phone's voice traffic use, and is it tagged?
- The voice VLAN set with
switchport voice vlan. The phone tags those frames with 802.1Q; the PC behind the phone sends untagged frames in the access VLAN. - Why move unused ports to an unused VLAN and shut them?
- So that a device plugged into a spare port lands nowhere useful, instead of in VLAN 1 with the switches' control traffic and management.
Labs
Try it live: VLANs, trunks and inter-VLAN routing (SVIs)
More topics in 2.0 Network Access
- 2.3 Configure and verify CDP and LLDP neighbor discovery
- 2.4 Configure and verify LACP EtherChannels at Layer 2 and Layer 3
- 2.5 Interpret how Rapid PVST+ spanning tree operates
- 2.6 Describe how Cisco wireless is architected and what each AP mode does
- 2.7 Describe how APs, WLCs and switch ports are physically connected, including LAG
- 2.8 Describe ways to manage network devices: console, Telnet, SSH, HTTP(S), TACACS+/RADIUS, cloud
- 2.9 Interpret the WLC GUI settings that control client connectivity: WLANs, security, QoS, advanced