Adds a DNAT entry to a Smart Access Gateway (SAG) instance.

Debug

Use OpenAPI Explorer to perform debug operations and generate SDK code examples.

Request parameters

Parameter Type Required? Example value Description
ExternalIp String Yes 10.10.**. **

The external public IP address.

ExternalPort String Yes 80

The public port.

Value range: 1 to 65535

InternalIp String Yes 192.168.0.1

The destination private IP address.

InternalPort String Yes 80

The destination private port.

Value range: 1 to 65535

IpProtocol String Yes TCP

The protocol type. Valid values:

  • TCP: Forwards packets of the TCP protocol.
  • UDP: Forwards packets of the UDP protocol.
  • Any: Forwards packets of all protocols.
RegionId String Yes cn-hangzhou

The ID of the region to which the SAG instance belongs.

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

The ID of the SAG instance.

Note Currently, only SAG instances created for SAG devices are supported.
Type String Yes Intranet

The DNAT type. Valid values:

  • Intranet (default): DNAT of private IP addresses.
  • Internet: DNAT of public IP addresses
Action String No AddDnatEntry

The name of this action.

Value: AddDnatEntry

Response parameters

Parameter Type Example value Description
DnatEntryId String dnat-m2obgkt5ya1p******

The ID of the DNAT entry.

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

The ID of the SAG instance.

Examples

Request example


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

Response example

XML format

<AddDnatEntryResponse>
	  <DnatEntryId>dnat-m2obgkt5ya1puz8qh1</DnatEntryId>
	  <RequestId>56BF6C79-C77D-41A0-86DD-A4B156E784EA</RequestId>
    </AddDnatEntryResponse>

JSON format

{
	"RequestId":"56BF6C79-C77D-41A0-86DD-A4B156E784EA",
	"DnatEntryId":"dnat-m2obgkt5ya1puz8qh1"
}

Errors

HTTP status code Error code Error message Description
403 Forbidden User not authorized to operate on the specified resource. You are not authorized to operate on this resource.
403 MissingParameter The input parameter is missing, please check your input. One or more required parameters are missing.
403 InvalidParameter The specified parameter is invalid. The specified parameter is invalid.
403 InternalError An internal server error occurred. An error of the internal service occurrs.
400 InvalidRegionID The specified regionId does not exist. The specified RegionId does not exist.
500 SmartAccessGatewayNotActivated The specified Smart Access Gateway has not been activated. The specified SAG device is not activated yet.
500 SmartAccessGatewayInArrears The specified Smart Access Gateway has expired. The specified SAG instance has expired and the service is stopped.
400 MissingParam You must specify the parameter. One or more required parameters are missing.
400 IllegalParam The parameter is invalid. The specified parameter is invalid.
403 FeatureNotSupport The current edition of the smart access gateway does not support this feature. The version of the SAG device does not support this function.
403 InvalidId.SMARTAG The specified smart access gateway instance id is invalid. The specified SAG ID is invalid.
400 DuplicatedDnatEntry The specified ExternalIp, IpProtocol, ExternalPort, InternalIp, and InternalPort are duplicated. The specified external IP address, IP protocol, external port, internal IP address, and internal port are being used by other DANT entries.

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