二层以太网帧格式


转自:http://blog.csdn.net/kulung/article/details/6442804


VLAN帧格式的相关知识点:


这四个字节的802.1Q标签头包含了2个字节的标签协议标识(TPID)和2个字节的标签控制信息(TCI)。

TPID(Tag Protocol Identifier)是IEEE定义的新的类型,表明这是一个加了802.1Q标签的帧。TPID包含了一个固定的值0x8100。

TCI是包含的是帧的控制信息,它包含了下面的一些元素:
Priority:这3 位指明帧的优先级。一共有8种优先级,0-7。IEEE 802.1Q标准使用这三位信息。

Canonical Format Indicator( CFI )(更多计算机考试资讯尽在http://pc.kaoshibaike.com/):CFI值为0说明是规范格式,1为非规范格式。它被用在令牌环/源路由FDDI介质访问方法中来指示封装帧中所带地址的比特次序信息。

VLAN Identified( VLAN ID ):
这是一个12位的域,指明VLAN的ID,一共4096个,每个支持802.1Q协议的交换机发送出来的数据包都会包含这个域,以指明自己属于哪一个VLAN。

在一个交换网络环境中,以太网的帧有两种格式:有些帧是没有加上这四个字节标志的,称为未标记的帧(ungtagged frame),有些帧加上了这四个字节的标志,称为带有标记的帧(tagged frame)。




wireshark抓包

带VLAN tag的

No.     Time        Source                Destination           Protocol Info
      1 0.000000    Vmware_e0:d3:c1       Broadcast             ARP      Who has 192.168.1.1?  Tell 192.168.1.2

Frame 1: 64 bytes on wire (512 bits), 64 bytes captured (512 bits)
    Arrival Time: Dec  8, 2014 02:22:13.386332000 中国标准时间
    Epoch Time: 1417976533.386332000 seconds
    [Time delta from previous captured frame: 0.000000000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 0.000000000 seconds]
    Frame Number: 1
    Frame Length: 64 bytes (512 bits)
    Capture Length: 64 bytes (512 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:vlan:arp]
    [Coloring Rule Name: ARP]
    [Coloring Rule String: arp]
Ethernet II, Src: Vmware_e0:d3:c1 (00:0c:29:e0:d3:c1), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
    Destination: Broadcast (ff:ff:ff:ff:ff:ff)
        Address: Broadcast (ff:ff:ff:ff:ff:ff)
        .... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
    Source: Vmware_e0:d3:c1 (00:0c:29:e0:d3:c1)
        Address: Vmware_e0:d3:c1 (00:0c:29:e0:d3:c1)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 1122
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = CFI: Canonical (0)
    .... 0100 0110 0010 = ID: 1122
    Type: ARP (0x0806)
    Trailer: 000000000000000000000000000000000000
Address Resolution Protocol (request)
    Hardware type: Ethernet (0x0001)
    Protocol type: IP (0x0800)
    Hardware size: 6
    Protocol size: 4
    Opcode: request (0x0001)
    [Is gratuitous: False]
    Sender MAC address: Vmware_e0:d3:c1 (00:0c:29:e0:d3:c1)
    Sender IP address: 192.168.1.2 (192.168.1.2)
    Target MAC address: 00:00:00_00:00:00 (00:00:00:00:00:00)
    Target IP address: 192.168.1.1 (192.168.1.1)


wKioL1SEOnbQSX6pAAPXdIntSBE113.jpg


不带tag的


No.     Time        Source                Destination           Protocol Info
      1 0.000000    Shenzhen_06:cf:01     Broadcast             ARP      Who has 10.60.10.2?  Tell 10.60.54.200

Frame 1: 60 bytes on wire (480 bits), 60 bytes captured (480 bits)
Ethernet II, Src: Shenzhen_06:cf:01 (28:51:32:06:cf:01), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
    Destination: Broadcast (ff:ff:ff:ff:ff:ff)
    Source: Shenzhen_06:cf:01 (28:51:32:06:cf:01)
    Type: ARP (0x0806)
    Trailer: 000000000000000000000000000000000000
Address Resolution Protocol (request)


wKiom1SEOfnwb_7CAALHJPaDFTo446.jpg








你可能感兴趣的:(tag,VLAN,VLAN,帧格式)