blob: fa50c6a626c5736c0d2035307a0d8329423fb653 [file] [log] [blame]
Scott Keeler70f28fc2018-10-23 15:16:46 -04001.. _interface:
2
3.. toctree::
4
5Create Interfaces Commands
6===========================
7This section contains those interface commands that are associated to creating an interface:
8
9* `Create Host-Interface`_
10* `Create Interface Memif`_
11* `Create Loopback Interface`_
12* `Create Sub-Interfaces`_
13
14.. note:: For a complete list of CLI Debug commands refer to the Debug CLI section of the `Source Code Documents <https://docs.fd.io/vpp/18.07/clicmd.html>`_ .
15
16Create Host-Interface
17++++++++++++++++++++++
18Summary/Usage
19-------------
20
21create host-interface name <*ifname*> [*hw-addr <*mac-addr*>]
22
23Description
24------------
25
Scott Keeler6c892302018-10-26 09:12:15 -040026Create a host interface that will attach to a linux AF_PACKET interface, one side of a veth pair.
27The veth pair must already exist. Once created, a new host interface will exist in VPP with the name
28'host-<*ifname*>', where '<*ifname*>' is the name of the specified veth pair.
29Use the `show interface` command to display host interface details.
Scott Keeler70f28fc2018-10-23 15:16:46 -040030
31This command has the following optional parameters:
32
33 hw-addr <*mac-addr*> - Optional ethernet address, can be in either X:X:X:X:X:X unix or X.X.X cisco format
34
35Example Usage
36-------------
37
Scott Keeler6c892302018-10-26 09:12:15 -040038Example of how to create a host interface tied to one side of an existing linux veth pair named vpp1:
Scott Keeler70f28fc2018-10-23 15:16:46 -040039
40 .. code-block:: console
41
42 vpp# create host-interface name vpp1
43
44 host-vpp1
45
Scott Keeler6c892302018-10-26 09:12:15 -040046Once the host interface is created, enable the interface using:
Scott Keeler70f28fc2018-10-23 15:16:46 -040047
48 .. code-block:: console
49
50 vpp# set interface state host-vpp1 up
51
52Declaration and Implementation
53-------------------------------
54
55**Declaration:** af_packet_create_command (src/vnet/devices/af_packet/cli.c line 133)
56
57**Implementation:** af_packet_create_command_fn
58
59Create Interface Memif
60+++++++++++++++++++++++
61
62Summary/Usage
63-------------
64
65create interface memif [id <*id*>] [socket-id <*socket-id*>] [ring-size <*size*>] [buffer-size <*size*>] [hw-addr <*mac-address*>] <master|slave> [rx-queues <*number*>] [tx-queues <*number*>] [mode ip] [secret <*string*>]
66
67Declaration and Implementation
68-------------------------------
69
70**Declaration:** memif_create_command (src/plugins/memif/cli.c line 258)
71
72**Implementation:** memif_create_command_fn
73
74
75Create Loopback Interface
76++++++++++++++++++++++++++
77
78Summary/Usage
79--------------
80
81create loopback interface [mac <*mac-addr*>] [instance <*instance*>]
82
83Description
84------------
85
86Create a loopback interface. Optionally, a MAC Address can be provided. If not provided, de:ad:00:00:00:<*loopId*> will be used.
87
88Example Usage
89--------------
Scott Keeler6c892302018-10-26 09:12:15 -040090The following two command syntaxes are equivalent:
Scott Keeler70f28fc2018-10-23 15:16:46 -040091
92 .. code-block:: console
93
94 vpp# loopback create-interface [mac <*mac-addr*>] [instance <*instance*>]
95
96 vpp# create loopback interface [mac <*mac-addr*>] [instance <*instance*>]
97
Scott Keeler6c892302018-10-26 09:12:15 -040098Example of how to create a loopback interface:
Scott Keeler70f28fc2018-10-23 15:16:46 -040099
100 .. code-block:: console
101
102 vpp# create loopback interface
103
104Declaration and Implementation
105-------------------------------
106
107**Declaration:** create_loopback_interface_command (src/vnet/ethernet/interface.c line 879)
108
109**Implementation:** create_simulated_ethernet_interfaces
110
111
112Create Sub-Interfaces
113++++++++++++++++++++++
114
115This command is used to add VLAN IDs to interfaces, also known as
116subinterfaces. The primary input to this command is the *interface*
117and *subId* (subinterface Id) parameters. If no additional VLAN ID is
118provide, the VLAN ID is assumed to be the *subId*. The VLAN ID and
119*subId* can be different, but this is not recommended.
120
Scott Keeler6c892302018-10-26 09:12:15 -0400121This command has several variations:
Scott Keeler70f28fc2018-10-23 15:16:46 -0400122
123- **create sub-interfaces** <*interface*> <*subId*> - Create a subinterface
124 to process packets with a given 802.1q VLAN ID (same value as the
125 *subId*).
126- **create sub-interfaces** <*interface*> <*subId*> default - Adding the
127 *default* parameter indicates that packets with VLAN IDs that do
128 not match any other subinterfaces should be sent to this
129 subinterface.
130- **create sub-interfaces** <*interface*> <*subId*> untagged - Adding the
131 *untagged* parameter indicates that packets no VLAN IDs should be
132 sent to this subinterface.
133- **create sub-interfaces** <*interface*> <*subId*>-<*subId*> - Create a
134 range of subinterfaces to handle a range of VLAN IDs.
135- **create sub-interfaces** <*interface*> <*subId*> dot1q|dot1ad <*vlanId*>|any
Paul Vinciguerra7fa3dd22019-10-27 17:28:10 -0400136 [exact-match] - Use this command to explicitly specify the outer VLAN ID,
John DeNisco73f725c2019-10-29 10:40:09 -0400137 or to make the VLAN ID different from the *subId*.
Scott Keeler70f28fc2018-10-23 15:16:46 -0400138- **create sub-interfaces** <*interface*> <*subId*> dot1q|dot1ad <*vlanId*>|any
139 inner-dot1q <*vlanId*>|any [exact-match] - Use this command to
Paul Vinciguerra7fa3dd22019-10-27 17:28:10 -0400140 specify the outer VLAN ID and the inner VLAN ID.
Scott Keeler70f28fc2018-10-23 15:16:46 -0400141
Paul Vinciguerra7fa3dd22019-10-27 17:28:10 -0400142When *dot1q* or *dot1ad* is explicitly entered, subinterfaces can be
Scott Keeler70f28fc2018-10-23 15:16:46 -0400143configured as either *exact-match* or *non-exact match*. *Non-exact match* is
144the CLI default. If *exact-match* is specified, packets must have the
145same number of VLAN tags as the configuration. For *non-exact-match*,
146packets must at least that number of tags. L3 (routed) interfaces must
147be configured as exact-match. L2 interfaces are typically configured as
148non-exact-match. If *dot1q* or *dot1ad* is NOT entered, then the
149default behavior is *exact-match*.
150
151Use the **show interface** command to display all subinterfaces.
152
153Summary/Usage
154-------------
155
156.. code-block:: shell
157
158 create sub-interfaces <interface> {<subId> [default|untagged]} | {<subId>-<subId>} | {<subId> dot1q|dot1ad <vlanId>|any [inner-dot1q <vlanId>|any] [exact-match]}
159
160Example Usage
161--------------
162
163Example of how to create a VLAN subinterface 11 to process packets on 802.1q VLAN ID 11:
164
165.. code-block:: console
166
167 vpp# create sub-interfaces GigabitEthernet2/0/0 11
168
169The previous example is shorthand and is equivalent to:
170
171.. code-block:: console
172
173 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 11 exact-match
174
175Example of how to create a subinterface number that is different from the VLAN ID:
176
177.. code-block:: console
178
179 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100
180
181Examples of how to create q-in-q and q-in-any subinterfaces:
182
183.. code-block:: console
184
185 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1q 100 inner-dot1q 200
186 vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1q 100 inner-dot1q any
187
188Examples of how to create dot1ad interfaces:
189
190.. code-block:: console
191
192 vpp# create sub-interfaces GigabitEthernet2/0/0 11 dot1ad 11
193 vpp# create sub-interfaces GigabitEthernet2/0/0 12 dot1ad 100 inner-dot1q 200
194
195Examples 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:
196
197.. code-block:: console
198
199 vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100
200
201However, the same packet would NOT match this interface because *exact-match* is specified and only one VLAN is configured, but packet contains two VLANs:
202
203.. code-block:: console
204
205 vpp# create sub-interfaces GigabitEthernet2/0/0 5 dot1q 100 exact-match
206
207Example of how to created a subinterface to process untagged packets:
208
209.. code-block:: console
210
211 vpp# create sub-interfaces GigabitEthernet2/0/0 5 untagged
212
213Example of how to created a subinterface to process any packet with a VLAN ID that does not match any other subinterface:
214
215.. code-block:: console
216
217 vpp# create sub-interfaces GigabitEthernet2/0/0 7 default
218
219When subinterfaces are created, they are in the down state. Example of how to enable a newly created subinterface:
220
221.. code-block:: console
222
223 vpp# set interface GigabitEthernet2/0/0.7 up
Scott Keeler6c892302018-10-26 09:12:15 -0400224