< Home

Configuring the DHCPv6 Relay Function

This section provides a sample of configuring the DHCPv6 relay function using the rpc method.

Table 1 Configuring the DHCPv6 relay function

Operation

XPATH

rpc

  • /huawei-dhcp:dhcp-config/dhcpv4-config/enable

  • /huawei-dhcp:dhcp-config/dhcpv6-config/dhcp-relay-configuration

Data Requirements

Item

Data

Whether DHCP is enabled

true

Name of the interface where DHCPv6 relay is enabled

VLANIF4000

IPv6 address of the proxy DHCPv6 server

fe80:2::1

Name of the source interface

Loopback2

Request Example

Ensure that VLANIF4000 and its IPv6 address have been configured and the IPv6 address of LoopBack2 has been configured before configuring this example.
<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 xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge">
                    <if:name>Vlanif4000</if:name>
                    <if:type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:propVirtual</if:type>
                    <ip:ipv6 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip">
                        <ip:enabled>true</ip:enabled>
                    </ip:ipv6>
                </if:interface>
                <if:interface xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">
                    <if:name>LoopBack2</if:name>
                    <if:type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:softwareLoopback</if:type>
                </if:interface>
            </if:interfaces>
            <hw-dhcp:dhcp-config xmlns:hw-dhcp="urn:huawei:params:xml:ns:yang:huawei-dhcp">
                <hw-dhcp:dhcpv4-config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge">
                    <hw-dhcp:enable>true</hw-dhcp:enable>
                </hw-dhcp:dhcpv4-config>
                <hw-dhcp:dhcpv6-config>
                    <hw-dhcp:dhcp-relay-configuration xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="replace">
                        <hw-dhcp:dhcp-relays>
                            <hw-dhcp:dhcp-relay>
                                <hw-dhcp:interface-name>Vlanif4000</hw-dhcp:interface-name>
                                <hw-dhcp:server-ip>fe80:2::1</hw-dhcp:server-ip>
                                <hw-dhcp:source-interface-name>LoopBack2</hw-dhcp:source-interface-name>
                            </hw-dhcp:dhcp-relay>
                        </hw-dhcp:dhcp-relays>                      
                    </hw-dhcp:dhcp-relay-configuration>
                </hw-dhcp:dhcpv6-config>
            </hw-dhcp:dhcp-config>
        </config>
    </edit-config>
</rpc>

Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123">
  <ok/>
</rpc-reply>

Sample of failed response

<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-path>/huawei-dhcp:dhcp-config/dhcpv6-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name='Vlanif4000']/server-ip[.='10.1.2.5']</error-path>
    <error-message>parse rpc config error.(Value "10.1.2.5" does not satisfy the constraint "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?" (range, length, or pattern).).</error-message>
  </rpc-error>
</rpc-reply>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >