Add a Port Forwarding Rule

Last updated: 2020-06-04 18:43:20


    This is a legacy API which has been hidden and will no longer be updated. We recommend using the new VPC API 3.0 which is standardized and faster.

    1. API Description

    This API (AddDnaptRule) is used to add NAT gateway port forwarding rules.
    Domain name for API requests:

    Before using this API, go to About NAT Gateway to learn about the features of NAT gateways.

    2. Input Parameters

    The following request parameter list only provides API request parameters. Common request parameters are required when the API is called. For more information, see the Common Request Parameters page. The Action field for this API is AddDnaptRule.

    Parameter name Required Type Description
    vpcId Yes String VPC ID, for example: vpc-8e0ypm3z.
    natId Yes String NAT gateway ID, for example: nat-dqbak2vy.
    proto Yes String Protocol, available values: tcp and udp.
    eip Yes String External IP address, namely the associated EI.P
    eport Yes String External port number.
    pip Yes String Internal IP address.
    pport Yes String Internal port number.
    description No String Rule description.

    3. Output Parameters

    Parameter name Type Description
    code Int Error code. 0: Successful; other values: Failed.
    message string Error message.

    4. Error Codes

    The following error codes only include business logic error codes for this API. For additional common error codes, see VPC Error Codes.

    Error code Description
    29151 The length of rule description exceeded the limit.
    29152 Rules conflict. The EIP already exists.
    29153 The internal IP address has not been bound to any instance.
    -3325 The EIP does not exist.
    -3326 The internal IP address is not within the VPC.
    -3327 Rules conflict. The internal IP address already exists.
    -3328 The maximum number of port forwarding rules has been reached.
    -3344 The internal IP address is not within the CVM.

    5. Example



        "code": "0",
        "message": ""

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback