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

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 20

An 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.

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.

MethodHow it worksWhen to use it
One router port per VLANEach 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-stickOne 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 switchip 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 shutdown

An 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 briefEvery VLAN, its name and status, and the access ports in it. Trunk ports are not listed here.
show interfaces switchportPer port: administrative and operational mode, access VLAN, voice VLAN, native VLAN and trunking VLANs.
show interfaces statusEvery port with its VLAN (or trunk), speed, duplex and connected state.
show ip interface briefSVIs and their up/down state, with addresses.
show mac address-table vlan 10The MAC addresses learned in one VLAN and the ports behind them.

Exam traps

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 30 shows 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