< Home

Configuring a Secondary IP Address for an Interface

This section describes how to configure a secondary IP address for an interface using the edit-config:merge method.

Table 1 Configuring a Secondary IP Address for an Interface

Operation

XPATH

edit-config:merge

/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address

Data requirement

Item

Data

Description

IP address

10.1.1.2

Indicates that the IP address of the interface is 10.1.1.2.

Mask length

24

Indicates that the mask length is 24.

Secondary IP address

A space

Indicates that this is a secondary IP address for the interface.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="4" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
        <if:interface>
          <if:name>Vlanif101</if:name>
          <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type>
          <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
            <ip:address>
              <ip:ip>10.1.1.2</ip:ip>
              <ip:prefix-length>24</ip:prefix-length>
              <hw-ip:ip-address-sub xmlns:hw-ip="urn:huawei:params:xml:ns:yang:hw-ip"> </hw-ip:ip-address-sub>
            </ip:address>
          </ip:ipv4>
        </if:interface>
      </if:interfaces>
    </config>
  </edit-config>
</rpc>

Response example

Sample of successful response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4">
  <ok/>
</rpc-reply>

Sample of failed response

<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4">
  <rpc-error>
    <error-app-tag>1</error-app-tag>
    <error-message>Service process failed.</error-message>
    <error-info>Error on node /ietf-interfaces:interfaces/interface[name="Vlanif101"]/ietf-ip:ipv4/address[ip="10.1.1.2"]</error-info>
  </rpc-error>
</rpc-reply>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >