Create Route Rules
Last Updated:2020-07-20
Description
To create route table rules, you need to pay attention to the following points:
- When "Custom" is selected for the source segment, the customized segment need to be within the existing subnet range, excluding 0.0.0.0/0;
- The target network and the current VPC cidr cannot overlap (except when the target segment or the VPC cidr is 0.0.0.0/0);
- The source segment and target segment of added route entries cannot be completely consistent with those of existing entries in the route table.
Request Structure
POST /v{version}/route/rule HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: authorization string
{
"routeTableId":{routeTableId},
"sourceAddress": {sourceAddress},
"destinationAddress": {destinationAddress},
"nexthopId": {nexthopId},
"nexthopType": {nexthopType},
"description": {description}
}
Request Header
There are no other special headers except the public headers.
Request Parameter
Parameter name | Type | Required or not | Parameter position | Description |
---|---|---|---|---|
version | String | Yes | URL parameter | API version number |
clientToken | String | No | Query parameter | Idempotence Token is an ASCII string with length not exceeding 64 bytes, for details, please see ClientToken Idempotence |
routeTableId | String | Yes | Request Body parameters | Route table id |
sourceAddress | String | Yes | Request Body parameters | For the source segment, you can fill in all network segments 0.0.0.0/0, existing subnet segments in VPC or segments in the subnet range. |
destinationAddress | String | Yes | Request Body parameters | The target segment can be 0.0.0.0/0, or the destination address and the current VPC cidr cannot overlap (except when the destination segment or the VPC cidr is 0.0.0.0/0). |
nexthopId | String | No | Request Body parameters | Next hop id |
nexthopType | String | Yes | Request Body parameters | Route type. The Bcc type is "custom"; the VPN type is "vpn"; the NAT type is "nat". |
description | String | No | Request Body parameters | Description |
Return Header
There are no other special headers except the public headers.
Return Parameter
Parameter name | Type | Description |
---|---|---|
routeRuleId | String | Route rule id |
Request Example
POST /v1/route/rule HTTP/1.1
Host: bcc.bj.baidubce.com
Authorization: authorization string
{
"routeTableId":"rt-q1zg3i8mx8p6",
"sourceAddress": "192.168.0.0/20",
"destinationAddress": "0.0.0.0/0",
"nexthopId": "nat-bdidwhwfwc6p",
"nexthopType": "nat",
"description": ""
}
Return Example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7 4ad5 451d 9215 71cb844c0a50
Date: Thu, 16 Mar 2017 06:29:48 GMT
Content Type: application/json;charset=UTF 8
Server: BWS
{"routeRuleId": "rr-dup3cxpebi5e"}