This section describes how to configure IP addresses for a device so that the device can communicate with other devices on the network.
To run IP services on an interface, configure an IP address for the interface. Each interface on a device can be configured with multiple IP addresses. If IP addresses are configured in primary or secondary mode, one primary and multiple secondary IP addresses can be configured on an interface. If the primary or secondary status of IP addresses is ignored, the device does not differentiate primary IP addresses from secondary IP addresses.
If IP addresses are configured in primary or secondary mode, you need to configure only one primary IP address for an interface. In some special cases, you need to configure one or more secondary IP addresses for an interface. For example, a device connects to a physical network through one of its interfaces. Hosts on the physical network belong to two different Class C networks. To allow the device to communicate with all the hosts on the physical network, configure a primary IP address and a secondary IP address for the interface on the device.
If the device ignores the primary or secondary status of IP addresses, you need to configure only one IP address for an interface. In some special cases, you need to configure multiple IP addresses for an interface. For example, multiple IP addresses need to be configured on an interface to differentiate user services. To delete an IP address on an interface without affecting other IP addresses during a service cutover, enable the device to ignore the primary or secondary status of IP addresses so that any IP address configured on the interface can be deleted.
By default, IP addresses are configured in primary or secondary mode.
Before configuring IP addresses on an interface, configure link layer protocol parameters for the interface and ensure that the link layer protocol of the interface is Up.
Run system-view
The system view is displayed.
Run ip address ignore primary-sub enable
The device is enabled to ignore the primary or secondary status of IP addresses.
Run commit
The configuration is committed.
Run interface interface-type interface-number
The interface view is displayed.
Run ip address ip-address { mask | mask-length }
An IP address is configured for the interface.
Run this command multiple times on the interface to configure multiple IP addresses for the interface.
A maximum of 256 IP addresses can be configured for each interface.
Run commit
The configuration is committed.
Run system-view
The system view is displayed.
(Optional) Run undo ip address ignore primary-sub enable
The device is configured to differentiate primary IP addresses from secondary IP addresses.
Run interface interface-type interface-number
The interface view is displayed.
Run ip address ip-address { mask | mask-length }
A primary IP address is configured.
An interface can have only one primary IP address. If the ip address ip-address { mask | mask-length } command is run more than once to configure a primary IP address for an interface, the latest configuration overrides the previous one.
(Optional) Run ip address ip-address { mask | mask-length } sub
A secondary IP address is configured for the interface.
To save the IP address space, you can configure secondary IP addresses with 31-bit masks for an interface.
A maximum of 255 secondary IP addresses can be configured for each interface.
Run commit
The configuration is committed.