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
2.5.1 Introduction to Cisco's Internetworking Operating System (IOS)
2.5.2 MAC address table & VLAN configuration
2.5.3 The Voice VLAN and Layer 1 troubleshooting
2.5.4 How to configure Rapid PVST+ and Etherchannels
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.5.2 MAC address table & VLAN configuration
Achievable CCNA
2. Administering Ethernet LANs
2.5. Configuring Cisco Switches
Our CCNA course is currently in development and is a work-in-progress.

MAC address table & VLAN configuration

7 min read
Font
Discuss
Share
Feedback

Now that you know how to log into a Cisco switch CLI and navigate Cisco IOS, we can focus on configuring a few key protocols from Chapter 2 - specifically VLANs and trunking - and then verifying that those configurations are working.

How to view the MAC address table

A good first check on a switch is the MAC address table. It tells you whether the switch is learning MAC addresses from connected devices, and which interface and VLAN each MAC address is associated with.

The command to view the MAC address table is:

show mac address-table

(then press Enter)

(Image 084)

Image Title - Output of a SW1s MAC Address Table

In the output, you can see that endpoints are connected to GigabitEthernet 0/1 and GigabitEthernet 0/2 on SW1 because the switch is learning their MAC addresses.

You can also see:

  • The ports are currently in VLAN 1 (the default VLAN), which means GigabitEthernet 0/1 and 0/2 are still using their default VLAN settings.
Sidenote
MAC address formats

MAC addresses can be displayed in various distinct formats. Up until this point you have been exposed to MAC addresses using a double colon (:) as a delimiter. For example:

52:54:00:E8:59:3D

But on Cisco devices (routers and switches), MAC addresses are written with a period (.) as a delimiter:

5254.00e8.593d

This one is the most important to be familiar with, as you will be seeing them a lot on Cisco switches. You may also see MAC addresses displayed with a hyphen (-) as a delimiter, like on Windows computers:

52-54-00-E8-59-3D

These all refer to the same MAC address, just a different format to display them.

If SW1 doesn’t receive another frame from one of those hosts for 300 seconds (5 minutes), it removes that MAC address entry from the MAC table.

In order to view the configured “age” timer for each MAC address entry, you would enter the following command:

show mac address-table aging-time

(Image)

MAC Table Aging Timer

Now that we can see SW1 is learning MAC addresses, let’s place the two hosts into VLAN 2.

Configuring and verifying VLANs

Next, we’ll configure a VLAN and move switchports into it.

If we wanted to place the two hosts into VLAN 2, what are the two steps that we must do on SW1 in order to make that happen?

(spoiler)
  1. Create VLAN 2 on SW1
  2. Move GigabitEthernet 0/1 and GigabitEthernet 0/2 into VLAN 2

Before creating VLAN 2, check the VLAN database on SW1. This shows which VLANs exist and which ports belong to each VLAN.

Use:

show vlan

(Image 085)

Image Title - Output of a SW1s VLAN database

As shown in the output, only the default VLAN (VLAN 1) exists, and all interfaces on SW1 are currently members of VLAN 1.

You’ll also see Reserved VLANs (1002 - 1005), which are not supported in Ethernet-based Networks.

In order to create VLAN 2, which mode do we have to go into first?

(spoiler)

Global Configuration mode

Enter global configuration mode:

configure terminal

Then create VLAN 2:

vlan 2

and press Enter.

For example:

SW1(config)#vlan 2

Every time you type in a command in Cisco IOS, you must hit the enter key in order for the Switch or Router to process the command.

After you create the VLAN, IOS places you into a sub-configuration mode called VLAN configuration mode. You’ll see the prompt change to:

SW1(config-vlan)#

From here, you can optionally name the VLAN (a name isn’t required for the VLAN to function).

For example:

SW1(config-vlan)# name DATA-VLAN

This replaces the default, auto-generated VLAN name with a more descriptive one.

The key thing to note here is that; VLAN configuration changes do not take effect until you exit out of the VLAN Configuration sub-configuration mode. So to do that, we simply must type in:

exit

which will take us back to the Global Configuration mode.

(Image 086)

Image Title - Creating VLAN 2 on SW1 and giving it a name

If you ever need to undo a configuration command, (perhaps you entered it by mistake, or you entered in the wrong value by accident), you can simply negate the command by typing “no” in front of the same configuration that you previously entered. For example, if you wanted to delete vlan 2 for any reason, in Global Configuration mode, you would type in:

