Route Table Related Operations
Updated at:2025-10-16
Create route rules
Description:
When creating route table rules, note the following points:
- When selecting a custom source network segment, the custom segment must fall within the range of existing subnets, excluding 0.0.0.0/0;
- The destination segment must not overlap with the current VPC CIDR (except when either is 0.0.0.0/0);
- The source and destination network segments of a new route entry must not duplicate those of any existing entries in the route table.
Command format:
Plain Text
1$ bce vpc create-route-rule <route_table_id> <source_addess> <destination_address> <next_hop_type> <description> [-nhi NEXT_HOP_ID]
Description:
- route\_table\_id: Identifier for the route table.
- source\_address: The source network segment (can be 0.0.0.0/0 for all segments, existing VPC subnet segments, or private subnet segments within a VPC).
- destination\_address: The target network segment, which can be 0.0.0.0/0. Otherwise, this address must not overlap with the VPC's CIDR block (unless either the destination segment or the VPC's CIDR block is 0.0.0.0/0).
- next\_hop\_type: The type of next hop ID.
- description: A brief description.
- \-nhi NEXT\_HOP\_ID, --next\_hop\_id NEXT\_HOP\_ID: The ID for the next hop.
Operation example:
Plain Text
1$ bce vpc create-route-rule rt-5v6qvug6jm4i 192.168.0.2/32 1.1.1.0/24 custom test-description -nhi i-wyYeOCTC
Response example:
Plain Text
1{
2 “route_rule_id”: “rr-tkx4vpq5ev2q”
3}
| Parameter name | Types | Description |
|---|---|---|
| routeRuleId | String | Routing rule ID |
Query route table rules
Description:
Retrieve all route table rules.
Command format:
Plain Text
1$ bce vpc list-route-rule [-vi VPC_ID] [-rti ROUTE_TABLE_ID]
Description:
- -vi VPC_ID, --vpc_id VPC_ID: Specify the VPC ID. Either this parameter or ROUTE_TABLE_ID must be provided.
- -rti route_table_id ROUTE_TABLE_ID: Specify the route table ID. Either this parameter or VPC_ID must be provided. Both routeTableId and vpcId cannot be left empty simultaneously.
Operation example:
Plain Text
1$bce vpc list-route-rule -rti rt-5v6qvug6jm4i
Response example:
Plain Text
1{
2 “route_table_id”: “rt-5v6qvug6jm4i”,
3 “vpc_id”: “vpc-suzek0b5vi4r”,
4 “route_rules”: [
5 {
6 “description”: “test-description”,
7 “nexthop_id”: “i-wyYeOCTC”,
8 “route_table_id”: “rt-5v6qvug6jm4i”,
9 “destination_address”: “1.1.1.0/24”,
10 “nexthop_type”: “custom”,
11 “source_address”: “192.168.0.2/32”,
12 “route_rule_id”: “rr-tkx4vpq5ev2q”
13 },
14 {
15 “description”: “”,
16 “nexthop_id”: “”,
17 “route_table_id”: “rt-5v6qvug6jm4i”,
18 “destination_address”: “192.168.0.0/20”,
19 “nexthop_type”: “sys”,
20 “source_address”: “0.0.0.0/0”,
21 “route_rule_id”: “”
22 }
23 ]
24}
| Parameter name | Types | Description |
|---|---|---|
| route_table_id | String | Route table ID |
| vpc_id | String | VPCid |
| route_rules | [RouteRule](VPC/API Reference/Appendix.md#RouteRule) | List of route rules |
Delete route rules
Description:
Remove routing rules.
Command format:
Plain Text
1$ bce vpc delete-route-rule <route_rule_id>
Description:
- route\_rule\_id: ID of the route table.
Operation example:
Plain Text
1$ bce vpc delete-route-rule rr-tkx4vpq5ev2q
Response example:
Plain Text
1{}
No special response parameters are available.
