添加端口轉(zhuǎn)發(fā)規(guī)則
描述
在指定的端口轉(zhuǎn)發(fā)表中添加端口轉(zhuǎn)發(fā)規(guī)則。
每一條端口轉(zhuǎn)發(fā)規(guī)則,由一個(gè)五元組組成:[ExternalIp,ExternalPort,Protocal,InternalIp,InternalPort];
端口轉(zhuǎn)發(fā)規(guī)則的效果是:將ExternalIp:ExternalPort上收到的指定協(xié)議的消息,站發(fā)給InternalIp:InternalPort,并將回復(fù)消息原路返回;
每一條端口轉(zhuǎn)發(fā)規(guī)則有一個(gè)唯一ID,用于進(jìn)行規(guī)則修改或者規(guī)則刪除;
ExternalIp相關(guān)的約束:
必須是該NatGateway上的某個(gè)帶寬包中的公網(wǎng)IP。
端口轉(zhuǎn)發(fā)規(guī)則可以指定協(xié)議,目前暫時(shí)只支持TCP和UDP兩種協(xié)議,也可以指定為Any
InternalIp相關(guān)的約束
InternalIp必需屬于本VPC CIDR范圍。
該IP地址可以是一個(gè)存在的ECS私網(wǎng)IP地址,也可以是一個(gè)不存在的IP地址(可以先創(chuàng)建規(guī)則再創(chuàng)建ECS實(shí)例),或被其他非ECS資源占用的地址;
只有當(dāng)InternalIp被一個(gè)ECS實(shí)例使用、且該實(shí)例沒(méi)有綁定EIP時(shí),端口轉(zhuǎn)發(fā)才能生效;若該IP地址被HaVip/SLB/RDS等非ECS資源使用,則轉(zhuǎn)發(fā)功能無(wú)效,外來(lái)流量無(wú)法轉(zhuǎn)發(fā)到該IP上;
ExternalPort、InternalPort和IpProtocol,必須同時(shí)為Any或者同時(shí)不為Any;
最多支持40條端口轉(zhuǎn)發(fā)規(guī)則
規(guī)則的唯一性要求:
所有端口轉(zhuǎn)發(fā)規(guī)則的[源IP, 源端口,協(xié)議]三個(gè)字段組成的組合必須是互不重復(fù)的。即,不允許將同一個(gè)源IP、同一個(gè)端口、同一個(gè)協(xié)議的消息轉(zhuǎn)發(fā)到多個(gè)目標(biāo)。
所有端口轉(zhuǎn)發(fā)規(guī)則的[目標(biāo)IP,目標(biāo)端口,協(xié)議]三個(gè)字段組成的組合也必須是互不重復(fù)的。
一個(gè)ExternalIp不能同時(shí)存在指定端口規(guī)則和All端口規(guī)則
每條端口轉(zhuǎn)發(fā)規(guī)則都有狀態(tài),取值為Available |Pending |Modifying;當(dāng)端口裝發(fā)表中任意一條規(guī)則的狀態(tài)處于Pending 或 Modifying時(shí),不允許對(duì)端口轉(zhuǎn)發(fā)表進(jìn)行規(guī)則>添加
請(qǐng)求參數(shù)
名稱
類型
是否必須
描述
Action
String
是
系統(tǒng)規(guī)定參數(shù),取值:CreateForwardEntry
RegionId
String
是
Region ID
ForwardTableId
String
是
ForwardTableId
ExternalIp
String
是
端口轉(zhuǎn)發(fā)規(guī)則中的源IP;該IP必須是該端口轉(zhuǎn)發(fā)表所屬NatGateway上的共享帶寬包中的IP。
ExternalPort
String
是
源端口;取值范圍:1~65535|Any
IpProtocol
String
是
IpProtocol類型,可選TCP|UDP|Any
InternalIp
String
是
端口轉(zhuǎn)發(fā)規(guī)則中的目標(biāo)IP,是一個(gè)私網(wǎng)IP地址。
InternalPort
String
是
目標(biāo)端口;取值范圍為1~65535|Any。
返回參數(shù)
名稱
類型
描述
ForwardEntryId
String
系統(tǒng)分配轉(zhuǎn)發(fā)表?xiàng)l目ID
錯(cuò)誤碼
錯(cuò)誤代碼
描述
Http 狀態(tài)碼
語(yǔ)義
InvalidRegionId.NotFound
The specified RegionId is not found in our record.
404
指定的Region ID不存在
InvalidForwardTableId.NotFound
Specified forward table does not exist.
404
指定的轉(zhuǎn)發(fā)表不存在
InvalidExternalIp.NotFound
Specified Source Ip address does not found on the VRouter
404
指定的源IP地址在NatGatway上沒(méi)有找到
QuotaExceeded.ForwardEntry
Forward entry quota exceeded in this route table.
400
同一個(gè)轉(zhuǎn)發(fā)表?xiàng)l目不能超過(guò) 40條
IncorretForwardEntryStatus
Some Forward entry status blocked this operation.
400
同一個(gè) VPC 下面的轉(zhuǎn)發(fā)表中的任一個(gè)轉(zhuǎn)發(fā)條目處在中間狀態(tài)(添加中,修改中,刪除中),不能創(chuàng)建轉(zhuǎn)發(fā)條目
InvalidProtocal.ValueNotSupportedc
The specified IpProtocol does not exist or IpProtocol and ExternalPort or InternalPort do not match.
400
指定協(xié)議不支持
InvalidInternalIp.Malformed
The specified InternalIp is not a valid IP address.
400
指定的目的IP地址不合法
InvalidExternalIp.Malformed
The specified ExternalIp is not a valid IP address.
400
指定的源IP地址不合法
InvalidExternalPort.Malformed
The specified ExternalPort is not a valid port.
400
指定的源端口號(hào)不合法
InvalidInternalPort.Malformed
The specified InternalPort is not a valid port.
400
指定的目的端口號(hào)不合法
Forbidden.PortsAndIpProtocol
ExternalPort/InternalPort/IpProtocol must be all Any or all not Any.
400
ExternalPort/InternalPort/IpProtocol必須同時(shí)為Any或者同時(shí)不為Any
ForwardEntry.Duplicated.Source
The specified is duplicated
400
與某條已存在的條目存在<源IP, 源端口號(hào),協(xié)議>的沖突
ForwardEntry.Duplicated.Destination
The specified is duplicated
400
與某條已存在的條目存在<目標(biāo)IP, 目標(biāo)端口號(hào),協(xié)議>的沖突
Forbidden.DestnationIpOutOfVpcCIDR
The specified Destination Ip is Out of VPC CIDR
400
指它目的IP地址不在本VPC CIDR
示例
請(qǐng)求示例