cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
748
Views
0
Helpful
3
Replies

Parsing 802.1Q encapsulated Ethernet frame

vijnaana47711
Level 1
Level 1

Hi Folks

Since the vlan tag field is inserted between SA and type fields, how would one know whether an ethernet frame has vlan tag or not? Normally the type field comes after the SA field and we can determine the type easily, but with type field coming after the vlan tag, how does we know about the 802.1Q encapsulation?

 

Thanks

1 Accepted Solution

Accepted Solutions

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Vijnaana47711,

actually the 4 bytes used by 802.1Q have the first two bytes that are an ethertype typically 0x8100 (other values are used in Carrier ethernet scenario for some complex services ).

The last two bytes provide the vlan-id (using 12 bits) the CoS (using 3 bits) and a canonical format indicator (1 bit depends on L2 technology).

see

https://en.wikipedia.org/wiki/EtherType

 

So a switch can easily understand when a frame is actually an 802.1Q tagged frame by looking at the first ethertype just after the MAC SA.

 

Hope to help

Giuseppe

 

View solution in original post

3 Replies 3

Hello,

 

what are you after exactly ? You would need a protocol analyzer such as WireShark to identify the Vlan ID in the Ethernet frame, as described in the link below:

 

https://wiki.wireshark.org/VLAN

Hi Georg,

I was referring to parsing in C code.

Thanks

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Vijnaana47711,

actually the 4 bytes used by 802.1Q have the first two bytes that are an ethertype typically 0x8100 (other values are used in Carrier ethernet scenario for some complex services ).

The last two bytes provide the vlan-id (using 12 bits) the CoS (using 3 bits) and a canonical format indicator (1 bit depends on L2 technology).

see

https://en.wikipedia.org/wiki/EtherType

 

So a switch can easily understand when a frame is actually an 802.1Q tagged frame by looking at the first ethertype just after the MAC SA.

 

Hope to help

Giuseppe

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card