Configure Virtual Cloud Network Routing and Gateways

Summary

The route table provides rules for directing IP traffic to a specific gateway. The most specific rule is the one selected.

Reference

Route Table

The help text for the oci network route-table create says:

Creates a new route table for the specified VCN. In the request you must also include at least one route rule for the new route table. For information on the number of rules you can have in a route table, see Service Limits. For general information about route tables in your VCN and the types of targets you can use in route rules, see Route Tables.

For the purposes of access control, you must provide the OCID of the compartment where you want the route table to reside. Notice that the route table doesn’t have to be in the same compartment as the VCN, subnets, or other Networking Service components. If you’re not sure which compartment to use, put the route table in the same compartment as the VCN. For more information about compartments and access control, see Overview of the IAM Service. For information about OCIDs, see Resource Identifiers.

You may optionally specify a display name for the route table, otherwise a default is provided. It does not have to be unique, and you can change it. Avoid entering confidential information.

Run the following commands to display all route tables in the Sandbox compartment:

sandbox_comp_ocid=$(       \
  oci iam compartment list \
  --name 'Sandbox'         \
  --query 'data[0].id'     \
  --raw-output             \
)
oci network route-table list            \
  --compartment-id ${sandbox_comp_ocid} \
  --query 'data[*].{"Route Table Entry":"display-name","Route Rules":"route-rules"[*].{"Destination":destination,"OCID for Gateway":"network-entity-id"}}' \
  --output table 

The sample output is:

+----------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------+
| Route Rules                                                                                                                                              | Route Table Entry                   |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------+
| [{'Destination': '0.0.0.0/0', 'OCID for Gateway': 'ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaarzchmunop752orok3sm2xmacrjajgcy6azpjzg74gqzri7f2eqxa'}] | Sandbox internet connectivity       |
| []                                                                                                                                                       | Default Route Table for sandbox-vcn |
| [{'Destination': '0.0.0.0/0', 'OCID for Gateway': 'ocid1.internetgateway.oc1.ap-sydney-1.aaaaaaaavi5strrtnofsl2l25vwbgrc5g3velvquvh2nhijydp5rioorktsa'}] | Sandbox internet connectivity       |
| []                                                                                                                                                       | Default Route Table for sandbox-vcn |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------+