In the book "Basic Skills of Switches - Part 1", it is mentioned that switches divide communication areas at the physical level and generate local area networks (LANs). A local area network has a characteristic: once the connection topology is determined, the communication area will not change for a certain period of time. In the actual communication process, broadcast messages and unicast messages with unknown destination addresses need to be notified to all devices. The size of the communication area affects the number of devices that need to be notified in this process. However, indiscriminate broadcasting of devices will cause broadcast flooding. The switch does not have the function of device selection at this time, and all devices in the communication area have no choice but to be constantly "disturbed" (the "i" device means: the "e-person" of the switch is so terrible, crying silently ㄒoㄒ~~). Moreover, this broadcast flooding will also occupy bandwidth, causing line conflicts and performance degradation, and may even cause network paralysis.
To solve this problem, a simple idea is: is it feasible to change the connection topology within the LAN? The answer is that it is useful, but not much. The reason is simple. If you only need to change the connection topology occasionally, and only change one or two devices each time, it is just a matter of plugging and unplugging a few network cables. But what if you need to change the communication area frequently, or there are multiple communication areas, and many devices are involved each time? Even Avalokitesvara would have to say: This job is too tiring...
Smart friends may think that if we do not change the physical connection, but limit the transmission path of the message so that they can only be forwarded within a specific range? That's right, there is always a way out. Since we can't change the physical world, we can show our skills in the virtual world. This is the origin of Virtual Local Area Network (VLAN)!
VLAN technology divides the LAN into multiple areas at the logical level. Each area is an independent broadcast domain. Broadcast communication can be carried out within the area, but direct communication cannot be carried out between areas. In this way, the broadcast domain can be quickly divided and modified without modifying the actual connection topology, which greatly enhances operability and adaptability. Imagine that you are discussing how to write group assignments in the group group while discussing what to eat in the dormitory group. If the information of the two groups can be seen by each other, wouldn’t it be a mess? ! The advantage of this group discussion method is that if a group member is temporarily added, you only need to pull this person into the group group to continue the discussion, and it will not affect the previous work. It is so convenient!
Then, friends may ask again: What kind of "magic" is used to achieve such a convenient VLAN?
The magic is: VLAN ID, or VID for short, which is the number of different VLANs. By adding an extra field in the message, the VID of the message is marked, indicating which VLAN the message will be transmitted under.
VLAN message structure
The message structure carrying VID follows the IEEE 802.1Q protocol. IEEE (Institute of Electrical and Electronics Engineers) has made outstanding contributions in the fields of electrical and electronic engineering, computers and other technologies, leading the development of new technologies and formulating international and industry standards. The 802.1Q protocol defines a standardized implementation of VLAN based on the MAC (Media Access Control) message.
First, let's introduce the MAC message without VLAN. There are two formats, one is the format promulgated by IEEE 802.3 in 1982, and the other is the format promulgated by Ethernet V2 in 1983. The two differ only in some fields. The formats are shown in Figure 2 and Figure 3:
Figure 2 IEEE 802.3 MAC message format
Figure 3 Ethernet V2 MAC message format
The meaning of each field is as follows:
-
PRE: Preamble, 8 bytes long (one byte has 8 bits), used for time synchronization, usually a continuous value of "10".
-
DA: Destination Address, with a length of 6 bytes, indicating that the message is to be sent to a specific MAC address.
-
SA: Source Address, 6 bytes in length, indicating the MAC address that sends the message.
-
L/T: Length/Type, indicating the length/type of the message, with a length of 2 bytes; the L length field value is between 0 and 1500, and the T type field value is greater than 1536. The value between 1500 and 1536 is undefined. The T type field can indicate the protocol types such as IPv4, IPv6, and ARP.
-
DATA: data, with a length between 46 and 1500 bytes.
-
FCS: Frame Check Sequence uses the CRC (Cyclic Redundancy Check) algorithm to calculate the check value for the DA, SA, L/T, and DATA fields to ensure that the data has not been tampered with during transmission.
Furthermore, based on the above MAC message format, a VLAN description field is added. The specific format is shown in Figure 4:
Figure 4 MAC message format carrying VLAN
The description field of VLAN is between SA and L/T, which is called Tag field. The Tag field is 4 bytes long and consists of two parts: TPID and TCI:
-
TPID: Tag Protocol Identifier, Tag protocol identification bit. The position of this field coincides with the L/T field of untagged messages and is used to distinguish whether a message carries a tag.
-
TCI: Tag Control Information, tag control information, including specific VLAN control information.
The TCI field can be divided into three parts:
-
PCP: Priority Code Point priority code bit, length is 3 bits, indicating the priority forwarding order of the message in the same VLAN, needs to be used in conjunction with the switch queue, which will be introduced later.
-
DEI: Drop Eligible Indicator, 1 bit in length, indicates whether to discard data if too much data affects the transmission efficiency. A value of 0 means no discard, and 1 means discard.
-
VLAN ID: VID for short, 12 bits in length, indicating the VLAN to which the message belongs. This is also the "magic" of arbitrarily dividing broadcast domains mentioned above!
In addition to adding a tag field to the message to indicate the VLAN to which the message belongs, the actual forwarding also requires the switch. Among them, the switch port attributes are very critical in the VLAN forwarding process. In "Switch Basics-3", we will introduce the switch port attributes and the specific forwarding process.
Previous article:CANXL Protocol Interpretation Series | (2) Understanding ISO 11898-2:2024 CANXL Physical Layer
Next article:Electric vehicle (EV) durability: Designing and testing SiC for millions of cycles
- Popular Resources
- Popular amplifiers
- Red Hat announces definitive agreement to acquire Neural Magic
- 5G network speed is faster than 4G, but the perception is poor! Wu Hequan: 6G standard formulation should focus on user needs
- SEMI report: Global silicon wafer shipments increased by 6% in the third quarter of 2024
- OpenAI calls for a "North American Artificial Intelligence Alliance" to compete with China
- OpenAI is rumored to be launching a new intelligent body that can automatically perform tasks for users
- Arm: Focusing on efficient computing platforms, we work together to build a sustainable future
- AMD to cut 4% of its workforce to gain a stronger position in artificial intelligence chips
- NEC receives new supercomputer orders: Intel CPU + AMD accelerator + Nvidia switch
- RW61X: Wi-Fi 6 tri-band device in a secure i.MX RT MCU
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Recruiting part-time artificial intelligence teachers
- How should we amplify PAL signals and what chip should we use?
- Please help me solve the problem of NRF24L01
- [RVB2601 Creative Application Development] 4. Get weather information with cJSON
- How 6 is WiFi 6? Is it a leap forward or a trick? This article tells you whether WiFi 6 routers are worth buying
- LPS33W MEMS Pressure Sensor Data
- 【CH579M-R1】Testing the WS2812 Driver
- The result register value of DSP28377D fluctuates greatly after ADC sampling
- Has anyone used this kind of constant current solution with a single IC for two channels?
- It’s the Little New Year! It’s not the Little New Year yet? When does your family celebrate the Little New Year?