Nathan Skrzypczak | 9ad39c0 | 2021-08-19 11:38:06 +0200 | [diff] [blame] | 1 | ====================== |
| 2 | Set Interface Commands |
| 3 | ====================== |
| 4 | |
| 5 | This section covers those commands that are related to setting an |
| 6 | interface: |
| 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 | |
| 20 | Set Interface IP Address |
| 21 | ======================== |
| 22 | |
| 23 | .. code:: console |
| 24 | |
| 25 | set interface ip address [del] <*interface*> <*ip-addr*>/<*mask*> | [all] |
| 26 | |
| 27 | Add an IP Address to an interface or remove and IP Address from an |
| 28 | interface. The IP Address can be an IPv4 or an IPv6 address. Interfaces |
| 29 | may have multiple IPv4 and IPv6 addresses. There is no concept of |
| 30 | primary vs. secondary interface addresses; they're just addresses. |
| 31 | |
| 32 | To display the addresses associated with a given interface, use the |
| 33 | command **show interface address** <*interface*>. |
| 34 | |
| 35 | .. note:: |
| 36 | |
| 37 | The debug CLI does not enforce classful mask-width / addressing |
| 38 | constraints. |
| 39 | |
| 40 | Example Usage |
| 41 | ------------- |
| 42 | |
| 43 | An 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 | |
| 49 | An 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 | |
| 55 | To 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 | |
| 61 | To delete all interfaces addresses (IPv4 and IPv6): |
| 62 | |
| 63 | .. code:: console |
| 64 | |
| 65 | vpp# set interface ip address GigabitEthernet2/0/0 del all |
| 66 | |
| 67 | Declaration 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 | |
| 75 | Set Interface L2 Bridge |
| 76 | ======================= |
| 77 | |
| 78 | .. code:: console |
| 79 | |
| 80 | set interface l2 bridge <*interface*> <*bridge-domain-id*> [bvi|uu-fwd] |
| 81 | [shg] |
| 82 | |
| 83 | Use this command put an interface into Layer 2 bridge domain. If a |
| 84 | bridge-domain with the provided bridge-domain-id does not exist, it will |
| 85 | be created. Interfaces in a bridge-domain forward packets to other |
| 86 | interfaces in the same bridge-domain based on destination mac address. |
| 87 | To remove an interface from a the Layer 2 bridge domain, put the |
| 88 | interface in a different mode, for example Layer 3 mode. |
| 89 | |
| 90 | Optionally, an interface can be added to a Layer 2 bridge-domain as a |
| 91 | Bridged Virtual Interface (bvi). Only one interface in a Layer 2 |
| 92 | bridge-domain can be a bvi. |
| 93 | |
| 94 | Optionally, a split-horizon group can also be specified. This defaults |
| 95 | to 0 if not specified. |
| 96 | |
| 97 | .. _example-usage-1: |
| 98 | |
| 99 | Example Usage |
| 100 | ------------- |
| 101 | |
| 102 | Example of how to configure a Layer 2 bridge-domain with three |
| 103 | interfaces (where 200 is the bridge-domain-id): |
| 104 | |
| 105 | .. code:: console |
| 106 | |
| 107 | vpp# set interface l2 bridge GigabitEthernet0/8/0.200 200 |
| 108 | |
| 109 | This interface is added a BVI interface: |
| 110 | |
| 111 | .. code:: console |
| 112 | |
| 113 | vpp# set interface l2 bridge GigabitEthernet0/9/0.200 200 bvi |
| 114 | |
| 115 | This 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 | |
| 121 | Example 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 | |
| 129 | Declaration 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 | |
| 136 | Set Interface MTU |
| 137 | ================= |
| 138 | |
| 139 | .. code:: shell |
| 140 | |
| 141 | set interface mtu [packet|ip4|ip6|mpls] <value> <interface> |
| 142 | |
| 143 | Set Interface Promiscuous |
| 144 | ========================= |
| 145 | |
| 146 | .. code:: shell |
| 147 | |
| 148 | set interface promiscuous [on|off] <interface>. |
| 149 | |
| 150 | .. _setintstate: |
| 151 | |
| 152 | Set Interface State |
| 153 | =================== |
| 154 | |
| 155 | This command is used to change the admin state (up/down) of an |
| 156 | interface. |
| 157 | |
| 158 | If 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 |
| 160 | all 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 | |
| 169 | Example Usage |
| 170 | ------------- |
| 171 | |
| 172 | Example 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 | |
| 178 | Example 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 |