The ip address command configures an IP address for an interface.
The undo ip address command deletes the IP address of an interface.
ip address ip-address { mask | mask-length } [ sub ]
undo ip address [ ip-address { mask | mask-length } [ sub ] ]
| Parameter | Description | Value |
|---|---|---|
| ip-address | Specifies the IP address of the interface. | The value is in dotted decimal notation. |
| mask | Specifies the mask of the subnet. | The value is in dotted decimal notation. |
| mask-length | Specifies the length of the subnet mask. | The value is an integer ranging from 1 to 30. You can also set it to 32. NOTE:
Only the loopback interface can have a 32-bit subnet mask. |
| sub | configures a secondary IP address. To implement the communication between sub-networks on one interface, configure secondary IP addresses. | - |
By default, no IP address is configured.
The ip address command configures an IP address and its mask for an interface on the device. In this way, the interconnection between the device and the network is implemented. To connect one device with several sub-networks, configure several IP addresses for one interface, one of which is the primary IP address and the other are secondary IP addresses. When you configure a new primary IP address for an interface, the newly configured address supersedes the original one.
The undo ip address command indicates deleting all IP addresses on an interface. The undo ip address ip-address mask command indicates deleting the primary IP address. The undo ip address ip-address mask sub command indicates deleting secondary IP addresses.
Note that:
Deleting all secondary IP address before deleting the primary IP address.
The AntiDDoS supports the space overlapping of network segment addresses to save the address space.
The primary IP address and the secondary IP address in the same network segment can be configured on the same interface. For example, after the primary IP address (10.1.1.1/24) is specified on the interface, you can set a secondary IP address such as 10.1.1.2/16 sub.
# Configure a primary IP address 10.102.0.1 and a secondary IP address 10.38.160.1 for GigabitEthernet 1/0/1. The subnet masks are both 255.255.255.0.
<sysname> system-view [sysname] interface GigabitEthernet 1/0/1 [sysname-GigabitEthernet1/0/1] ip address 10.102.0.1 255.255.255.0 [sysname-GigabitEthernet1/0/1] ip address 10.38.160.1 255.255.255.0 sub