It is important to understand how VLANs are created and how they are applied. In the Cisco IOS, you can apply a VLAN (say to an access port or a trunk port) without it actually existing! And actually, you don’t get an error message for this either. This is also the case when you apply the Native VLAN. So when you apply a native VLAN to a trunk port, there are two steps:
- Create the VLAN (or make sure that it already exists)
- Apply the Native VLAN configuration to the trunk
As you have already seen, these commands don’t actually have to be implemented in the above order.
So for commands like:
SW1(config-if)#switchport access vlan 10
SW1(config-if)#switchport trunk allowed vlan 10
SW1(config-if)#switchport trunk native vlan 10
vlan 10 may not even exist, but you can still issue the above commands.
The only time a VLAN will be created without explicitly issuing the
vlan xx command (where xx is the VLAN ID) is when you create an SVI. For example:
SW1(config)# interface vlan 10
This command creates the SVI on a switch, but it also automatically creates the associated VLAN. If you have terminal monitor on, you will actually see a syslog message that informs you of this.
So, to answer your question, you must create vlan 10 in order for your native vlan configuration to work correctly.
I hope this has been helpful!