IBM Cloud Docs
Listing routes of a routing table

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:

  1. From the IBM Cloud console, select the Navigation Menu Navigation menu, then click Infrastructure > Network > Routing tables. The Routing tables for VPC page appears.
  2. 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:

Destination routes details
Column Description
Name Name of the route.
Destination Destination CIDR of the route.
State

The lifecycle state. Custom route states are:

  • Pending - In the process of being provisioned in the specified VPC and zone.
  • Stable - Provisioning was successful.
  • Deleting - A Stable or Failed route is in the process of being deleted.
  • Deleted - Deletion was successful.
  • Failed - The route is not functional. From this state, you can delete only the route.
Zone Indicates the zone.
Action

Values are:

  • Deliver - Routes the packet to the next hop target. You can add multiple routes with the same address prefix. The virtual router performs equal-cost, multi-path routing (ECMP) by using the different next hop IP addresses.
  • Drop - Drops the packet.
  • Delegate - Routes the packet by using the system routing table.[1]
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:

  1. Set up your API environment.

  2. 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>
    
  3. 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:

  1. Set up your Terraform environment.

  2. 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.


  1. 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. ↩︎