Listing routes of a routing table
You can list the routes of a VPC routing table by using the console, CLI, API, or Terraform.
Listing routes of a routing table in the console
To list the routes of a VPC routing table in the console, follow these steps:
- From the IBM Cloud console, select the Navigation Menu
, then click Infrastructure > Network > Routing tables. The Routing tables for VPC page appears.
- Click the routing table name or number of routes that are associated with the routing table. The Routing table details page appears, listing the routes associated with the routing table.
Descriptions of these columns are as follows:
Column | Description |
---|---|
Name | Name of the route. |
Destination | Destination CIDR of the route. |
State |
The lifecycle state. Custom route states are:
|
Zone | Indicates the zone. |
Action |
Values are:
|
Next hop | The IP address of the next hop to which to route packets. |
Route origin | Origin of the route. |
Listing routes of a routing table from the CLI
Before you begin, set up your CLI environment.
To list all the routes of a VPC routing table, run the following command:
ibmcloud is vpc-routing-table-routes VPC ROUTING_TABLE [--output JSON] [-q, --quiet]
Where:
VPC
- Is the ID or name of the VPC.
ROUTING_TABLE
- Is the ID or name of the VPC routing table.
--output
- Specify the output format, only JSON is supported.
--q, --quiet
- Specify verbose output.
Listing routes of a routing table with the API
To view details of a route with the API, follow these steps:
-
Set up your API environment.
-
Store the following values in variables to be used in the API command:
export VpcId=<your_vpc_id> export RoutingTableId=<your_routing_table_id> export RouteId=<your_route_id>
-
List all routes in a routing table:
curl -X GET "$vpc_api_endpoint/v1/vpcs/$vpc_id/routing_tables?version=$api_version&generation=2" \ -H "Authorization: Bearer $iam_token"
Listing routes of a routing table with Terraform
To list routes of a routing table with Terraform, follow these steps:
-
Set up your Terraform environment.
-
Use one of the following examples:
-
To list all the routes:
data "ibm_is_vpc_routing_table_routes" "example" { vpc = ibm_is_vpc.example.id routing_table = ibm_is_vpc_routing_tables.example.routing_table }
For more information about the
ibm_is_vpc_routing_table_routes
resource, see the Terraform Registry. -
To retrieve a single route with an identifier:
data "ibm_is_vpc_routing_table_route" "example_route" { vpc = ibm_is_vpc.example_vpc.id routing_table = ibm_is_vpc_routing_table.example_rt.routing_table route_id = ibm_is_vpc_routing_table_route.example_route.route_id }
For more information about the
ibm_is_vpc_routing_table_route
resource, see the Terraform Registry.
-
-
A system routing table is maintained for each VPC. A VPC can have a presence in multiple zones, and the VPC's system routing table is different in each zone. It is used for routing traffic when no matching route is found in the custom routing table that is associated with the subnet of which the traffic is egressing. ↩︎