All Products
Search
Document Center

Smart Access Gateway:AddDnatEntry

Last Updated:Aug 28, 2026

Adds a destination network address translation (DNAT) entry to a Smart Access Gateway (SAG) instance.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

smartag:AddDnatEntry

*SmartAccessGateway

acs:smartag:{#regionId}:{#accountId}:smartag/{#SmartAGId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region where the SAG instance is deployed.

cn-hangzhou

SagId

string

Yes

The ID of the SAG instance.

Note

Only SAG instances used to manage SAG devices support DNAT.

sag-kdhg*******

Type

string

No

The type of the DNAT entry. Valid values:

  • Intranet: translates the destination IP address to a specific internal IP address. This is the default value.

  • Internet: translates the destination IP address to a specific public IP address.

Intranet

ExternalIp

string

No

The public IP address.

Note

For Internet-type DNAT entries, the current public IP address is automatically recognized.

10.10.1.xx

ExternalPort

string

Yes

The public port.

Valid values: 1 to 65535.

80

InternalIp

string

Yes

The destination private IP address.

192.168.0.1

IpProtocol

string

Yes

The protocol used in DNAT. Valid values:

  • TCP: forwards TCP packets.

  • UDP: forwards UDP packets.

  • Any: forwards packets of all protocols.

TCP

InternalPort

string

Yes

The destination private port.

Valid values: 1 to 65535.

80

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

56BF6C79-C77D-41A0-86DD-A4B156E784EA

DnatEntryId

string

The ID of the DNAT entry.

fwd-kxe4fq3xuzczze****

Examples

Success response

JSON format

{
  "RequestId": "56BF6C79-C77D-41A0-86DD-A4B156E784EA",
  "DnatEntryId": "fwd-kxe4fq3xuzczze****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidRegionID The specified regionId does not exist. The specified region ID does not exist.
400 MissingParam You must specify the parameter. A required parameter is not set.
400 IllegalParam The parameter is invalid. A parameter is set to an invalid value.
400 DuplicatedDnatEntry The specified ExternalIp, IpProtocol, ExternalPort, InternalIp, and InternalPort are duplicated. The specified public IP address, port, public port, private IP address, and private port overlap.
400 SmartAccessGatewayNotActivated The specified Smart Access Gateway has not been activated. The specified SAG instance is inactive. You must activate the instance first.
400 SmartAccessGatewayInArrears The specified Smart Access Gateway has expired. The specified Smart Access Gateway has expired.
400 QuotaExceeded.DnatPerSag The maximum number of dnat rules in an SAG is exceeded. You can open a ticket to increase the quota. The maximum number of dnat rules in an SAG is exceeded. You can open a ticket to increase the quota.
403 Forbidden User not authorized to operate on the specified resource. You do not have permissions to manage the specified resource.
403 MissingParameter The input parameter is missing, please check your input. Missing parameters. Check whether all required parameters are set.
403 InvalidParameter The specified parameter is invalid. Invalid parameters.
403 InternalError An internal server error occurred. An internal server error occurred.
403 FeatureNotSupport The current edition of the smart access gateway does not support this feature. The current version of Smart Access Gateway does not support this feature.
403 InvalidId.SMARTAG The specified smart access gateway instance id is invalid. The SAG instance ID is invalid.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.