All Products
Document Center

Virtual Private Cloud:ModifyForwardEntry

Last Updated:Dec 01, 2023

Modifies a DNAT entry.

Operation Description

  • ModifyForwardEntry is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the DescribeForwardTableEntries operation to query the status of the task.

    • Pending: indicates that the system is modifying the DNAT entry. You can only query the DNAT entry, but cannot perform other operations.
    • Available: indicates that the DNAT entry is modified.
  • You cannot repeatedly call the ModifyForwardEntry operation to modify a DNAT entry within the specified period of time.


You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.


Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
  • ForwardTable

Request parameters


The ID of the DNAT table to which the DNAT entry belongs.


The ID of the DNAT entry.

  • When you modify DNAT entries of Internet NAT gateways, this parameter specifies the elastic IP addresses (EIPs) that are used to access the Internet.
  • When you modify DNAT entries of Virtual Private Cloud (VPC) NAT gateways, this parameter specifies the NAT IP addresses that are accessed by external networks.
  • The external port that is used to forward traffic when you modify DNAT entries of Internet NAT gateways.

    • Valid values: 1 to 65535.
    • If you want to modify the port range, separate port numbers with a forward slash (/), such as 10/20.
    • If you need to modify ExternalPort and InternalPort at the same time, and ExternalPort specifies a port range, make sure that InternalPort also specifies a port range, and both ranges specify the same number of ports. For example, you can set ExternalPort to 10/20 and InternalPort to 80/90.
  • The port that is accessed by external networks when you modify DNAT entries of VPC NAT gateways. Valid values: 1 to 65535.

  • The private IP address of the ECS instance that uses DNAT entries to communicate with the Internet when you modify DNAT entries of Internet NAT gateways.
  • The private IP address that uses DNAT entries to communicate when you modify DNAT entries of VPC NAT gateways.
  • The internal port or port range that is used to forward traffic when you modify DNAT entries of Internet NAT gateways. Valid values: 1 to 65535.
  • The port of the destination ECS instance to be mapped when you modify DNAT entries of VPC NAT gateways. Valid values: 1 to 65535.

The protocol. Valid values:

  • TCP
  • UDP
  • Any

The new name of the DNAT entry.

The name must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://.


The region ID of the NAT gateway.

You can call the DescribeRegions operation to query the most recent region list.


The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The client token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.

Specifies whether to remove limits on the port range. Valid values:

  • true
  • false If an SNAT entry and a DNAT entry use the same public IP address, and you want to specify a port number greater than 1024, set PortBreak to true.

Response parameters


The request ID.


The request ID.



Sample success responses


  "RequestId": "2315DEB7-5E92-423A-91F7-4C1EC9AD97C3"

Error codes

HTTP status codeError codeError messageDescription
400UnsupportedFeature.PortSegmentThe feature of PortSegment is not supported.-
400ExclusiveParam.%sAnd%sThe param of %s and %s are mutually exclusive.You cannot specify %s and %s at the same time.
400InvalidIp.NotInNatgwThe specified Ip not belong to natgateway.The specified EIP is not associated with the NAT gateway.
400DuplicatedParam.InternalPortThe param of %s is duplicated.Duplicate parameters are specified for %s.
400DuplicatedParam.ExternalPortThe param of %s is duplicated.Duplicate parameters are specified for %s.
400OperationFailed.AnyPortConfigOperation failed because any port correspondence any protocolThe operation failed because any port corresponds to any protocol.
400OperationUnsupported.ForwardEntryDuplicated destination ip port is unsupported.You cannot specify duplicate destination IP addresses or destination ports.
400IncorrectStatus.NatIpThe status of %s [%s] is incorrect.The status of NatIp is incorrect.
400Forbidden.IpHasBeenUsedInSnatThe source ip can't be used. Because it has been used in snat.-
400IncorrectStatus.ForwardEntryThe status of %s [%s] is incorrect.The DNAT entry to be deleted is in an invalid state.
400InvalidExternalIp.MalformedThe specified ExternalIp is not a valid IP address.The specified EIP is invalid.
400InvalidInternalIp.MalformedThe specified InternalIp is not a valid IP address.The specified destination private IP address is invalid.
400InvalidExternalPort.MalformedThe specified ExternalPort is not a valid port.The specified public port is invalid.
400InvalidInternalPort.MalformedThe specified InternalPort is not a valid port.The specified private port is invalid.
400Forbidden.DestnationIpOutOfVpcCIDRThe specified Destination Ip is Out of VPC CIDR.The specified private IP address does not fall within the CIDR block of the VPC. Enter a private IP address that falls within the CIDR block of the VPC.
400Forbidden.DestinationIpOutOfVswitchCIDRThe specified Internal Ip is Out of VSwitch CIDR.-
400InvalidProtocal.ValueNotSupportedThe specified IpProtocol does not support.The specified protocol is not supported.
400IncorretForwardEntryStatusSome Forward entry status blocked this operation..The operation is not supported because one or more DNAT entries in the DNAT table are in the Pending or Modifying state.
400QuotaExceededForward entry quota exceeded in this route table.A route table can only have 200 custom route entries at most.
400ForwardEntry.DuplicatedThe specified ExternalIp, IpProtocol, ExternalPort,InternalIp, InternalPort is duplicated-
400Forbidden.ExternalIp.UsedInSnatTableThe specified ExternalIp is already used in SnatTableThe specified EIP is already used by an SNAT entry. Select a different EIP or delete the SNAT entry.
400Forbidden.Already.BoundedThe specified instance already boundedThe specified instance is associated.
400InvalidIp.NotFoundThe specified ip does not exist.-
400InvalidParameter.Name.MalformedThe specified Name is not valid.The specified name format is invalid. Enter the name in the valid format.
400IncorretForwardEntryStatusThe Specified forwardEntry is not stable status, can not operation-
400IncorretStatus.ForwardEntryThe Specified forwardEntry is not stable status, can not operation-
400IllegalParam.AnyPortNotZeroAny port port must be zero.You must set the destination port and source port to 0 when IpProtocol is set to Any.
400Duplicated.DestinationPortThe specified param DestinationPort is duplicated.-
400InvalidForwardEntryId.NotFoundSpecified forward entry ID does not existThe specified DNAT entry does not exist.
400OperationUnsupported.EipInBindingCreate snat entry with eip in associating status is unsupported.You cannot use an associated EIP when you create an SNAT entry.
400QuotaExceeded.ForwardEntrySessionManytoOneThe dnat session quota is exceed.The number of DNAT sessions exceeds the upper limit.
404ResourceNotFound.NatIpThe specified resource of %s is not found.The specified NatIp parameter is not found.
404ResourceNotFound.ForwardEntryThe specified resource of %s is not found.The specified %s resource does not exist.
404InvalidRegionId.NotFoundThe specified RegionId does not exist in our records.The specified region ID does not exist.
404InvalidExternalIp.NotFoundSpecified External Ip address does not found on the VRouterThe specified EIP does not exist.
404InvalidForwardTableId.NotFoundSpecified forward table does not exist.The specified DNAT table does not exist. Check the parameter and try again.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-03-01The error codes of the API operation change.see changesets
Change itemChange content
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
    delete Error Codes: 404