cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3034
Views
0
Helpful
5
Replies

VLAN tagging

colinkiely1
Level 1
Level 1

Guys

I am looking for some clarification on VLAN tagging that I hope you can hlep with, though reading back through previous posts it would appear perhaps a few of these area's may be part of Cisco's "secret workings"

The way I understand VLAN tagging is that when a packet leaves a switchport to head off to its destination, it will leave the port untagged and will then be tagged at the trunk to its correct access vlan (the one it left the port on) My quesiton is...How does the trunk know which vlan the packet came from in the first place, as it was untagged before being passed to the trunk??

Secondly, as I understand it, IP phones WILL tage its own packets, and so switchport voice vlan x command will mean that frames leaving this port WILL be tagged, and so when they hit the trunk, the packet is not amended and the tag is carried through the trunk and on its merry way

Thirdly, and most interestingly, what type of tagging, if any, takes place internally on the switch, assuming the need to exit the trunk isnt required?

Thoughts appreciated

Thanks

1 Accepted Solution

Accepted Solutions

Colin,

If I have understood you doubt correctly, you are asking how can an 802.1Q tag added before it reached the trunk port. You might need to rephrase the question if I didnot get it properly.

The idea is that the switch only adds the port-vlan ID as the traffic hits a specific say port gig 1/2 with vlan id 2. This is a port vlan ID. This is not a dot1q tagging. Switch has to add a port vlan ID on a switch port in order the switch traffic efficiently and to know the destination interface. Its a combination of Mac-address, Port ID and Port vlan that the switch records in its L2 table for the efficient switching. Now when the switch needs to switch to a destination which is on the other switch and its address is learned on the trunk port, it knows where to send the frame. It will eventually forward that to the trunk, trunk port will look at the Port Vlan ID field in the frame and add the dot1q tag with the same vlan ID. when it gets to the other side of the switch, it strips the dot1q header, look at the local table and send the frame in the respective vlan.

Hope I have made it a bit clear.

Cheers,

-amit singh

View solution in original post

5 Replies 5

Amit Singh
Cisco Employee
Cisco Employee

Hi Colin,

Questions : How does the trunk know which vlan the packet came from in the first  place, as it was untagged before being passed to the trunk??

AS :

When traffic is fwded form pc and reaches the switchport port vlan id is  assisgned to the frame. Port vlan id is the vlan number which is  assigned on the port and you configure it using the " switchport access vlan x" command. So the frame is just a frame when it comes out of  pc but when it reaches the switchport vlan id is assigned and then it  takes the decesion which vlan it belongs to and is fwded to another port  based on the mac address and vlan id. If the switch is forwarding the traffic on local ports, Once the switch decides the local interface to switch the frame it removed the port vlan ID and forwards it to the connected host. If it has the switch traffic to a host connected to another switch, it will forward the frame on to the Trunkport and since the portvlan ID attached to the frame, trunk port looks at the port vlanID and adds the 802.1q tag with that Vlan ID.

Question :Secondly, as I understand it, IP phones WILL tage its own packets, and  so switchport voice vlan x command will mean that frames leaving this  port WILL be tagged, and so when they hit the trunk, the packet is not  amended and the tag is carried through the trunk and on its merry way.

AS: The IP phone has a 2-port switch at the back of it. It follows the normal trunking rules. Configuring the voice vlan means that Phone understand to send the RTP media/voice media on that specific vlan. It does all it normal registration and other functions by using the same Vlan.

Question :Thirdly, and most interestingly, what type of tagging, if any, takes  place internally on the switch, assuming the need to exit the trunk isnt  required?

AS: As explained in the first answer. Its the Port Vlan ID that being added and stripped when the switch does the local switching.

HTH, Please rate if it does.

Cheers,

-amit singh

Amit

Many thanks for your response. The grey area I have is...

The 802.1q enabled port adds the VID to the 802.1q header? If this is the case, how can the VID exist within the frame before it hits the trunk? Sorry if this sounds dumb but I really want to nail this down in my head

Colin,

If I have understood you doubt correctly, you are asking how can an 802.1Q tag added before it reached the trunk port. You might need to rephrase the question if I didnot get it properly.

The idea is that the switch only adds the port-vlan ID as the traffic hits a specific say port gig 1/2 with vlan id 2. This is a port vlan ID. This is not a dot1q tagging. Switch has to add a port vlan ID on a switch port in order the switch traffic efficiently and to know the destination interface. Its a combination of Mac-address, Port ID and Port vlan that the switch records in its L2 table for the efficient switching. Now when the switch needs to switch to a destination which is on the other switch and its address is learned on the trunk port, it knows where to send the frame. It will eventually forward that to the trunk, trunk port will look at the Port Vlan ID field in the frame and add the dot1q tag with the same vlan ID. when it gets to the other side of the switch, it strips the dot1q header, look at the local table and send the frame in the respective vlan.

Hope I have made it a bit clear.

Cheers,

-amit singh

Amit

That is perfect! It just isnt very clear in documentation exactly how the VID works prior to reaching the trunk!

I will rate post, thx

Hi Colin,

No problems at all and Thank you for rating the post.

I would encourage you to be a regular poster on the forum. Its a great place to learn and share the knowledge.

Cheers,

-amit singh

Review Cisco Networking for a $25 gift card