Prerequisites: Tag, untag, and various port modes of the vswitch are the concepts most frequently used by network engineers and technicians when debugging the vswitch, however, I found that in actual work, technicians often seem to be confused about these concepts. Based on my own understanding, I combined a case to try to clarify these concepts that untag is a common ethernet packet,
Prerequisites: Tag, untag, and various port modes of the vswitch are the concepts most frequently used by network engineers and technicians when debugging the vswitch, however, I found that in actual work, technicians often seem to be confused about these concepts. Based on my own understanding, I combined a case to try to clarify these concepts that untag is a common ethernet packet,
Prerequisites:
Tag, untag, and various ports of the switchModeIt is the concept that network engineers and technicians have the most contact with when debugging switches. However, in actual work, technicians often seem to understand these concepts.UnderstandingThen we will combine a case to explain these concepts to everyone.
Untag is a common ethernet packet. The NIC of a common PC can identify such packets for communication;
The structure of the tag packet is changed after the source mac address and the target mac address, with the 4-bytes vlan information added, that is, the vlan tag header. Generally, the NIC of a common PC cannot be identified.
A frame with 802.1Q is a four-byte mark inserted on a standard Ethernet frame. Including:
Two-byte protocol identifier (TPID). When the prefix 0 x is fixed, it indicates that the frame carries the mark information of 802.1Q.
Two bytes of tag control information (TCI), including three fields.
Priority domain, which occupies 3 bits, indicates the Priority of the message. values 0 to 7 are the highest Priority, and 0 is the lowest Priority. This domain is used by 802.1p.
Standard Format Indicator (CFI) domain, 1bit, 0 indicates standard format, used in Ethernet; 1 indicates non-standard format, used in Token Ring.
The vlan id field, which occupies 12 bits and is used to indicate the VLAN's attribution.
Three Link types of Ethernet ports: Access, Hybrid, and Trunk:
An Access port can only belong to one VLAN and is generally used to connect to a computer;
A Trunk port allows multiple VLANs to pass through. It can receive and send packets from multiple VLANs. It is generally used for ports connected between switches;
A Hybrid port allows multiple VLANs to pass through. It can receive and send packets from multiple VLANs. It can be used to connect switches or to users' computers.
Hybrid and Trunk have the same processing method when receiving data. The only difference is that when sending data, Hybrid allows packets of multiple VLANs to be sent without tags, however, the Trunk port only allows packets sent by default VLAN without tags.
Here we wantUnderstandingDefault VLAN of a port
The Access port only belongs to one VLAN. Therefore, its default VLAN is the VLAN where it is located. You do not need to set it;
The Hybrid and Trunk ports belong to multiple VLANs, so you need to set the default vlan id. By default, the default VLAN of the Hybrid and Trunk ports is VLAN 1.
If the default vlan id is set for the port, when the port receives a packet without a VLAN Tag, the packet is forwarded to the port of the default VLAN; when a port sends a packet with a VLAN Tag, if the vlan id of the packet is the same as the default vlan id of the port, the system removes the VLAN Tag of the packet and then sends the packet.
Note:HuaweiThe default vlan of a vswitch is called the "Pvid Vlan". For a Cisco switch, the default VLAN is called the "Native Vlan"
Vswitch interface data processing process:
Acess port receipt:
When a packet is received, determine whether there is VLAN information: If there is no VLAN information, add the PVID of the port and perform exchange and forwarding. If yes, discard the packet directly (default)
Acess port sends messages:
Remove the VLAN information of the packets and send them directly.
Trunk port receipt:
When a packet is received, determine whether there is VLAN information: If there is no VLAN information, add the PVID of the port and perform exchange and forwarding. If so, determine whether the trunk port allows the data of the VLAN to enter: if yes, it will be forwarded; otherwise, it will be discarded.
Trunk port sends messages:
Compare the PVID of the port with the VLAN information of the packet to be sent. If the two are the same, the VLAN information is stripped and then sent. If the two are not the same, the packets are directly sent.
Hybrid port receipt:
When a packet is received, determine whether there is VLAN information: If there is no VLAN information, set the PVID of the port and perform exchange and forwarding. If yes, determine whether the hybrid port allows data of the VLAN to enter: if yes, the forwarding will be done; otherwise, it will be discarded (the untag configuration on the port does not need to be considered at this time, and the untag configuration only takes effect when sending packets)
Hybrid port sends messages:
1. Determine the attributes of the VLAN on the current port (The disp interface can see which VLANs are untags and which VLANs are tags)
2. If it is an untag, the VLAN information is stripped and then sent. If it is a tag, it is directly sent.
The following cases can help you exploreUnderstandingHuaweiHybrid port of the vswitchMode
[Switch-Ethernet0/1] int e0/1
[Switch-Ethernet0/1] port link-type hybrid
[Switch-Ethernet0/1] port hybrid pvid vlan 10
[Switch-Ethernet0/1] port hybrid vlan 10 20 untagged
[Switch-Ethernet0/1] int e0/2
[Switch-Ethernet0/2] port link-type hybrid
[Switch-Ethernet0/2] port hybrid pvid vlan 20
[Switch-Ethernet0/2] port hybrid vlan 10 20 untagged
In this case, the connected pcs under inter e0/1 and inter e0/2 can communicate with each other, but the round-trip VLANs used for data communication are different.
The following example describes the pc2 connected to inter e0/1 to access inter e0/2.
The data sent by pc1 is sent to the switch by marking vlan10 in the pvid vlan10 of inter0/1. The switch finds that inter e0/2 allows data from vlan 10 to pass through, therefore, the data is forwarded to inter e0/2. Because vlan 10 on inter e0/2 is untagged, the switch removes the vlan10 mark on the packet and sends it to pc2, in this case, pc1-> p2 follows vlan10.
Then, we analyze the process of pc2 returning packets to pc1. The data sent by pc2 is sent to the switch by the pvid vlan20 of inter0/2 encapsulation vlan20, the switch finds that inter e0/1 allows the data of vlan 20 to pass, so the data is forwarded to inter e0/1, because vlan 20 on inter e0/1 is untagged, the switch removes the vlan20 mark on the data packet and sends it to pc1 as a normal package. In this case, pc2-> pc1 follows vlan20.