This browser is too old to run Achievable.

Update it, or open this page in a current version of Chrome, Safari, Firefox or Edge. On an iPhone or iPad, update iOS: every browser there runs on the version of Safari that comes with it.

Achievable logoAchievable logo
CCNA
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Resources
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

14 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)

SW1 output of show mac address-table lists two dynamic entries in VLAN 1: MAC 5254.0013.003b on port Gi0/2 and MAC 5254.00e8.593d on port Gi0/1, totaling 2 MAC addresses.
show mac address-table
Achievable
 

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

CLI output of show mac address-table aging-time on SW1, showing Global Aging Time set to 300 seconds, with no per-VLAN overrides listed.
show mac address-table aging-time
Achievable
 

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

SW1 show vlan output: VLAN 1 default is active with ports Gi0/0-Gi0/3; VLANs 1002-1005 (fddi-default, token-ring-default, fddinet-default, trnet-default) are act/unsup with no ports assigned, each showing MTU 1500 and no remote SPAN VLANs configured.
Output of SW1s VLAN database
Achievable
 

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.

Terminal session on SW1: configure terminal, then vlan 2, name DATA-VLAN, and exit, creating VLAN 2 with the name DATA-VLAN.
Creating VLAN 2 on SW1 and giving it a name
Achievable

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:

SW1 output of show vlan, highlighting VLAN 2 named DATA-VLAN as active with no ports assigned, alongside default VLAN 1 (active, ports Gi0/0-3) and unused VLANs 1002-1005 listed as act/unsup.
Verifying the creation of VLAN 2 on SW1
Achievable

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

Terminal session on SW1: after entering global config mode, the command interface gigabitethernet 0/1 is run, changing the prompt to SW1(config-if)#, indicating interface configuration mode.
Entering the interface configuration mode for the GigabitEthernet 0/1 interface
Achievable

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

CLI commands on SW1: interface gigabitethernet 0/1, then switchport mode access, entered in interface configuration mode.
Making interface GigabitEthernet 0/1 an access port
Achievable
 

Then assign it to VLAN 2:

switchport access vlan 2

CLI commands on SW1: interface gigabitethernet 0/1, then switchport mode access, then switchport access vlan 2, assigning that interface to VLAN 2 in access mode.
Moving interface GigabitEthernet 0/1 into VLAN 2
Achievable
 

Verify the change with:

show vlan

SW1 show vlan output: VLAN 1 default is active on ports Gi0/0, Gi0/2, Gi0/3; VLAN 2 DATA-VLAN is active with port Gi0/1 highlighted, confirming Gi0/1 belongs to VLAN 2.
show vlan output verifying that GigabitEthernet 0/1 is now in VLAN 2
Achievable
 

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

CLI session on SW1 entering global config, then interface GigabitEthernet0/2 config mode, setting switchport mode access and switchport access vlan 2.
Moving interface GigabitEthernet 0/2 into VLAN 2
Achievable
 

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

SW1 show vlan output: VLAN 1 default is active with ports Gi0/0 and Gi0/3; VLAN 2 DATA-VLAN is active with ports Gi0/1 and Gi0/2 highlighted, confirming those ports are assigned to VLAN 2.
show vlan output verifying that both GigabitEthernet 0/1 and GigabitEthernet0/2 are now in VLAN 2
Achievable

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.

SW1 output of show mac address-table lists two dynamic entries in VLAN 2: MAC 5254.0013.003b on port Gi0/2 and MAC 5254.00e8.593d on port Gi0/1, totaling 2 MAC addresses.
Hosts connected to GigabEthernet0/1 and GigabitEthernet0/2 being learned in VLAN 2 in the MAC Table
Achievable
 

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.6.1 Introduction to Cisco’s Internetworking Operating System (IOS).

Viewing the MAC Address Table

  • show mac address-table shows learned MACs, their VLAN, and associated interface
  • Confirms switch is learning device MACs on specific ports (e.g., Gi0/1, Gi0/2 in VLAN 1 by default)
  • MAC address formats vary by vendor: Cisco uses periods (5254.00e8.593d), Windows uses hyphens, others use colons — all represent the same address
  • Entries age out after 300 seconds (5 min) of inactivity by default
  • show mac address-table aging-time displays the configured aging timer

Viewing the VLAN Database

  • show vlan lists all VLANs and which ports belong to each
  • By default, only VLAN 1 exists, and all ports are members of it
  • VLANs 1002–1005 are reserved and unsupported in Ethernet networks

Creating a VLAN

  • Must be in Global Configuration mode (configure terminal) to create VLANs
  • vlan <number> creates the VLAN and enters VLAN Configuration mode (config-vlan#)
  • Optional: name <name> to label the VLAN (not required for functionality)
  • Changes only take effect after typing exit to leave VLAN config mode
  • Use no vlan <number> to delete/undo a VLAN configuration

Assigning Ports to a VLAN

  • Enter interface config mode: interface gigabitethernet 0/X
  • Set port as access port: switchport mode access
  • Assign to VLAN: switchport access vlan <number>
  • Repeat for each interface needing VLAN assignment
  • Verify with show vlan — ports should now list under the new VLAN

Verifying the Change

  • After moving ports to a new VLAN, show mac address-table should show those same MACs now learned under the new VLAN number
  • Confirms both VLAN assignment and MAC learning are working correctly together

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)

 

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

 

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

 

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.

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:

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

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

 

Then assign it to VLAN 2:

switchport access vlan 2

 

Verify the change with:

show vlan

 

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

 

Now when you check the VLAN database, both GigabitEthernet 0/1 and GigabitEthernet 0/2 should appear as members of 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.

 

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.6.1 Introduction to Cisco’s Internetworking Operating System (IOS).

Key points

Viewing the MAC Address Table

  • show mac address-table shows learned MACs, their VLAN, and associated interface
  • Confirms switch is learning device MACs on specific ports (e.g., Gi0/1, Gi0/2 in VLAN 1 by default)
  • MAC address formats vary by vendor: Cisco uses periods (5254.00e8.593d), Windows uses hyphens, others use colons — all represent the same address
  • Entries age out after 300 seconds (5 min) of inactivity by default
  • show mac address-table aging-time displays the configured aging timer

Viewing the VLAN Database

  • show vlan lists all VLANs and which ports belong to each
  • By default, only VLAN 1 exists, and all ports are members of it
  • VLANs 1002–1005 are reserved and unsupported in Ethernet networks

Creating a VLAN

  • Must be in Global Configuration mode (configure terminal) to create VLANs
  • vlan <number> creates the VLAN and enters VLAN Configuration mode (config-vlan#)
  • Optional: name <name> to label the VLAN (not required for functionality)
  • Changes only take effect after typing exit to leave VLAN config mode
  • Use no vlan <number> to delete/undo a VLAN configuration

Assigning Ports to a VLAN

  • Enter interface config mode: interface gigabitethernet 0/X
  • Set port as access port: switchport mode access
  • Assign to VLAN: switchport access vlan <number>
  • Repeat for each interface needing VLAN assignment
  • Verify with show vlan — ports should now list under the new VLAN

Verifying the Change

  • After moving ports to a new VLAN, show mac address-table should show those same MACs now learned under the new VLAN number
  • Confirms both VLAN assignment and MAC learning are working correctly together

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