docs: add useful debug CLI Review Updates
[vpp.git] / docs / reference / cmdreference / interface / setinterface.rst
1 .. _interface:\r
2 \r
3 .. toctree::\r
4 \r
5 Set Interface Commands\r
6 =======================\r
7 This section covers those commands that are related to setting an interface:\r
8 \r
9 * `Set Interface`_\r
10 * `Set Interface IP Address`_\r
11 * `Set Interface L2 Bridge`_\r
12 * `Set Interface MTU`_\r
13 * `Set Interface Promiscuous`_\r
14 * `Set Interface State`_\r
15 \r
16 .. 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>`_ .\r
17 \r
18 Set Interface\r
19 ++++++++++++++++\r
20 \r
21 Summary/Usage\r
22 -------------\r
23 \r
24 Interface commands.\r
25 \r
26 Declaration and Implementation\r
27 -------------------------------\r
28 \r
29 **Declaration:** vnet_cli_set_interface_command (src/vnet/interface_cli.c line 484)\r
30 \r
31 Set Interface IP Address\r
32 +++++++++++++++++++++++++\r
33 \r
34 Summary/Usage\r
35 -------------\r
36 \r
37 set interface ip address [del] <*interface*> <*ip-addr*>/<*mask*> | [all]\r
38 \r
39 Description\r
40 -------------\r
41 \r
42 Add an IP Address to an interface or remove and IP Address from an interface. \r
43 The IP Address can be an IPv4 or an IPv6 address. Interfaces may have multiple IPv4 and IPv6\r
44 addresses. There is no concept of primary vs. secondary interface addresses; they're just addresses.\r
45 \r
46 To display the addresses associated with a given interface, use the command **show interface address** <*interface*>.\r
47 \r
48 .. note:: \r
49         The debug CLI does not enforce classful mask-width / addressing constraints.\r
50 \r
51 Example Usage\r
52 --------------\r
53 \r
54 An example of how to add an IPv4 address to an interface:\r
55 \r
56 .. code-block:: console\r
57 \r
58         vpp# set interface ip address GigabitEthernet2/0/0 172.16.2.12/24\r
59 \r
60 An example of how to add an IPv6 address to an interface:\r
61 \r
62 .. code-block:: console\r
63 \r
64         vpp# set interface ip address GigabitEthernet2/0/0 ::a:1:1:0:7/126\r
65 \r
66 To delete a specific interface ip address:\r
67 \r
68 .. code-block:: console\r
69 \r
70         vpp# set interface ip address GigabitEthernet2/0/0 172.16.2.12/24 del\r
71 \r
72 To delete all interfaces addresses (IPv4 and IPv6):\r
73 \r
74 .. code-block:: console\r
75 \r
76         vpp# set interface ip address GigabitEthernet2/0/0 del all\r
77 \r
78 Declaration and Implementation\r
79 -------------------------------\r
80 \r
81 **Declaration:** set_interface_ip_address_command (src/vnet/ip/ip46_cli.c line 216)\r
82 \r
83 **Implementation:** add_del_ip_address\r
84 \r
85 \r
86 Set Interface L2 Bridge \r
87 +++++++++++++++++++++++++\r
88 \r
89 Summary/Usage\r
90 -------------\r
91 \r
92 set interface l2 bridge <*interface*> <*bridge-domain-id*> [bvi|uu-fwd] [shg]\r
93 \r
94 Description\r
95 -------------\r
96 \r
97 Use this command put an interface into Layer 2 bridge domain. If a bridge-domain with the provided\r
98 bridge-domain-id does not exist, it will be created. Interfaces in a bridge-domain forward packets\r
99 to other interfaces in the same bridge-domain based on destination mac address. To remove an interface\r
100 from a the Layer 2 bridge domain, put the interface in a different mode, for example Layer 3 mode.\r
101 \r
102 Optionally, an interface can be added to a Layer 2 bridge-domain as a Bridged Virtual Interface (bvi).\r
103 Only one interface in a Layer 2 bridge-domain can be a bvi.\r
104 \r
105 Optionally, a split-horizon group can also be specified. This defaults to 0 if not specified.\r
106 \r
107 Example Usage\r
108 --------------\r
109 Example of how to configure a Layer 2 bridge-domain with three interfaces (where 200 is the bridge-domain-id):\r
110 \r
111 .. code-block:: console\r
112 \r
113         vpp# set interface l2 bridge GigabitEthernet0/8/0.200 200\r
114 \r
115 This interface is added a BVI interface:\r
116 \r
117 .. code-block:: console\r
118 \r
119         vpp# set interface l2 bridge GigabitEthernet0/9/0.200 200 bvi\r
120 \r
121 This interface also has a split-horizon group of 1 specified:\r
122 \r
123 .. code-block:: console\r
124 \r
125         vpp# set interface l2 bridge GigabitEthernet0/a/0.200 200 1\r
126 \r
127 Example of how to remove an interface from a Layer2 bridge-domain:\r
128 \r
129 .. code-block:: console\r
130 \r
131         vpp# set interface l3 GigabitEthernet0/a/0.200\r
132 \r
133 Declaration and Implementation\r
134 -------------------------------\r
135 \r
136 **Declaration:** int_l2_bridge_cli (src/vnet/l2/l2_input.c line 949)\r
137 \r
138 **Implementation:** int_l2_bridge\r
139 \r
140 Set Interface MTU\r
141 ++++++++++++++++++\r
142 \r
143 Summary/Usage\r
144 -------------\r
145 \r
146 .. code-block:: shell\r
147 \r
148     set interface mtu [packet|ip4|ip6|mpls] <value> <interface>\r
149 \r
150 Set Interface Promiscuous\r
151 ++++++++++++++++++++++++++\r
152 \r
153 Summary/Usage\r
154 -------------\r
155 \r
156 .. code-block:: shell\r
157 \r
158     set interface promiscuous [on|off] <interface>.\r
159 \r
160 .. _setintstate:\r
161 \r
162 Set Interface State\r
163 ++++++++++++++++++++\r
164 This command is used to change the admin state (up/down) of an\r
165 interface.\r
166 \r
167 If an interface is down, the optional *punt* flag can also be set. The\r
168 *punt* flag implies the interface is disabled for forwarding but punt\r
169 all traffic to slow-path. Use the *enable* flag to clear *punt* flag\r
170 (interface is still down).\r
171 \r
172 Summary/Usage\r
173 -------------\r
174 \r
175 .. code-block:: shell\r
176 \r
177     set interface state <interface> [up|down|punt|enable].\r
178 \r
179 Example Usage\r
180 ----------------\r
181 \r
182 Example of how to configure the admin state of an interface to **up**:\r
183 \r
184 .. code-block:: console\r
185 \r
186     vpp# set interface state GigabitEthernet2/0/0 up\r
187 \r
188 Example of how to configure the admin state of an interface to **down**:\r
189 \r
190 .. code-block:: console\r
191 \r
192     vpp# set interface state GigabitEthernet2/0/0 down\r
193 \r