Untag just ordinary ethernet message, ordinary PC The network card of the PC can recognize such messages for communication. Tag The change of message structure is in the source mac address and Purpose mac After the address, add 4bytes of span> vlan Information, that is, vlan tag head, generally speaking like this The message is normal PC The network card of the PC is not recognized.
With 802.1Q The frame is inserted into the standard Ethernet frame 4 bytes of identification, which contains: span>
1) 2 One-byte protocol identifier ( TPID ), currently set 0X8100 The fixed value, indicating that the frame has tag information of 802.1Q .
2) 2 bytes of tag control information ( TCI ), including three fields: < /p>
l priority Domain, occupying 3bits , which indicates the priority of the message , The value is 0 to 7 , 7 is the highest priority, 0 is the lowest priority, this domain is span> 802.1Q Adopt;
l Canonical format indicator field ( CFI ), accounting for 1bits , 0 represents the standard format, applied to Ethernet, 1 represents the non-standard format, applied to Token Ring .
l VLAN ID domain, accounted for 12bits , Used to identify the ownership of the VLAN .
Three kinds of chains of Ethernet port Road type: access, trunk, hybrid
Access The type of port can only Belongs to 1 one VLAN , generally used to connect to the computer port ;
Trunk The type of port can allow multiple VLAN Pass, you can receive and send multiple VLAN packets, generally used Ports connected between switches;
Hybrid The type of port can allow more One VLAN Pass, can receive and send multiple VLAN Messages can be used to connect between switches, and can also be used to connect to a user’s computer.
Hybrid The port can allow multiple VLAN The data without tag , but 802.1Q 的 trunk only native vlan (ie pvid ) corresponding vlan Data without tag , it should be said hybrid Achievable span> trunk Characteristics of the port. In actual use, you can use hybrid port instead of trunk .
Hybrid Port and Trunk When the port receives data, the processing method is the same, the only difference is that when sending data, hybrid The port can allow multiple VLAN packets are sent without tags, and trunk The port only allows default VLAN messages sent without tags.
Processing process of incoming and outgoing data on the switch interface:
Receive:
1. Access Port span>
1) Received a second-layer frame
2) Determine whether there is VLAN The label, does not go to page /span> 3 step, if there is, go to the first 4 step
3) marked the port PVID , and exchanged and forwarded
4) If VLAN Label and< /span> PVID the same, forward VLAN frame, otherwise just discard it
2. Trunk Port
1) Received a second-layer frame
2) Determine if there is VLAN Label, did not go to step 3 step, go to step 4 Step
3) < span style="font-family:'宋体';">ported PVID and exchange and forward
4) Judge this trunk Whether the port allows this VLAN Frame enters, if allowed, then forward, otherwise directly Discard
Note: trunk port allowed or not allowed VLAN Frames are for incoming frames, but not for outgoing frames Restrictions
3. hybrid Port
1) Received a second-layer frame
2) Determine if there is VLAN label, did not go to the first 3 step, if there is, go to the first 4 Step
3) Enter the port PVID , and exchange forwarding
4)< span style="font:9px'Times New Roman';"> judge the hybrid Whether the port allows the VLAN The frame enters, if allowed, it will be forwarded, otherwise it will be discarded directly.
You can see, trunk It is the same as hybrid The processing rules of the received data frame are the same.
Send:
1 . Access Port
Strip the message’s VLAN information stripping , Send it directly
2. Trunk Port
Compare the port’s PVID and the VLAN information that will be sent , If the two are equal, strip off VLAN the information, and then send; if they are not equal, send it directly
3. Hybrid Port span>
judge this VLAN In the properties of this port ( disp interface You can see which port is used for VLAN Yes untag Which VLAN Yes tag ), if it is untag then strip off VLAN Send the message again; if it is tag send it directly.