SW1(config)# no vlan 2

And hit the enter key. Typing in “no” in front of a configuration command essentially removes (undoes) the command after it was entered. It’s sort of like hitting the “undo” button in a document editor like Microsoft Word. This works with most configuration commands.

Run “show vlan” again to verify that VLAN 2 exists and has the name you assigned:

(Image 087)

Image Title - Verifying the creation of VLAN 2 on SW1

Moving switchports into VLAN 2

Now move GigabitEthernet 0/1 and GigabitEthernet 0/2 into VLAN 2.

Start by entering interface configuration mode for GigabitEthernet 0/1:

interface gigabitethernet 0/1

(Image 088)

Image Title - Entering the Interface Configuration mode for the GigabitEthernet 0/1 interface

At this point, the goal is to make GigabitEthernet 0/1 an access port (a port that belongs to a single VLAN) and then assign it to VLAN 2.

First, set the port to access mode:

switchport mode access

(Image 089)

Image Title - Making interface GigabitEthernet 0/1 an Access port.

Then assign it to VLAN 2:

switchport access vlan 2

(Image 090)

Image Title - Moving interface GigabitEthernet 0/1 into VLAN 2.

Verify the change with:

show vlan

(Image 090)

Image Title - show vlan output verifying that GigabitEthernet 0/1 is now in VLAN 2

Next, type exit to return to global configuration mode, and repeat the same steps for GigabitEthernet 0/2.

The sequence of commands is:

SW1(config)#interface gigabitethernet 0/2 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 2

(Image 091)

Image Title - Moving interface GigabitEthernet 0/2 into VLAN 2.

Now when you check the VLAN database, both GigabitEthernet 0/1 and GigabitEthernet 0/2 should appear as members of VLAN 2:

(Image 092)

Image Title - show vlan output verifying that both GigabitEthernet 0/1 and GigabitEthernet0/2 are now in VLAN 2

Checking the MAC address table after the VLAN change

Now check the MAC address table again. You should see the hosts connected to GigabitEthernet 0/1 and GigabitEthernet 0/2 being learned in VLAN 2.

(Image 093)

Image Title - hosts connected to GigabEthernet0/1 and GigabitEthernet0/2 being learned in VLAN 2 in the MAC Table.

If you need to review the underlying concepts, refer back to Chapter 2.2.2 Address Resolution Protocol (ARP) and Ethernet Switching, Chapter 2.3 VLANs and Trunking, and Chapter 2.5.1 Introduction to Cisco’s Internetworking Operating System (IOS).

Viewing the MAC Address Table

  • show mac address-table – shows learned MACs, associated interface, and VLAN
  • Default VLAN for each switchport is VLAN 1 until reassigned
  • show mac address-table aging-time – shows entry timeout (default 300 sec/5 min)
  • MAC address formats: Cisco uses 3 sets of four hexadecimal characters, separated by periods as delimiters (for example: 5254.00e8.593d); also seen with colons or hyphens

