This is the documentation for the 19.02 version. Looking for the documentation of the latest version? Have a look here.

VLAN Subinterfaces

A few pieces of information are necessary to create a VLAN subinterface (“subif”):

  • The parent interface which will carry the tagged traffic, e.g. GigabitEthernet3/0/0

  • The subinterface ID number, which is a positive integer that uniquely identifies this subif on the parent interface. It is commonly set to the same value as the VLAN tag

  • The VLAN tag used by the subif to tag outgoing traffic, and to use for identifying incoming traffic bound for this subif. This is an integer in the range 1-4095, inclusive. This VLAN must also be tagged on the corresponding switch configuration for the port used by the parent interface.

The interface subif <parent> <subinterface id> command creates a new subif object with the given identifier, as shown here:

tnsr(config)# interface subif TenGigabitEthernet6/0/0 70
tnsr(config-subif)# dot1q 70
tnsr(config-subif)# exact-match
tnsr(config-subif)# exit

In the above example, both the subif id and the 802.1q VLAN tag are the same, 70. Upon commit, this creates a corresponding subif interface.

The subif interface appears with the parent interface name and the subif id, joined by a .:

tnsr(config)# interface TenGigabitEthernet6/0/0.70

At this point, it behaves identically to regular interface in that it may have an IP address, routing, and so on.

QinQ Subinterfaces

TNSR also supports multiple levels of VLAN tagged subinterfaces, commonly known as QinQ or 802.1ad. This is used to transport multiple VLANs inside another VLAN-tagged outer frame. Intermediate equipment only sees the outer tag, and the receiving end can pop off the outer tag and use the multiple networks inside independently as if it had a direct layer 2 connection to those networks. In this way, providers can isolate multiple tenants on the same equipment, allowing each tenant to use whichever VLAN tags they require, or achieve other goals such as using greater than the default limit of 4096 VLANs.

This example creates a QinQ subinterface with an inner tag of 100 and an outer tag of 200. The subinterface ID number can be any arbitrary unsigned 32-bit integer, but in this case it makes the purpose more clear to have it match the outer and inner VLAN tags of the subinterface:

tnsr(config)# subif GigabitEthernet0/b/0 200100
tnsr(config-subif)# inner-dot1q 100
tnsr(config-subif)# outer-dot1q 200
tnsr(config-subif)# exit
tnsr(config)# exit


TNSR can forward packets it receives on a QinQ interface or route packets out a QinQ interface, but the router-plugin does not currently support QinQ so features such as ping will not work against the subinterface directly.

VLAN Subinterface Options

The previous examples show specific common usages, but there are more options available for subinterfaces. The options used must match the peer to which the subinterface parent is connected, such as a switch or another TNSR device.


Where multiple similar options are present, generally this is for compatibility with other equipment that requires using those specific options. Consult the documentation for the peer device to find out which options it prefers.


Default subinterface, will match any traffic that does not match another subinterface on the same parent interface.


This subinterface will match frames without any VLAN tags.


Specifies whether to exactly match the VLAN ID and the number of defined VLAN IDs. When this is not set, frames with more VLAN tags will also be matched. Layer 3/routed interfaces must use exact-match, it is optional for unrouted/L2 interfaces.

dot1q (<vlan-id>|any)

The VLAN tag to match for this subinterface.

inner-dot1q (<vlan-id>|any)

An inner 802.1q VLAN tag for use with QinQ

outer-dot1ad (<vlan-id>|any)

An outer 802.1ad VLAN tag for use with QinQ

outer-dot1q (<vlan-id>|any)

An outer 802.1q VLAN tag for use with QinQ

vlan <vlan-id>

VLAN ID for tag rewriting

vlan tag-rewrite disable

Disable tag rewriting for this subinterface

vlan tag-rewrite pop-1

Remove one level of VLAN tags from packets on this subinterface.

vlan tag-rewrite pop-2

Remove two level of VLAN tags from packets on this subinterface.

vlan tag-rewrite push-1 (dot1ad|dot1q) <tag 1>

Add a new layer of VLAN tagging to frames on this subinterface using the provided VLAN tag.

vlan tag-rewrite push-2 (dot1ad|dot1q) <tag 1> <tag 2>

Add two new layers of VLAN tagging to frames on this subinterface using the provided VLAN tags.

vlan tag-rewrite translate-1-1 (dot1ad|dot1q) <tag 1>

Replace one layer of VLAN tags with the a different VLAN ID.

vlan tag-rewrite translate-1-2 (dot1ad|dot1q) <tag 1> <tag 2>

Replace one layer of VLAN tags with two layers of tagging using the provided VLAN IDs.

vlan tag-rewrite translate-2-1 (dot1ad|dot1q) <tag 1>

Replace two layers of VLAN tags with one layer of tagging using the provided VLAN ID.

vlan tag-rewrite translate-2-2 (dot1ad|dot1q) <tag 1> <tag 2>

Replace two layers of VLAN tags with two different layers of tagging using the provided VLAN IDs.