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

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AddDnatEntry

The operation that you want to perform. Set the value to AddDnatEntry.

RegionId String Yes cn-hangzhou

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

SagId String Yes sag-kdhg*******

The ID of the SAG instance.

Note Only SAG instances used to manage SAG devices support DNAT.
Type String Yes Intranet

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.
ExternalIp String No 10.10.1.xx

The public IP address.

Note If the DNAT entry is used to forward packets transmitted over the Internet, the DNAT entry automatically recognizes the current public IP address.
ExternalPort String Yes 80

The public port.

Valid values: 1 to 65535.

InternalIp String Yes 192.168.0.1

The destination private IP address.

IpProtocol String Yes TCP

The protocol used in DNAT. Valid values:

  • TCP: forwards TCP packets.
  • UDP: The NAT gateway forwards UDP packets.
  • Any: forwards packets of all protocols.
InternalPort String Yes 80

The destination private port.

Valid values: 1 to 65535.

Response parameters

Parameter Type Example Description
RequestId String 56BF6C79-C77D-41A0-86DD-A4B156E784EA

The ID of the request.

DnatEntryId String fwd-kxe4fq3xuzczze****

The ID of the DNAT entry.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddDnatEntry
&RegionId=cn-hangzhou
&SagId=sag-kdhg*******
&Type=Intranet
&ExternalIp=10.10.1.xx
&ExternalPort=80
&InternalIp=192.168.0.1
&IpProtocol=TCP
&InternalPort=80
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddDnatEntryResponse>
	  <DnatEntryId>fwd-kxe4fq3xuzczze****</DnatEntryId>
	  <RequestId>56BF6C79-C77D-41A0-86DD-A4B156E784EA</RequestId>
</AddDnatEntryResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 InvalidRegionID The specified regionId does not exist. The error message returned because the specified region ID does not exist.
400 MissingParam You must specify the parameter. The error message returned because a required parameter is not set.
400 IllegalParam The parameter is invalid. The error message returned because a parameter is set to an invalid value.
400 DuplicatedDnatEntry The specified ExternalIp, IpProtocol, ExternalPort, InternalIp, and InternalPort are duplicated. The error message returned because the specified public IP address, protocol, external-facing port, internal IP address, or Internal-facing port conflict is invalid.
400 SmartAccessGatewayNotActivated The specified Smart Access Gateway has not been activated. The error message returned because the specified SAG instance is not activated. Activate the SAG instance first.
400 SmartAccessGatewayInArrears The specified Smart Access Gateway has expired. The error message returned because the specified SAG instance has expired. Renew the SAG instance.
403 Forbidden User not authorized to operate on the specified resource. The error message returned because you do not have the permissions to manage the specified resource.
403 MissingParameter The input parameter is missing, please check your input. The error message returned because one or more required parameters are not set. Check whether you have set all required parameters.
403 InvalidParameter The specified parameter is invalid. The error message returned because a parameter is set to an invalid value.
403 InternalError An internal server error occurred. The error message returned because an internal server error occurred.
403 FeatureNotSupport The current edition of the smart access gateway does not support this feature. The error message returned because the current version of the specified SAG device does not support this feature.
403 InvalidId.SMARTAG The specified smart access gateway instance id is invalid. The error message returned because the specified SAG instance ID is invalid.

For a list of error codes, visit the API Error Center.