Configuring VLANs

  • Two steps to move hosts into new VLAN: create the VLAN, then assign ports to it
  • show vlan – displays VLAN database and port memberships
  • Reserved VLANs: 1002–1005 (not usable in Ethernet networks)
  • Create VLAN: configure terminal → vlan 2 (enters VLAN config mode, prompt (config-vlan)#)
  • Optional naming: name DATA-VLAN
  • Must exit VLAN config mode for changes to take effect
  • Undo commands by prefixing with no (e.g., no vlan 2)

Assigning Switchports to VLANs

  • Enter interface mode: interface gigabitethernet 0/1
  • Set as access port: switchport mode access
  • Assign VLAN: switchport access vlan 2
  • Repeat for each interface (e.g., Gi0/2)
  • Verify with show vlan
  • After VLAN change, show mac address-table reflects new VLAN assignment

Trunking Basics

  • Same VLAN/broadcast domain = no default gateway needed to communicate
  • Trunk link allows multiple VLANs to cross a single link between switches
  • Configure trunk on interface (e.g., Gi0/3):
    • switchport trunk encapsulation dot1q (802.1Q is industry standard; ISL is legacy Cisco proprietary)
    • switchport mode trunk

Verifying Trunks

  • show interface trunk – shows trunking ports and allowed VLANs
  • Trunk ports do NOT appear in show vlan output

Allowing Specific VLANs on Trunks

  • Default: all VLANs (1–4094) allowed
  • Restrict VLANs: switchport trunk allowed vlan [ID]
    • Range: dash (e.g., 2-10)
    • List: comma (e.g., 2,4,10,15)
  • Re-entering this command without add/remove overwrites the entire list
  • Add to list: switchport trunk allowed vlan add [ID]
  • Remove from list: switchport trunk allowed vlan remove [ID]
  • This process is called manual VLAN pruning

Changing the Native VLAN

  • Native VLAN traffic sent untagged on 802.1Q trunk
  • Create new VLAN (e.g., VLAN 99) globally
  • Apply to trunk interface: switchport trunk native vlan 99

Checking Switchport Operational State

  • show interface [interface] switchport – shows config vs. actual state
  • Key fields:
    • Administrative Mode – configured setting
    • Operational Mode – actual current behavior
    • Trunking Native Mode VLAN – current native VLAN
    • Trunking VLANs Enabled – allowed VLAN list

Testing Connectivity Across Trunk

  • Ping between hosts on different switches, same VLAN, succeeds via trunk
  • First ping may fail due to missing ARP entry (normal); subsequent pings should succeed
  • Verify Layer 2 learning via ARP:
    • Windows: arp -a
    • Linux: ip neigh show (or arp, cat /proc/net/arp)
  • Confirms ARP resolution and Layer 2 connectivity between hosts in the same VLAN regardless of being connected to the same switch or different switches (via trunk link)

Key Command Reference

  • show mac address-table
  • vlan [ID] / name [VLAN name]
  • interface [name][slot]/[port]
  • switchport mode access / switchport access vlan [ID]
  • switchport trunk encapsulation dot1q / switchport mode trunk
  • show interface trunk
  • switchport trunk allowed vlan [ID/add/remove]
  • switchport trunk native vlan [ID]
  • show interface [name][slot]/[port] switchport

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

Previous
Next  | 2.5.3 The Voice VLAN and Layer 1 troubleshooting
All rights reserved ©2016 - 2026 Achievable, Inc.

MAC address table & VLAN configuration

Now that you know how to log into a Cisco switch CLI and navigate Cisco IOS, we can focus on configuring a few key protocols from Chapter 2 - specifically VLANs and trunking - and then verifying that those configurations are working.

How to view the MAC address table

A good first check on a switch is the MAC address table. It tells you whether the switch is learning MAC addresses from connected devices, and which interface and VLAN each MAC address is associated with.

The command to view the MAC address table is:

show mac address-table

(then press Enter)

(Image 084)

Image Title - Output of a SW1s MAC Address Table

In the output, you can see that endpoints are connected to GigabitEthernet 0/1 and GigabitEthernet 0/2 on SW1 because the switch is learning their MAC addresses.

You can also see:

  • The ports are currently in VLAN 1 (the default VLAN), which means GigabitEthernet 0/1 and 0/2 are still using their default VLAN settings.
Sidenote
MAC address formats

MAC addresses can be displayed in various distinct formats. Up until this point you have been exposed to MAC addresses using a double colon (:) as a delimiter. For example:

52:54:00:E8:59:3D

But on Cisco devices (routers and switches), MAC addresses are written with a period (.) as a delimiter:

5254.00e8.593d

This one is the most important to be familiar with, as you will be seeing them a lot on Cisco switches. You may also see MAC addresses displayed with a hyphen (-) as a delimiter, like on Windows computers:

52-54-00-E8-59-3D

These all refer to the same MAC address, just a different format to display them.

If SW1 doesn’t receive another frame from one of those hosts for 300 seconds (5 minutes), it removes that MAC address entry from the MAC table.

In order to view the configured “age” timer for each MAC address entry, you would enter the following command:

show mac address-table aging-time

(Image)

MAC Table Aging Timer

Now that we can see SW1 is learning MAC addresses, let’s place the two hosts into VLAN 2.

Configuring and verifying VLANs

Next, we’ll configure a VLAN and move switchports into it.

If we wanted to place the two hosts into VLAN 2, what are the two steps that we must do on SW1 in order to make that happen?

(spoiler)
  1. Create VLAN 2 on SW1
  2. Move GigabitEthernet 0/1 and GigabitEthernet 0/2 into VLAN 2

Before creating VLAN 2, check the VLAN database on SW1. This shows which VLANs exist and which ports belong to each VLAN.

Use:

show vlan

(Image 085)

Image Title - Output of a SW1s VLAN database

As shown in the output, only the default VLAN (VLAN 1) exists, and all interfaces on SW1 are currently members of VLAN 1.

You’ll also see Reserved VLANs (1002 - 1005), which are not supported in Ethernet-based Networks.

In order to create VLAN 2, which mode do we have to go into first?

(spoiler)

Global Configuration mode

Enter global configuration mode:

configure terminal

Then create VLAN 2:

vlan 2

and press Enter.

For example:

SW1(config)#vlan 2

Every time you type in a command in Cisco IOS, you must hit the enter key in order for the Switch or Router to process the command.

After you create the VLAN, IOS places you into a sub-configuration mode called VLAN configuration mode. You’ll see the prompt change to:

SW1(config-vlan)#

From here, you can optionally name the VLAN (a name isn’t required for the VLAN to function).

For example:

SW1(config-vlan)# name DATA-VLAN

This replaces the default, auto-generated VLAN name with a more descriptive one.

The key thing to note here is that; VLAN configuration changes do not take effect until you exit out of the VLAN Configuration sub-configuration mode. So to do that, we simply must type in:

exit

which will take us back to the Global Configuration mode.

(Image 086)

Image Title - Creating VLAN 2 on SW1 and giving it a name

If you ever need to undo a configuration command, (perhaps you entered it by mistake, or you entered in the wrong value by accident), you can simply negate the command by typing “no” in front of the same configuration that you previously entered. For example, if you wanted to delete vlan 2 for any reason, in Global Configuration mode, you would type in:

SW1(config)# no vlan 2

And hit the enter key. Typing in “no” in front of a configuration command essentially removes (undoes) the command after it was entered. It’s sort of like hitting the “undo” button in a document editor like Microsoft Word. This works with most configuration commands.

Run “show vlan” again to verify that VLAN 2 exists and has the name you assigned:

(Image 087)

Image Title - Verifying the creation of VLAN 2 on SW1

Moving switchports into VLAN 2

Now move GigabitEthernet 0/1 and GigabitEthernet 0/2 into VLAN 2.

Start by entering interface configuration mode for GigabitEthernet 0/1:

interface gigabitethernet 0/1

(Image 088)

Image Title - Entering the Interface Configuration mode for the GigabitEthernet 0/1 interface

At this point, the goal is to make GigabitEthernet 0/1 an access port (a port that belongs to a single VLAN) and then assign it to VLAN 2.

First, set the port to access mode:

switchport mode access

(Image 089)

Image Title - Making interface GigabitEthernet 0/1 an Access port.

Then assign it to VLAN 2:

switchport access vlan 2

(Image 090)

Image Title - Moving interface GigabitEthernet 0/1 into VLAN 2.

Verify the change with:

show vlan

(Image 090)

Image Title - show vlan output verifying that GigabitEthernet 0/1 is now in VLAN 2

Next, type exit to return to global configuration mode, and repeat the same steps for GigabitEthernet 0/2.

The sequence of commands is:

SW1(config)#interface gigabitethernet 0/2 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 2

(Image 091)

Image Title - Moving interface GigabitEthernet 0/2 into VLAN 2.

Now when you check the VLAN database, both GigabitEthernet 0/1 and GigabitEthernet 0/2 should appear as members of VLAN 2:

(Image 092)

Image Title - show vlan output verifying that both GigabitEthernet 0/1 and GigabitEthernet0/2 are now in VLAN 2

Checking the MAC address table after the VLAN change

Now check the MAC address table again. You should see the hosts connected to GigabitEthernet 0/1 and GigabitEthernet 0/2 being learned in VLAN 2.

(Image 093)

Image Title - hosts connected to GigabEthernet0/1 and GigabitEthernet0/2 being learned in VLAN 2 in the MAC Table.

If you need to review the underlying concepts, refer back to Chapter 2.2.2 Address Resolution Protocol (ARP) and Ethernet Switching, Chapter 2.3 VLANs and Trunking, and Chapter 2.5.1 Introduction to Cisco’s Internetworking Operating System (IOS).

Key points

Viewing the MAC Address Table

  • {`show mac address-table`} – shows learned MACs, associated interface, and VLAN
  • Default VLAN for each switchport is VLAN 1 until reassigned
  • {`show mac address-table aging-time`} – shows entry timeout (default 300 sec/5 min)
  • MAC address formats: Cisco uses 3 sets of four hexadecimal characters, separated by periods as delimiters (for example: 5254.00e8.593d); also seen with colons or hyphens

Configuring VLANs

  • Two steps to move hosts into new VLAN: create the VLAN, then assign ports to it
  • {`show vlan`} – displays VLAN database and port memberships
  • Reserved VLANs: 1002–1005 (not usable in Ethernet networks)
  • Create VLAN: {`configure terminal`} → {`vlan 2`} (enters VLAN config mode, prompt {`(config-vlan)#`})
  • Optional naming: {`name DATA-VLAN`}
  • Must {`exit`} VLAN config mode for changes to take effect
  • Undo commands by prefixing with {`no`} (e.g., {`no vlan 2`})

Assigning Switchports to VLANs

  • Enter interface mode: {`interface gigabitethernet 0/1`}
  • Set as access port: {`switchport mode access`}
  • Assign VLAN: {`switchport access vlan 2`}
  • Repeat for each interface (e.g., Gi0/2)
  • Verify with {`show vlan`}
  • After VLAN change, {`show mac address-table`} reflects new VLAN assignment

Trunking Basics

  • Same VLAN/broadcast domain = no default gateway needed to communicate
  • Trunk link allows multiple VLANs to cross a single link between switches
  • Configure trunk on interface (e.g., Gi0/3):
    • {`switchport trunk encapsulation dot1q`} (802.1Q is industry standard; ISL is legacy Cisco proprietary)
    • {`switchport mode trunk`}

Verifying Trunks

  • {`show interface trunk`} – shows trunking ports and allowed VLANs
  • Trunk ports do NOT appear in {`show vlan`} output

Allowing Specific VLANs on Trunks

  • Default: all VLANs (1–4094) allowed
  • Restrict VLANs: {`switchport trunk allowed vlan [ID]`}
    • Range: dash (e.g., {`2-10`})
    • List: comma (e.g., {`2,4,10,15`})
  • Re-entering this command without {`add`}/{`remove`} overwrites the entire list
  • Add to list: {`switchport trunk allowed vlan add [ID]`}
  • Remove from list: {`switchport trunk allowed vlan remove [ID]`}
  • This process is called manual VLAN pruning

Changing the Native VLAN

  • Native VLAN traffic sent untagged on 802.1Q trunk
  • Create new VLAN (e.g., VLAN 99) globally
  • Apply to trunk interface: {`switchport trunk native vlan 99`}

Checking Switchport Operational State

  • {`show interface [interface] switchport`} – shows config vs. actual state
  • Key fields:
    • Administrative Mode – configured setting
    • Operational Mode – actual current behavior
    • Trunking Native Mode VLAN – current native VLAN
    • Trunking VLANs Enabled – allowed VLAN list

Testing Connectivity Across Trunk

  • Ping between hosts on different switches, same VLAN, succeeds via trunk
  • First ping may fail due to missing ARP entry (normal); subsequent pings should succeed
  • Verify Layer 2 learning via ARP:
    • Windows: {`arp -a`}
    • Linux: {`ip neigh show`} (or {`arp`}, {`cat /proc/net/arp`})
  • Confirms ARP resolution and Layer 2 connectivity between hosts in the same VLAN regardless of being connected to the same switch or different switches (via trunk link)

Key Command Reference

  • {`show mac address-table`}
  • {`vlan [ID]`} / {`name [VLAN name]`}
  • {`interface [name][slot]/[port]`}
  • {`switchport mode access`} / {`switchport access vlan [ID]`}
  • {`switchport trunk encapsulation dot1q`} / {`switchport mode trunk`}
  • {`show interface trunk`}
  • {`switchport trunk allowed vlan [ID/add/remove]`}
  • {`switchport trunk native vlan [ID]`}
  • {`show interface [name][slot]/[port] switchport`}

More from Configuring Cisco Switches

  • Introduction to Cisco's Internetworking Operating System (IOS)
  • The Voice VLAN and Layer 1 troubleshooting
  • How to configure Rapid PVST+ and Etherchannels