2

Again a basic question. Switches communicate information to each other regarding VLANs using VTP, so each switch is aware of the VLANs. It's MAC address table is as one of the follows. VLAN Table

Now, why is VLAN tag required, since the frame's source MAC doesn't change, and a lookup can anyways be performed in the other switche's VLAN table?

  • Multicast MAC addresses are absolutely common to appear in a lot of vlans at the same time. – Max Ried Sep 25 '16 at 19:22
1

U can understand this better if you consider the data path of a frame in a switch.

Suppose Switch A has 24 ports(can be any number), this switch is has been configured to have 3 vlans, namely vlan 10 for ports 0-10 vlan 20 for port 11-20 and the default vlan - vlan 1 for ports 21-24

Now if this switch receives a frame destined for port 11 (vlan 20), but the frame does not have a vlan tag. The switch will assume it to be a part of the default vlan and look up in the part its L2DA table for the default Vlan. Ofcourse it wouldn't find an entry for port 11 in the table (because entry for port 11 is in the part L2DA table reserved for vlan 20) Now as the switch coudn't find the required MAC address in its table, it ll do what switches do best ! BROADCAST

But remember vlans do not receive broadcast messages. So the frame never reaches its destination.

Long story short, for correct delivery, Switch needs to look in the correct portion of its L2DA table and for that we need vlan tags.

Hope it helps.

  • Hey in this case my doubt is can't the switch identify the VLAN based on which port the data came in through? – Danis Fermi Sep 25 '16 at 23:32
  • @DanisFermi, If the frame comes into switch, then yes, that switch can identify which VLAN the frame is in by the interface with which it entered the switch. Only if the frame leaves that switch via a trunk, does the switch tag the frame, because no other switch will know into which interface on the switch the frame entered, or to which VLAN, the frame belongs. If the frame comes into a different switch, it comes into your switch through a trunk, and that is where VLANs are tagged (on a trunk) in order to mark which frames are in which VLANs. Switches can't look at the table of another switch. – Ron Maupin Sep 26 '16 at 0:08
  • 1
    @DanisFermi, that is a bad idea. If you do that then the VLAN could change. For instance Switch A could have its interface to Switch B in VLAN 1, and Switch B could have its interface to Switch A as VLAN 2. Switch A thinks it is sending a frame to VLAN 1, and Switch B thinks it is receiving a frame from VLAN 2. Neither switch will know there is a problem (with Cisco switches, proprietary CDP can inform about a VLAN mismatch). That is because the VLANs are not tagged on an access interface, only on a trunk interface. That's why it is a best practice to only connect switches with trunk links. – Ron Maupin Sep 26 '16 at 0:25
  • 1
    @DanisFermi, Also, understand that VTP only works on trunk links. The "T" in VTP stands for Trunk. – Ron Maupin Sep 26 '16 at 0:28
  • 1
    @DanisFermi, that would be correct. Most people have gone away from using VTP. Instead, an emerging Cisco best practice is to limit a VLAN to a single switch. You can have as many VLANs as you like on a switch, but those VLANs should not be trunked to other access switches, too. You will use the switchport trunk allowed vlan command to limit which VLANs are on the trunk. This will prevent STP problems. – Ron Maupin Sep 26 '16 at 0:39
2

Switches don't exchange MAC address information through VTP or any other protocol. The only way a switch can learn the destination port and VLAN of a MAC address is by recording the source MAC address and VLAN of inbound frames. For VLAN trunks, tagging is required to show which VLAN the frame and source MAC address belong to. VTP's purpose is to automate the creation of VLANs on a switch. With VTP, once a VLAN is created on a VTP server, the clients (and any other servers) will have that VLAN created in their databases, with the same VLAN ID and name as the VTP server. VTP doesn't contain any port VLAN information or MAC address tables.

2

The Source or Destination MAC address does not have to be unique across different VLANs. Therefore, you can not create a correlation between the MAC address of the frame and the VLAN the frame should be in.

Take First Hop Redundancy Protocols (HSRP/VRRP), for example. You could have a pair of L3 switches doing HSRP/VRRP for five different VLANs. If each VLAN uses the same VRRP ID# then each VRRP Gateway IP address will share the same MAC address (00-00-5E-00-01-<ID#>). You would then have the exact same MAC address in five different VLANs.

The real reason you need VLAN Tagging is to distinguish VLAN traffic on a port where multiple VLANs can exist.

An access port is a port which carries traffic for only one VLAN. A Trunk port is a port which carries traffic for multiple VLANs.

On Trunk ports, all the frames are still carried across the wire in the form of 1s and 0s. Something has to exist in order for the sending switch to indicate to the receiving switch which 1s and 0s belong to which VLAN. That something is a VLAN Tag.

The VLAN Tag will be added whenever a frame is crossing a trunk port and removed when the other switch receives the frame. It will look like this:

VLAN Tags being added and removed on Trunk Ports

You can read more about VLANs and how they work in this article, and how to configure them on Cisco switches in this article.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.