You need to enable JavaScript to run this app.
文档中心
NAT网关

NAT网关

复制全文
下载 pdf
DNAT规则
CreateDnatEntry - 创建DNAT规则
复制全文
下载 pdf
CreateDnatEntry - 创建DNAT规则
调用 CreateDnatEntry 接口,创建一条DNAT规则。​
使用说明​
单个NAT网关支持创建DNAT规则的数量为100条。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:CreateDnatEntry​
要执行的操作,取值:CreateDnatEntry。​
​
Version string 必选 示例值:2020-04-01​
API的版本,取值:2020-04-01。​
​
Protocol string 必选 示例值:tcp​
协议类型。取值如下:​
  • 当PortType 传入specified,可以传入如下取值:​
  • tcp:转发TCP协议的报文。​
  • udp:转发UDP协议的报文。​
  • 当PortType 传入any,则本参数必须传入any,表示转发所有协议的报文。​
​
DnatEntryName string 可选 示例值:dnat-01​
DNAT规则的名称。需要以字母、中文或数字开头,可包含点号(.)、下划线(_)和短划线(-)。 长度限制为1 ~ 128个字符。 不填默认是DNAT规则的ID。​
​
ExternalIp string 必选 示例值:12.XX.XX.34​
NAT网关用于网络地址转换的IP地址。​
  • 当NAT网关为公网NAT网关时,传入其绑定的公网IP地址。​
  • 当NAT网关为私网NAT网关时,传入其中转IP地址。​
​
InternalIp string 必选 示例值:192.XX.XX.88​
云服务器实例的私网IP。​
​
InternalPort string 必选 示例值:12​
云服务器实例私网IP的端口或端口段。​
  • 当PortType 传入any,则本参数必须传入any,表示所有端口。​
  • 当PortType 传入specified:​
  • 端口范围为1~65535。​
  • 若传入端口段,则起止端口之间用短横线(-)分隔,例如20-25。​
​
ExternalPort string 必选 示例值:34​
接收来自外部请求的端口或端口段。​
  • 当PortType 传入any,则本参数必须传入any,表示所有端口。​
  • 当PortType 传入specified:​
  • 端口范围为1~65535。​
  • 若InternalPort传入端口段,则ExternalPort也必须传入端口段,且二者的端口数量相同,起止端口之间用短横线(-)分隔,例如InternalPort传入20-25,ExternalPort传入30-35。​
​
PortType string 可选 示例值:specified​
DNAT规则的端口类型。​
  • specified(默认):指定端口。​
  • any:任意端口。即DNAT IP映射。​
​
NatGatewayId string 必选 示例值:ngw-2feq5xhimd88w59gp686****​
DNAT规则所属的NAT网关ID。您可以调用 DescribeNatGateways 接口,查询NAT网关的ID。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
DnatEntryId string 示例值:dnat-342abc3bc3****​
DNAT规则的ID。​
​
RequestId string 示例值:2021062415303301022514515207C4****​
请求ID。​
​
​
​
请求示例​
​
GET /?Action=CreateDnatEntry&Version=2020-04-01&NatGatewayId=ngw-2feq5xhimd88w59gp686****&Protocol=tcp&InternalIp=192.XX.XX.88&InternalPort=12&ExternalIp=12.XX.XX.34&ExternalPort=34 HTTP/1.1​
Host: natgateway.cn-beijing.volcengineapi.com​
ServiceName: natgateway​
Region: cn-beijing​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "2021062415303301022514515207C4****",​
"Action": "CreateDnatEntry",​
"Version": "2020-04-01",​
"Service": "natgateway",​
"Region": "cn-beijing"​
},​
"Result":{​
"RequestId": "2021062415303301022514515207C4****",​
"DnatEntryId": "dnat-342abc3bc3****"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
400​
MissingParameter​
The request is missing a required parameter.​
该请求缺少必要参数。​
400​
InvalidEip.InvalidStatus​
The specified elastic ip is not in the correct status for the request. The specified elastic ip is in freeze.​
指定的弹性公网IP或私有网络所处的状态无法响应该请求。当前弹性公网IP被冻结。​
400​
QuotaExceeded.DnatEntry​
You've reached the limit on the number of DnatEntry that you can create.​
已达到可创建的DNAT规则数量上限。​
400​
InvalidProtocol.Malformed​
The specified protocol is malformed.​
指定的协议不合法。​
400​
InvalidPort.Malformed​
The specified port is malformed. Ensure that you've specified the port in right form and internal port and external port must have the same number of ports.​
指定的端口不合法。请确保指定的端口格式正确,且私网端口和公网端口数量必须一致。​
400​
InvalidNatGateway.InvalidStatus​
The specified NAT gateway is not in the correct status for the request.​
指定的NAT网关所处的状态无法响应该请求。​
400​
InvalidIPAddress.Malformed​
The specified IP address is malformed.​
指定的IP不合法。​
400​
InvalidEip.InstanceIdMismatch​
The specified elastic ip and instance mismatch.​
指定的公网IP和实例不匹配。​
400​
InvalidExternalIP.InUse​
The specified external ip has been used by another snat entry.​
指定的EIP已被其他SNAT规则使用。​
400​
InvalidNatGateway.UnSupportAction​
The specified NAT gateway does not support this action.​
指定的NAT网关不支持当前操作。​
400​
InvalidPortType.Malformed​
The specified port type is malformed.​
指定的端口类型不合法。​
400​
InvalidName.Malformed​
The specified name is malformed. Ensure the maximum length of name is 128.​
指定的名称格式不合法。名称长度不能超过128个字符。​
400​
InvalidName.Malformed​
The specified name is malformed.​
指定的名称格式不合法。请修复名称格式后重试。​
403​
Forbidden​
You are not authorized to create a dnat entry of ip mapping.​
无权限创建IP映射的DNAT规则。​
404​
InvalidProject.NotFound​
The specified Project does not exist.​
指定的项目不存在。​
404​
InvalidNatGateway.NotFound​
The specified NAT gateway does not exist.​
指定的NAT网关不存在。​
404​
InvalidEip.NotFound​
The specified EIP does not exist.​
指定的EIP不存在。​
404​
InvalidNatIp.NotFound​
The specified nat ip does not exist.​
指定的NAT IP不存在。​
409​
InvalidDnatEntry.Conflict​
The specified DNAT entry conflicts with that of another DNAT entry in your NAT gateway.​
指定的DNAT规则与所属NAT网关下另一条规则冲突。​
412​
InvalidNatGateway.Expired​
The specified NAT gateway has expired.​
指定的NAT网关已到期。​
500​
InternalError​
An internal error has occurred.​
发生内部错误。​
​
​
最近更新时间:2025.12.23 18:56:15
这个页面对您有帮助吗?
有用
有用
无用
无用