# Examples: Configuring S-VLAN Subinterface with an Untagged C-VLAN ID

Consider the following example in which an S-VLAN interface is configured with an S-VLAN ID of 4 and the C-VLAN tag as any. Only packets that are double tagged, which contain both the S-VLAN and C-VLAN tags, are matched for this S-VLAN subinterface. Packets that are only S-VLAN tagged and do not contain a C-VLAN tag are not matched for the S-VLAN subinterface.

    host1(config)#interface fastEthernet 2/0
    host1(config-if)#encapsulation vlan
    host1(config-if)#interface fastEthernet 2/0.1
    host1(config-if)#svlan id 4 any
    host1(config-if)#svlan ethertype 8100

The following are the limitations in this setup when the user at the CE-side tags all the packets from the CE-side, including C-VLAN tagged or untagged packets, with an S-VLAN ID to identify a particular user:

- If the S-VLAN Ethertype is 0x8100, then you must create two sub-interfaces, one for the double-tagged packets, and the other for single-tagged packets to process both these types of packets.
- If the S-VLAN Ethertype is a value other than 0x8100, S-VLAN-tagged packets without a C-VLAN ID cannot even be processed.

To enable Ethernet raw mode encapsulation and to enable the S-VLAN subinterface to remove or add the S-VLAN tag at the PE-facing routers in the first scenario, two pseudowires need to be created. Figure 128 illustrates such a scenario in which a sending CE device and a receiving CE device are connected using PE routers through a MPLS network.

Figure 128: Martini Circuit with Two Pseudowires Between PE-Facing Routers

Two customer premise equipment (CPE)-facing interfaces send a packet each to the local CE device, CE1. The Ethernet packet is tagged with both an S-VLAN ID and a C-VLAN ID from CPE1, while the packet from CPE2 contains only the S-VLAN ID. These packets are forwarded to the local PE-router, PE1. In this case, two pseudowires are required for the two conditions. Configuring the C-VLAN ID as 0 by using the anyUntagged keyword in the svlan id svlanIDValue command enables both double-tagged and single-tagged traffic that matches the S-VLAN ID to pass through the S-VLAN subinterface. Using such a configuration, you need to create only one pseudowire and only one S-VLAN subinterface on PE routers.

If an S-VLAN subinterface is configured with Ethertype as 0x8100 and C-VLAN ID as any, a VLAN subinterface for the same ID shall cannot be configured, and vice-versa. For example, you cannot configure the following two commands simultaneously:

    host1(config-if)#svlan id X any
    host1(config-if)#svlan ethertype 8100

and

    host1(config-if)#vlan id X

If you configure such a setting, the set of commands that is configured first takes precedence. Consider the following two cases with this configuration:

- Case 1: Assume that svlan id X any 8100 is configured on the subinterface. In this case, all packets with the outer tag as X and Ethertype as 8100 are matched to the sub-interface.
- Case 2: Assume that vlan id X is configured on the subinterface. In this case, only single-tagged packets with VLAN ID X and Ethertype of 8100 are matched to this subinterface. For VLAN ID of 0, the untagged traffic and the priority tagged traffic are matched the subinterface. This behavior is how it works in existing implementation.

If the S-VLAN subinterface is configured with any value other than an Ethertype 8100, both S-VLAN and VLAN interfaces for the same ID can be configured together as listed earlier. In such cases, the packets are expected to arrive with an S-VLAN ID other than 0x8100 and the C-VLAN Ethertype as 0x8100, which helps to uniquely identify the subinterface for all the following traffic patterns:

- Untagged
- C-VLAN tag only
- S-VLAN tag only
- Both S-VLAN and C-VLAN tagged

The following set of commands generates in appropriate error messages when you attempt to configure them on a VLAN major interface:

    host1(config-if)#interface fastEthernet 1/1.1
    host1(config-if)#svlan id X anyUntagged
    host1(config-if)#svlan Ethertype 0x8100
    host1(config-if)#interface fastEthernet 1/1.2
    host1(config-if)#vlan id X

where X represents a valid V-LAN ID.

The following examples are valid configurations on a VLAN major interface:

    host1(config-if)#interface fastEthernet 1/1.1
    host1(config-if)#svlan id X anyUntagged
    host1(config-if)#svlan Ethertype 0x8100
    host1(config-if)#interface fastEthernet 1/1.2
    host1(config-if)#vlan id Y
    host1(config-if)#interface fastEthernet 1/1.3
    host1(config-if)#svlan id X X

where the V-LAN ID value, X, is not the same as Y.

#### Related Documentation

- S-VLAN Subinterface with an Untagged C-VLAN ID Overview
- svlan id