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