IP Address and MTU Management
This section describes the configuration model of IP address and MTU management on an interface and provides examples of XML packets.
Data Model
The configuration model files matching IP address and MTU management on an interface are ietf-ip.yang and huawei-ip.yang.
Only VLANIF interfaces, loopback interfaces, and VBDIF interfaces support the configuration.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/ip |
Configures the IPv4 address of an interface. |
The value is in dotted decimal notation. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/netmask |
Configures an IPv4 subnet mask. |
The value is in dotted decimal notation. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/prefix-length |
Configures the IPv4 mask length. |
The value is an integer that ranges from 0 to 32. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/huawei-ip:ip-address-sub |
Configures a secondary IPv4 address for an interface. |
The value is a string of spaces only with no limited length. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/mtu |
Configures the IPv4 MTU of an interface. |
The value is an integer that ranges from 128 to 9216, in bytes. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/enabled |
Configures the IPv6 function on an interface. |
The value is of the Boolean type:
The default value is false. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/mtu |
Configures the IPv6 MTU of an interface. |
The value is an integer that ranges from 1280 to 9600, in bytes. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/dup-addr-detect-transmits |
Configures the number of times neighbor solicitation (NS) packets are sent during duplicate address detection (DAD). |
The value is an integer that ranges from 0 to 600. The default value is 1. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address/ip |
Configures the IPv6 address of an interface. |
The total length of the value is 128 bits. The string is divided into eight groups, each of which consists of four hexadecimal digits. The value is in the format of X:X:X:X:X:X:X:X. |
N/A |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv6/address/prefix-length |
Configures the prefix length of an IPv6 address. |
The value is an integer that ranges from 1 to 128. |
N/A |
/ietf-interfaces:interfaces-state/interface/ipv4/forwarding |
Queries the IPv4 protocol status of an interface. |
The value is of the Boolean type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/mtu |
Queries the IPv4 MTU of an interface. |
The value is an integer. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/address/ip |
Queries the IPv4 address of an interface. |
The value is in dotted decimal notation. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/address/subnet/netmask |
Queries the IPv4 subnet mask of an interface. |
The value is in dotted decimal notation. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/address/origin |
Queries the IPv4 address type of an interface. |
The value is of the enumerated type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/neighbor/ip |
Queries the IP address in the ARP entry learned by an interface. |
The value is in dotted decimal notation. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/neighbor/link-layer-address |
Queries the MAC address in the ARP entry learned by an interface. |
The value is in the format of H-H-H. Each H is a hexadecimal number of 1 to 4 digits. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv4/neighbor/origin |
Queries the type of the ARP entry learned by an interface. |
The value is of the enumerated type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/forwarding |
Queries the IPv6 protocol status of an interface. |
The value is of the Boolean type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/mtu |
Queries the IPv6 MTU of an interface. |
The value is an integer. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/ip |
Queries the IPv6 address of an interface. |
The total length of the value is 128 bits. The string is divided into eight groups, each of which consists of four hexadecimal digits. The value is in the format of X:X:X:X:X:X:X:X. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/prefix-length |
Queries the IPv6 address prefix length of an interface. |
The value is an integer. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/origin |
Queries the IPv6 address type of an interface. |
The value is of the enumerated type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/status |
Queries the IPv6 address status of an interface. |
The value is of the enumerated type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/ip |
Queries the address of an IPv6 neighbor. |
The total length of the value is 128 bits. The string is divided into eight groups, each of which consists of four hexadecimal digits. The value is in the format of X:X:X:X:X:X:X:X. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/link-layer-address |
Queries the MAC address of an IPv6 neighbor. |
The value is in the format of H-H-H. Each H is a hexadecimal number of 1 to 4 digits. |
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/origin |
Queries the IPv6 neighbor entry type. |
The value is of the enumerated type:
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/is-router |
Queries whether the NA packet sent by an IPv6 neighbor carries the R flag. |
The value is a character string.
|
This object only supports the get operation. |
/ietf-interfaces:interfaces-state/interface/ipv6/address/neighbor/state |
Queries the status of an IPv6 neighbor entry. |
The value is of the enumerated type:
|
This object only supports the get operation. |
Configuring an IP Address for an Interface
This section describes how to configure an IP address for an interface using the edit-config:merge method.
Operation |
XPATH |
---|---|
edit-config:merge |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address |
Data requirement
Item |
Data |
Description |
---|---|---|
IP address of an interface |
10.1.1.1 |
Indicates that the IP address of the interface is 10.1.1.1. |
Mask length |
24 |
Indicates that the mask length is 24. |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="3" 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.1</ip:ip> <ip:prefix-length>24</ip:prefix-length> </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="3"> <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="3"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-message>parse rpc config error.</error-message> </rpc-error> </rpc-reply>
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.
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>
Configuring the MTU for an Interface
This section describes how to configure the MTU for an interface using the edit-config:merge method.
Operation |
XPATH |
---|---|
edit-config:merge |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/mtu |
Data requirement
Item |
Data |
Description |
---|---|---|
MTU of an interface |
1200 |
Indicates that the MTU of the interface is 1200 bytes. |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="5" 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:mtu>1200</ip:mtu> </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="5"> <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="5"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message>Wrong parameter.</error-message> <error-info>Error on node /ietf-interfaces:interfaces/interface[name="Vlanif101"]/ietf-ip:ipv4/mtu</error-info> </rpc-error> </rpc-reply>
Configuring the IPv6 Address and MTU of an Interface
This section provides a sample of configuring the IPv6 address and MTU of an interface using the edit-config:merge method.
Operation |
XPATH |
---|---|
edit-config:merge |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv6 |
Data Requirements
Item |
Data |
Description |
---|---|---|
Interface name |
Vlanif100 |
Configure VLANIF 100. |
Interface type |
iana-if-type:propVirtual |
|
IPv6 function on an interface |
true |
Enable the IPv6 function on the interface. |
IPv6 MTU of an interface |
1280 |
Set the IPv6 MTU of the interface to 1280 bytes. |
IPv6 address of an interface |
fc00::1 |
Set the IPv6 address of the interface to fc00::1. |
Prefix length of an IPv6 address |
64 |
Set the prefix length of the IPv6 address to 64. |
Number of times neighbor solicitation (NS) packets are sent during duplicate address detection (DAD) |
20 |
Set the number of times NS packets sent by the switch during DAD to 20. |
Request Example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="5" 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>Vlanif100</if:name> <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type> <ip:ipv6 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip"> <ip:enabled>true</ip:enabled> <ip:mtu>1280</ip:mtu> <ip:address> <ip:ip>fc00::1</ip:ip> <ip:prefix-length>64</ip:prefix-length> </ip:address> <ip:dup-addr-detect-transmits>20</ip:dup-addr-detect-transmits> </ip:ipv6> </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="5"> <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="5"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message>Wrong parameter.</error-message> <error-info>Error on node /ietf-interfaces:interfaces/interface[name="Vlanif100"]/ietf-ip:ipv6/mtu</error-info> </rpc-error> </rpc-reply>
Querying IPv4 and IPv6 Configuration Information of an Interface
This section provides a sample of querying IPv4 and IPv6 configuration information of an interface using the get method.
Operation |
XPATH |
---|---|
get |
/ietf-interfaces:interfaces-state/interface |
Request Example
Query IPv4 and IPv6 configuration information of VLANIF 100.
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="4" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <get> <filter type="subtree"> <if:interfaces-state xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface> <if:name>Vlanif100</if:name> </if:interface> </if:interfaces-state> </filter> </get> </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"> <data> <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface> <name>Vlanif100</name> <type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</type> <admin-status>up</admin-status> <oper-status>up</oper-status> <if-index>417</if-index> <phys-address>fc:e3:3c:9f:17:64</phys-address> <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"> <forwarding>true</forwarding> <mtu>1700</mtu> <address> <ip>10.1.1.1</ip> <netmask>255.255.255.0</netmask> <origin>static</origin> </address> <neighbor> <ip>10.1.1.10</ip> <link-layer-address>00:01:00:02:00:03</link-layer-address> <origin>static</origin> </neighbor> </ipv4> <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"> <forwarding>true</forwarding> <mtu>1600</mtu> <address> <ip>FE80::FEE3:3CFF:FE9F:1764</ip> <prefix-length>64</prefix-length> <origin>static</origin> <status>preferred</status> </address> <address> <ip>2001::1</ip> <prefix-length>64</prefix-length> <origin>static</origin> <status>preferred</status> </address> <neighbor> <ip>2001::10</ip> <link-layer-address>00:01:00:01:00:01</link-layer-address> <origin>static</origin> <is-router> </is-router> <state>reachable</state> </neighbor> </ipv6> </interface> </interfaces-state> </data> </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"> <data/> </rpc-reply>