調用CreateForwardEntry介面在DNAT列表中添加DNAT條目。
介面說明
每條 DNAT 條目由五部分組成,包括 ExternalIp、ExternalPort、IpProtocol、InternalIp 和 InternalPort。添加 DNAT 條目後,NAT Gateway會將ExternalIp:ExternalPort上收到的指定協議的報文轉寄給InternalIp:InternalPort,並將回複訊息原路返回。
調用本介面添加 DNAT 條目時,請注意:
-
CreateForwardEntry 介面屬於非同步介面,即系統會先返回一個 DNAT 條目 ID,但該 DNAT 條目並未添加完成,系統背景新增工作仍在進行。您可以調用 DescribeForwardTableEntries 查詢 DNAT 條目的狀態:
-
當 DNAT 條目處於 Pending 狀態時,表示 DNAT 條目正在添加中,在該狀態下,您只能執行查詢操作,不能執行其他動作。
-
當 DNAT 條目處於 Available 狀態時,表示 DNAT 條目添加完成。
-
-
所有 DNAT 條目的 ExternalIp、ExternalPort 和 IpProtocol 三個欄位組成的組合必須互不重複,即不允許將同一個源 IP、同一個連接埠、同一個協議的訊息轉寄到多個目標 ECS 執行個體。
-
所有 DNAT 條目的 InternalIp、InternalPort 和 IpProtocol 三個欄位組成的組合也必須互不重複。
-
所有 DNAT 條目的 ExternalIp 和 InternalIp 兩個欄位的 IP 位址不能相同,如果業務需要兩個 IP 位址相同, 請聯絡商務經理。
-
一個 DNAT 表最多可添加 100 條 DNAT 條目。
-
DNAT 條目中配置了 IP 映射方式的 IP(公網 NAT Gateway使用的 EIP 或 VPC NAT Gateway使用的 NAT IP 位址)不能再被其他 DNAT 條目或 SNAT 條目使用。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
是 |
NAT Gateway所在的地區 ID。 您可以通過調用 DescribeRegions 介面擷取地區 ID。 |
cn-hangzhou |
| ForwardTableId |
string |
是 |
DNAT 列表的 ID。 |
ftb-bp1mbjubq34hlcqpa**** |
| ExternalIp |
string |
是 |
|
116.28.XX.XX |
| ExternalPort |
string |
是 |
|
8080 |
| InternalIp |
string |
是 |
|
192.168.XX.XX |
| InternalPort |
string |
是 |
|
80 |
| IpProtocol |
string |
是 |
協議類型,取值:
|
TCP |
| ForwardEntryName |
string |
否 |
DNAT 規則的名稱。 長度為 2~128 個字元,必須以大小寫字母或中文開頭,但不能以 |
ForwardEntry-1 |
| ClientToken |
string |
否 |
用戶端 Token,用於保證請求的等冪性。 從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元。 說明
若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 可能不一樣。 |
0c593ea1-3bea-11e9-b96b-88e9fe6**** |
| PortBreak |
boolean |
否 |
是否開啟連接埠突破,取值:
說明
當 DNAT 條目和 SNAT 條目使用同一個公網 IP 位址時,如果您需要配置大於 1024 的連接埠號碼,您需要指定 PortBreak 為 true。 |
false |
| DryRun |
boolean |
否 |
是否只預檢此次請求,取值:
|
false |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| ForwardEntryId |
string |
DNAT 條目的 ID。 |
fwd-119smw5tkasdf**** |
| RequestId |
string |
請求 ID。 |
A4AEE536-A97A-40EB-9EBE-53A6948A6928 |
樣本
正常返回樣本
JSON格式
{
"ForwardEntryId": "fwd-119smw5tkasdf****",
"RequestId": "A4AEE536-A97A-40EB-9EBE-53A6948A6928"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | UnsupportedFeature.PrivateLinkEnabled | The feature of PrivateLinkEnabled is not supported. | |
| 400 | UnsupportedFeature.PortSegment | The feature of PortSegment is not supported. | |
| 400 | ExclusiveParam.%sAnd%s | The param of %s and %s are mutually exclusive. | 參數 %s 和 %s 相互排斥。 |
| 400 | DuplicatedParam.InternalPort | The param of %s is duplicated. | InternalPort參數重複或已被佔用 |
| 400 | DuplicatedParam.ExternalPort | The param of %s is duplicated. | DNAT公網連接埠%s已被重複佔用。 |
| 400 | OperationFailed.AnyPortConfig | Operation failed because any port correspondence any protocol | 操作失敗. 與其他條目有衝突, 存在任何連接埠或任何協議類型. |
| 400 | OperationUnsupported.ForwardEntry | Duplicated destination ip port is unsupported. | 不支援重複的目標IP連接埠。 |
| 400 | InvalidIp.NotInNatgw | The specified Ip not belong to natgateway. | |
| 400 | QuotaExceeded.ForwardEntry | The quota of %s is exceeded, usage %s/%s. | |
| 400 | IncorrectStatus.NatIp | The status of %s [%s] is incorrect. | NatIp目前狀態不正確。 |
| 400 | Forbidden.IpHasBeenUsedInSnat | The source ip can't be used. Because it has been used in snat. | |
| 400 | InvalidExternalIp.Malformed | The specified ExternalIp is not a valid IP address. | |
| 400 | InvalidInternalIp.Malformed | The specified InternalIp is not a valid IP address. | |
| 400 | InvalidExternalPort.Malformed | The specified ExternalPort is not a valid port. | |
| 400 | InvalidInternalPort.Malformed | The specified InternalPort is not a valid port. | |
| 400 | Forbidden.DestnationIpOutOfVpcCIDR | The specified Internal Ip is Out of VPC CIDR. | |
| 400 | Forbidden.DestinationIpOutOfVswitchCIDR | The specified Internal Ip is Out of VSwitch CIDR. | |
| 400 | InvalidProtocal.ValueNotSupported | The specified IpProtocol does not support. | |
| 400 | IncorretForwardEntryStatus | Some Forward entry status blocked this operation.. | |
| 400 | ForwardEntry.Duplicated | The specified ExternalIp, IpProtocol, ExternalPort,InternalIp, InternalPort is duplicated | |
| 400 | Forbidden.ExternalIp.UsedInSnatTable | The specified ExternalIp is already used in SnatTable | |
| 400 | Forbindden | The specified Instance already bind eip | |
| 400 | Forbidden.InternalIpOutOfVpcCIDR | The specified Internal Ip is Out of VPC CIDR. | |
| 400 | Invalid.natgwNotExist | The specified natgateway not exist. | |
| 400 | MissingParameter | Missing mandatory parameter | |
| 400 | AnyPort.PortMustBeZero | any port port must be zero. | |
| 400 | InvalidParameter.Name.Malformed | The specified Name is not valid. | |
| 400 | IncorrectStatus.ForwardEntry | The status of %s [%s] is incorrect. | 要刪除的DNAT條目執行個體狀態不對 |
| 400 | Duplicated.DestinationPort | The specified param DestinationPort is duplicated. | |
| 400 | OperationUnsupported.EipInBinding | Create snat entry with eip in associating status is unsupported. | 建立snat不可以使用綁定中的eip |
| 400 | QuotaExceeded.ForwardEntrySessionManytoOne | The dnat session quota is exceed. | dnat session 多對一的配額超限。 |
| 400 | TaskConflict | The operation is too frequent, please wait a moment and try again. | 操作過於頻繁,請稍等一會再重試 |
| 400 | OperationFailed.DnatPortRangeLimit | The maximum number of port ranges that can be specified is exceeded. | 連接埠段數量超限。 |
| 400 | IncorrectStatus.NATGW | NATGW status is invalid. | NAT Gateway的狀態不正確。 |
| 400 | OperationFailed.ForwardEntryNotAllowSrcIpEqualDstIp | The source IP of forward entry is not allowed to equal destination IP. | DNAT條目不允許公網IP地址等於私網IP地址 |
| 500 | System.Error | ERROR SYSTEM ERROR. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 404 | ResourceNotFound.NatIp | The specified resource of %s is not found. | |
| 404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | |
| 404 | InvalidForwardTableId.NotFound | Specified forward table does not exist. | |
| 404 | InvalidExternalIp.NotFound | Specified External Ip address does not found on the VRouter |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。