< Home

ip address

Function

The ip address command configures an IP address for an interface.

The undo ip address command deletes an IP address from an interface.

By default, no IP address is configured for an interface.

Format

ip address ip-address { mask | mask-length } [ sub ]

undo ip address [ ip-address { mask | mask-length } [ sub ] ]

Parameters

Parameter

Description

Value

ip-address

Specifies the IP address of an interface.

The value is in dotted decimal notation.

mask

Specifies a subnet mask.

The value is in dotted decimal notation.

mask-length

Specifies the mask length.

The value is an integer that ranges from 0 to 32.

sub

Configures a secondary IP address for an interface. This parameter is optional. To implement communication between multiple subnets of an interface, configure secondary IP addresses for the interface.

-

Views

Interface view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The ip address command configures IP addresses for interfaces on the switch so that the switch can communicate with different network segments. To connect an interface to multiple network segments, configure multiple IP addresses for the interface. Among these IP addresses, one is the primary IP address and the others are secondary IP addresses. If you configure a new primary IP address for the interface, the new IP address overrides the original one.

The following conditions are prohibited for different interfaces on the same switch:
  • The IP addresses are the same.
  • The broadcast addresses (with the host number field containing all 1s in the binary mode) corresponding to the IP addresses are the same. For example, if the IP address of interface A is 10.1.1.1/16 and its corresponding broadcast address is 10.1.255.255 and the IP address of interface B is 10.1.1.2/24 and its corresponding broadcast address is 10.1.1.255, the configuration is successful. However, if the IP address of interface B is also 10.1.1.2/16 and its corresponding broadcast address is also 10.1.255.255, the configuration fails.
  • The IP address of an interface is the same as the broadcast address of another interface. For example, if the IP address of interface A is 10.1.2.1/28 and its broadcast address is 10.1.2.15 and the IP address of interface B is 10.1.2.15/26, the configuration fails.

When you run the undo ip address command:

  • The undo ip address command deletes all IP addresses from an interface.
  • The undo ip address ip-address { mask | mask-length } command deletes the primary IP address of an interface.
  • The undo ip address ip-address { mask | mask-length } sub command deletes a secondary IP address.

Precautions

You can configure a secondary IP address only after configuring a primary IP address on the interface. You must delete all secondary IP addresses before deleting the primary IP address.

You can configure multiple IP addresses for a Layer 3 interface on the switch, one as the primary IP address, and the others as secondary IP addresses. Each Layer 3 interface can have a maximum of 31 secondary IP addresses.

The subnet IP address cannot be used as the IP address on an interface.

  • Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support Ethernet sub-interfaces.

  • Only hybrid and trunk interfaces on the preceding switches support Ethernet sub-interface configuration.
  • After you run the undo portswitch command to switch Layer 2 interfaces on the preceding series of switches into Layer 3 interfaces, you can configure Ethernet sub-interfaces on the interfaces.

  • After an interface is added to an Eth-Trunk, sub-interfaces cannot be configured on the interface.

  • VLAN termination sub-interfaces cannot be created on a VCMP client.

Example

# Configure a primary IP address 10.1.0.1 and a secondary IP address 10.2.0.1 for VLANIF10, with subnet mask 255.255.255.0.

<HUAWEI> system-view
[HUAWEI] interface vlanif 10
[HUAWEI-Vlanif10] ip address 10.1.0.1 255.255.255.0
[HUAWEI-Vlanif10] ip address 10.2.0.1 255.255.255.0 sub

# Configure a primary IP address 10.1.0.1 and a secondary IP address 10.2.0.1 for GE0/0/1, with subnet mask 255.255.255.0.

<HUAWEI> system-view
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] undo portswitch
[HUAWEI-GigabitEthernet0/0/1] ip address 10.1.0.1 255.255.255.0
[HUAWEI-GigabitEthernet0/0/1] ip address 10.2.0.1 255.255.255.0 sub
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >