Sign Up|Login Courses & Workshops
Overview
Pricing
CISCO REFERENCE HOME

switchport trunk native vlan

Switchport trunk native vlan

The switchport trunk native vlan command specifies the native (untagged) VLAN for a Layer 2 interface operating in trunk mode on a Cisco IOS device. This command only takes effect for interfaces that are operating in trunk mode.

802.1Q encapsulation and VLAN tagging

A Layer 2 interface operating in trunk mode can carry traffic belonging to multiple VLANs. In order to specify the VLAN to which a particular frame belongs to, the ethernet header is modified and tagged with a VLAN ID tag. The format of the tag is specified the 802.1Q specification.

On any trunk interface, one VLAN can be configured to carry untagged traffic. This VLAN is referred to as the native VLAN for the trunk interface. This implies that traffic belonging to the native VLAN does not include an 802.1Q tag specifying the VLAN ID. (Traffic belonging to the native VLAN is sent as untagged ethernet frames across a trunk link.)

Untagged traffic received on a trunk interface can only be mapped to a single VLAN - hence, only one VLAN can be specified as the native VLAN for a trunk interface. By default, the native VLAN for a trunk interface on a Cisco IOS device is the default VLAN on Cisco IOS devices - VLAN 1. The default behaviour can be changed by using the command switchport trunk native vlan.

The format of the command is as follows:

switchport trunk native vlan <vlan-id>

where <vlan-id> is the desired VLAN for which traffic must be untagged.

Let's take a look at an example. If we wanted to configure interface GigabitEthernet 0/1 to operate in trunk mode and set VLAN 100 as the native (untagged) VLAN, we would enter configuration commands as follows:

SW1 Console
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk native vlan 100
SW1(config-if)#do sh run int gi0/1
Building configuration...
!
interface GigabitEthernet0/1
 switchport trunk native vlan 100
 switchport mode trunk
!
end
SW1(config-if)#

To set the native vlan back to VLAN 1 (the default VLAN) we could use any one of the following:

  • no switchport trunk native vlan
  • switchport trunk native vlan 1

In the following example the native VLAN for interface gi0/1 is first set to VLAN 100 and then reset back to the default value (VLAN 1). (When set to default, the running-config omits the line switchport trunk native vlan.)

SW1 Console
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk native vlan 100
SW1(config-if)#do sh run int gi0/1
Building configuration...
!
interface GigabitEthernet0/1
 switchport trunk native vlan 100
 switchport mode trunk
!
end
SW1(config-if)#switchport trunk native vlan 1
SW1(config-if)#do sh run int gi0/1
Building configuration...
!
interface GigabitEthernet0/1
 switchport mode trunk
!
end
SW1(config-if)#

VLANs, trunking, VLAN tagging and inter-vlan routing are covered comprehensively in the following interactive course: Course 5 - VLANs & Trunks. The course features visual, animated explanations and hands-on interactive labs.

TRY THIS COURSE

Want to test your networking skills with hands-on configuration and troubleshooting questions? Try out the Workshops section of this website here: Workshops (Login required).

Read how to use the device simulators on this website here: Workshops - General Instructions