"switchport vlan mapping" - a must-know for a Cisco engineer?

I felt myself very ashamed yesterday: after almost a year of studying for the CCIE R&S exam, I couldn't create a working test VLAN to ping a directly connected switch!..[:$]

Here's the story (please excuse for a link to another site - I could copy-paste, but decided to be brief):


Could anyone please clarify why I wasn't able to use my test VLAN to ping the swtch on the other end of a direct link (that switch was a non-Cisco switch, but the same configuration worked well with a non-Cisco switch from another vendor).

Thanks in advance for you attention and help!


  • Hmm. That's curious... I wonder if VLAN 2005 was inactive in the VLAN database and when you used "switchport vlan mapping 2005 2005," it took your inactive VLAN and translated it to the same VLAN id, but made it active... 


    Try your test again, but this time instead of using VLAN mapping, try adding "state active" under the VLAN in the VLAN database and see if that works:


    vlan 2005

      name test-2005

      state active



    interface GigabitEthernet2/20

      switchport mode trunk

      switchport trunk allowed vlan 2005


    interface vlan 2005

      ip address


      no shutdown

  • Sorry. I just read your thread on Cisco's site and I see that the VLAN was active and going across the trunk... 



  • Previos configuration on the port was not done by me, and I saw that the only active VLAN on the port was VLAN 1005, for which a command existed:

       switchport vlan mapping 1005 1005

    VLAN 1005 was working well, but I could never think that it was because of the command above! I even thought: "what is this strange mapping from 1005 to 1005 is doing there? what's the point of it?" And following instructions from Cisco certification tracks (I'm a CCNP studying for a CCIE), which mention NOWHERE that sometimes (or on some Cisco platforms) for a VLAN to work, it's necessary to map a VLAN to itself, I didn't use the command

       switchport vlan mapping 2005 2005

    when adding a new VLAN to the trunk port. Surprisingly, my VLAN didn't work...

    Most interestingly, later I went to the Service Provider office, sat side-by-side with their engineer (who is not expert in Cisco gear at all, because they use predominantly Alcatel-Lucent devices), opened an SSH connection to our switch and issued all kinds of commands that Cisco certification tracks teach us, including:

       show vlan id 2005

       show spanning tree vlan 2005

       show mac address-table dynamic vlan 2005

       show ip interface brief | include 2005

       show interface Gi2/20 trunk

       show run interface Gi2/20

    to demonstrate that I did everything correctly regarding test VLAN 2005. Then their engineer started to try all kinds of crazy things, starting with

       no spanning-tree vlan 2005

    and ending with

       no vlan 2005

       vlan 2005

    Finally their engineer noticed that for the only working VLAN 1005 (already existing on the trunk) a mapping statement existed:

       switchport vlan mapping 1005 1005

    He said: "let's try the same thing for the new VLAN 2005?" I was like: "no, I don't see any point in mapping a VLAN from itself to itself"...

    Then he just entered that command, and everything worked! I was so ashamed and angry at Cisco certification tracks at that moment! They say nothing about this command, and even googling later the same day I found nothing about the meaning of mapping a VLAN from number X to the same number X...

    Could anyone please shed a light on what magic operation happens after that command that a VLAN starts to work?

    Thanks in advance for your help!

  • This is probably a bug and the vlan mapping is just a workaround.


Sign In or Register to comment.