1 .. _subinterfacecommands:
7 This command is used to add VLAN IDs to interfaces, also known as
8 subinterfaces. The primary input to this command is the '*interface*'
9 and '*subId*' (subinterface Id) parameters. If no additional VLAN ID is
10 provide, the VLAN ID is assumed to be the '*subId*'. The VLAN ID and
11 '*subId*' can be different, but this is not recommended.
13 This command has several variations:
15 - **create sub-interfaces <interface> <subId>** - Create a subinterface
16 to process packets with a given 802.1q VLAN ID (same value as the
18 - **create sub-interfaces <interface> <subId> default** - Adding the
19 '*default*' parameter indicates that packets with VLAN IDs that do
20 not match any other subinterfaces should be sent to this
22 - **create sub-interfaces <interface> <subId> untagged** - Adding the
23 '*untagged*' parameter indicates that packets no VLAN IDs should be
24 sent to this subinterface.
25 - **create sub-interfaces <interface> <subId>-<subId>** - Create a
26 range of subinterfaces to handle a range of VLAN IDs.
27 - **create sub-interfaces <interface> <subId> dot1q|dot1ad <vlanId>|any
28 [exact-match]** - Use this command to specify the outer VLAN ID, to
29 either be explicited or to make the VLAN ID different from the
31 - **create sub-interfaces <interface> <subId> dot1q|dot1ad <vlanId>|any
32 inner-dot1q <vlanId>|any [exact-match]** - Use this command to
33 specify the outer VLAN ID and the innner VLAN ID.
35 When '*dot1q*' or '*dot1ad*' is explictly entered, subinterfaces can be
36 configured as either exact-match or non-exact match. Non-exact match is
37 the CLI default. If '*exact-match*' is specified, packets must have the
38 same number of VLAN tags as the configuration. For non-exact-match,
39 packets must at least that number of tags. L3 (routed) interfaces must
40 be configured as exact-match. L2 interfaces are typically configured as
41 non-exact-match. If '*dot1q*' or '*dot1ad*' is NOT entered, then the
42 default behavior is exact-match.
44 Use the '*show interface*' command to display all subinterfaces.
51 create sub-interfaces <interface> {<subId> [default|untagged]} | {<subId>-<subId>} | {<subId> dot1q|dot1ad <vlanId>|any [inner-dot1q <vlanId>|any] [exact-match]}.
56 Example of how to create a VLAN subinterface 11 to process packets on 802.1q VLAN ID 11:
58 .. code-block:: console
60 vpp# create sub-interfaces GigabitEthernet2/0/0 11
62 The previous example is shorthand and is equivalent to:
64 .. code-block:: console
66 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 11 exact-match
68 Example of how to create a subinterface number that is different from the VLAN ID:
70 .. code-block:: console
72 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100
74 Examples of how to create q-in-q and q-in-any subinterfaces:
76 .. code-block:: console
78 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100 inner-dot1q 200
79 vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1q 100 inner-dot1q any
81 Examples of how to create dot1ad interfaces:
83 .. code-block:: console
85 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1ad 11
86 vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1ad 100 inner-dot1q 200
88 Examples of '*exact-match*' versus non-exact match. A packet with outer VLAN 100 and inner VLAN 200 would match this interface, because the default is non-exact match:
90 .. code-block:: console
92 vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100
94 However, the same packet would NOT match this interface because '*exact-match*' is specified and only one VLAN is configured, but packet contains two VLANs:
96 .. code-block:: console
98 vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100 exact-match
100 Example of how to created a subinterface to process untagged packets:
102 .. code-block:: console
104 vpp# create sub-interfaces GigabitEthernet2/0/0 5 untagged
106 Example of how to created a subinterface to process any packet with a VLAN ID that does not match any other subinterface:
108 .. code-block:: console
110 vpp# create sub-interfaces GigabitEthernet2/0/0 7 default
112 When subinterfaces are created, they are in the down state. Example of how to enable a newly created subinterface:
114 .. code-block:: console
116 vpp# set interface GigabitEthernet2/0/0.7 up