百度智能云

All Product Document

          Virtual Private Cloud

          Route Table Related Operations

          Create Route Rules

          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.

          Command Format

          $ bce vpc create-route-rule <route_table_id> <source_addess> <destination_address> <next_hop_type> <description> [-nhi NEXT_HOP_ID]

          Note:

          • route_table_id: Route table id.
          • source_addess: 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.
          • destination_address: 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).
          • next_hop_type: Next hop id.
          • description: Description.
          • -nhi NEXT_HOP_ID, --next_hop_id NEXT_HOP_ID: Next hop id.

          Operation Example

          $ bce vpc create-route-rule rt-5v6qvug6jm4i 192.168.0.2/32 1.1.1.0/24 custom test-description -nhi i-wyYeOCTC

          Example for Return

          {
              "route_rule_id": "rr-tkx4vpq5ev2q"
          }
          Parameter name Type Description
          routeRuleId String Route rule id

          Query the Route Table Rules

          Description

          Query all route table rules.

          Command Format

          $ bce vpc list-route-rule [-vi VPC_ID] [-rti ROUTE_TABLE_ID]

          Note:

          • -vi VPC_ID, --vpc_id VPC_ID: Either the id of VPC or the ROUTE_TABLE_ID should be selected.
          • -rti route_table_id ROUTE_TABLE_ID: Either the route table id or the VPC_ID should be selected. The request's parameter routeTableId and vpcId cannot be simultaneously empty.

          Example for Operation

          $bce vpc list-route-rule -rti rt-5v6qvug6jm4i

          Example for Return

          {
              "route_table_id": "rt-5v6qvug6jm4i",
              "vpc_id": "vpc-suzek0b5vi4r",
              "route_rules": [
                  {
                      "description": "test-description",
                      "nexthop_id": "i-wyYeOCTC",
                      "route_table_id": "rt-5v6qvug6jm4i",
                      "destination_address": "1.1.1.0/24",
                      "nexthop_type": "custom",
                      "source_address": "192.168.0.2/32",
                      "route_rule_id": "rr-tkx4vpq5ev2q"
                  },
                  {
                      "description": "",
                      "nexthop_id": "",
                      "route_table_id": "rt-5v6qvug6jm4i",
                      "destination_address": "192.168.0.0/20",
                      "nexthop_type": "sys",
                      "source_address": "0.0.0.0/0",
                      "route_rule_id": ""
                  }
              ]
          }
          Parameter name Type Description
          route_table_id String Route table id
          vpc_id String VPCid
          route_rules RouteRule Route rule list

          Delete Routing Rule

          Description

          Delete routing rule.

          Command Format

          $ bce vpc delete-route-rule <route_rule_id>

          Note:

          • route_rule_id: Route rule id.

          Example for Operation

          $ bce vpc delete-route-rule rr-tkx4vpq5ev2q

          Example for Return

          {}

          There is no special return parameter.

          Previous
          Subnet Related Operations
          Next
          Version Change Record