Configuring IP Addresses on an Interface

This section describes how to configure IP addresses for a device so that the device can communicate with other devices on the network.

Usage Scenario

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.

  • For IP addresses in primary or secondary mode:
    • One primary IP address and multiple secondary IP addresses can be configured on an interface.
    • If a secondary IP address exists, the primary IP address cannot be deleted.
    • If both the primary and secondary IP addresses are configured for an interface on a device, you must delete the secondary IP address before enabling the device to ignore the primary and secondary IP addresses. Therefore, you need to plan the configuration in advance to ensure that user services of the secondary IP address are not affected.
  • For IP addresses whose primary or secondary status is ignored:
    • Multiple IP addresses can be configured on an interface.
    • Any IP address configured on an interface can be deleted.
    • If multiple IP addresses are configured on an interface of a device, the device cannot be configured to differentiate primary IP addresses from secondary IP addresses.
    • The ip address ignore primary-sub enable and ip address conflict check disable commands are mutually exclusive.

Pre-configuration Tasks

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.

Procedure

  • For IP addresses whose primary or secondary status is ignored:
    1. Run system-view

      The system view is displayed.

    2. Run ip address ignore primary-sub enable

      The device is enabled to ignore the primary or secondary status of IP addresses.

    3. Run commit

      The configuration is committed.

    4. Run interface interface-type interface-number

      The interface view is displayed.

    5. 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.

    6. Run commit

      The configuration is committed.

  • For IP addresses in primary or secondary mode:
    1. Run system-view

      The system view is displayed.

    2. (Optional) Run undo ip address ignore primary-sub enable

      The device is configured to differentiate primary IP addresses from secondary IP addresses.

    3. Run interface interface-type interface-number

      The interface view is displayed.

    4. 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.

    5. (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.

    6. Run commit

      The configuration is committed.

Verifying the Configuration

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >