Hello, everyone!
This time, I want to share information about VLAN, C-VLAN, and S-VLAN. I hope you enjoy it.
What are VLAN, C-VLAN, and S-VLAN?
VLAN
Virtual Local Area Network(VLAN). A logical grouping of two or more nodes that are not necessarily on the same physical network segment but which share the same IP network number. This is often associated with switched Ethernet.
S-VLAN and C-VLAN
Before I explain S-VLAN and C-VLAN, I need to explain the concept of QinQ.
The QinQ technology provides a cheap and easy Layer 2 (L2) virtual private network (VPN) solution. With the VLAN stacking and nesting technology, the data packets carry two VLAN tags at two different layers to identify different data packets. This method clears the limit of the original solution in which only one VLAN tag at one layer is used to identify different data packets. As a result, the VLAN IDs are extended. VLAN stacking refers to a technique in which one more VLAN tag is added in front of the existing VLAN tag in a data frame structure. That is, one data frame carries two VLAN tags at two layers in VLAN stacking.
C-VLAN indicates the customer-side VLAN.
S-VLAN indicates the supplier-side VLAN.
Figure 1 VLAN stacking in the frame structure:

What is the difference between VLAN, C-VLAN, and S-VLAN?
1. VLAN is a very broad concept. It is widely used in the field of information and communication technology.
2. S-VLAN and C-VLAN are special types of VLANs. In the QinQ application scenario, S-VLANs and C-VLANs are named to differentiate VLANs at different levels.
3, C-VLAN are mainly reflected on the client layer network. S-VLANs are mainly implemented on the transport layer above the client layer.
4. The C-VLAN and S-VLAN are relative, and the C-VLAN is contained in the S-VLAN. Add another tag to a VLAN to form a double-tagged VLAN. The outer tag is an SVLAN and the inner tag is a CVLAN. If a VLAN tag is added to the current S-VLAN, the S-VLAN becomes a new S-VLAN, and the original S-VLAN becomes a C-VLAN of the current S-VLAN.
Application Scenario
Take two common scenarios as examples.
Working principle of QinQ in Ethernet Private Line Services
This section uses EVPL (QinQ) services illustrated in Figure 2 to describe how data frames are processed on a QinQ network.
Figure 2 EVPL (QinQ) services:

On the network, the data frames from NE1 to NE4 are processed as follows:
1. NE1 adds an S-TAG to each data frame from the customer a and customer b that are connected to NE1, and forwards the frames to NE2. NE1 adds an S-VLAN1 tag to each data frame from the customer a and an S-VLAN2 tag to each frame from customer b.
2. Based on S-VLAN tags, NE2 transparently transmits the data frames of customer a and customer b to NE3 on service network B.
3. Because service provider B plans different S-VLAN tags for a customer a and customer b, NE3 translates the data frame that contains an S-VLAN1 tag into a data frame that contains an S-VLAN3 tag, translates the data frame that contains an S-VLAN2 tag into a data frame that contains an S-VLAN4 tag, and forwards the data frames to NE4.
4. NE4 removes the S-VLAN3 tag and S-VLAN4 tag and forwards the data frames to the Ethernet ports of customer a and customer b.
The data frame process from NE4 to NE1 is reverse to the preceding process.
Working principles of QinQ in the Packet service network
QinQ Stacking
QinQ tunneling adds the same outer tag to all frames received on a QinQ port. The VLAN-based QinQ stacking technology can add outer tags to frames on QinQ ports based on different inner tags and support refined VLAN classification.
In the carrier network-accessing environment, user packets usually need to be differentiated according to the user's applications, access points, or access devices. Therefore, QinQ stacking is adopted to realize packet differentiation by adding different outer VLAN tags to user packets according to the inner VLAN tags of these packets.
Multiple QinQ stacking sub-interfaces (adding S-VLAN) can be created on a port that supports the QinQ stacking function.
The port can be configured with multiple outer VLAN tags. Then different outer VLAN tags can be assigned to different VLAN frames.
The port can add outer VLAN tags to the received frames, and strip the outer VLAN tags from the sent frames.
This topic uses the service networking mentioned in Figure 3 to describe the processing of data frames on a QinQ network.
Figure 3 Processing of QinQ stacking packets:

On a QinQ network, QinQ service packets are described as follows:
1. After the service packets of users A1 and B1 are transmitted to the access layer and converged, the service packets carry different C-VLAN tags and are transmitted to NE1 using port 1. The C-VLAN ID of service packets of user A1 is 10 and that of user B1 is 20.
2. When service packets are transmitted to a carrier network, multiple QinQ stacking sub-interfaces (adding S-VLAN) can be created on port 1 to add different S-VLAN tags for packets with different C-VLAN tags. For packets whose C-VLAN ID is 10, the ID of the added S-VLAN tags is 100. For packets whose C-VLAN ID is 20, the ID of the added S-VLAN tags is 200.
3. The service packets carry two VLAN tags and are forwarded by following the normal Layer 2 forwarding process.
When the service packets arrive at NE2, a user-side port strips S-VLAN tags from the service packets, and forwards the service packets to the destination users based on the VLAN IDs (10 or 20).
QinQ Mapping
By modifying the VLAN tags carried in packets, QinQ mapping can map a customer-VLAN (C-VLAN) tag to a service-VLAN (S-VLAN) tag so that different VLAN tags are shielded.
Multiple QinQ mapping sub-interfaces can be created on a port that supports the QinQ mapping function. The sub-interfaces are described as follows:
A sub-interface replaces the VLAN tag in a packet sent from the local VLAN with the outer VLAN tag.
A sub-interface replaces the VLAN tag in a received packet with the local VLAN tag.
This topic uses the service networking mentioned in Figure 4 to describe the processing of data frames on a QinQ network.
Figure 4 Schematic diagram of the QinQ mapping function

On a QinQ network, QinQ service packets are described as follows:
1. After the service packets of users A1 and B1 are transmitted to the access layer and converged, the service packets carry different C-VLAN tags and are transmitted to NE1 using port 1. The C-VLAN ID of service packets of user A1 is 10 and that of user B1 is 20.
2. When service packets are transmitted to a carrier network, the QinQ mapping sub-interfaces on port 1 can map the VLAN tags carried in the service packets to the specified C-VLAN tags and adds S-VLAN tags of the carrier network. For service packets whose C-VLAN ID is 10, change the ID of the inner VLAN tag to 30. For service packets whose C-VLAN ID is 20, change the ID of the inner VLAN to 40.
3. The service packets carry two VLAN tags and are forwarded by following the normal Layer 2 forwarding process.
4. When the service packets arrive at NE2, a user-side port strips S-VLAN tags from the service packets, and forwards the service packets to the destination users based on the VLAN IDs.
Thank you!

