ip address
Use ip address to assign an IP address to the interface.
Use undo ip address to remove the IP address from the interface.
Syntax
ip address ip-address { mask-length | mask } [ irf-member member-id | sub ]
undo ip address [ ip-address { mask-length | mask } [ irf-member member-id | sub ] ]
Default
No IP address is assigned to an interface.
Views
Interface view
Predefined user roles
network-admin
Parameters
ip-address: Specifies the IP address of the interface, in dotted decimal notation.
mask-length: Specifies the subnet mask length in the range of 1 to 31. For a loopback interface, the value range is 1 to 32.
mask: Specifies the subnet mask in dotted decimal notation.
irf-member member-id: Assigns an IP address to the management Ethernet port of the specified IRF member device. The member-id argument specifies an IRF member device by its member ID in the range of 1 to 10.
sub: Assigns a secondary IP address to the interface.
Usage guidelines
Use the command to configure a primary IP address for an interface. If the interface connects to multiple subnets, configure primary and secondary IP addresses on the interface so the subnets can communicate with each other through the interface.
An interface can have only one primary IP address. A newly configured primary IP address overwrites the previous address.
You cannot assign secondary IP addresses to an interface that obtains an IP address through BOOTP, DHCP, or IP unnumbered.
The undo ip address command removes all IP addresses from the interface. The undo ip address ip-address { mask | mask-length } command removes the primary IP address. The undo ip address ip-address { mask | mask-length } sub command removes a secondary IP address. Before removing the primary IP address, remove all secondary IP addresses.
The primary and secondary IP addresses you assign to the interface can be located on the same network segment, but different interfaces on your device must reside on different network segments.
The IP addresses assigned to the management Ethernet ports of all IRF member devices must be in the same subnet. In an IRF fabric, only the IP address assigned to the management Ethernet port of the master takes effect. Make sure no IP address conflict exists when you assign IP addresses to the management Ethernet ports of subordinates. The system does not warn of an IP address conflict because the IP addresses assigned to the management Ethernet ports of subordinates do not take effect. After an IRF fabric split, the IP addresses assigned to the management Ethernet ports of the new masters (original subordinates) take effect.
Examples
# Assign VLAN-interface 10 a primary IP address 129.12.0.1 and a secondary IP address 202.38.160.1, with subnet masks both 255.255.255.0.
<Sysname> system-view [Sysname] interface vlan-interface 10 [Sysname-Vlan-interface10] ip address 129.12.0.1 255.255.255.0 [Sysname-Vlan-interface10] ip address 202.38.160.1 255.255.255.0 sub
Related commands
display ip interface
display ip interface brief