Skip to main content
Static routes
Last update:

Static routes

Static routing can be used if there is a device on the cloud subnet that acts as a router. You can:

To configure static routes on a global router, use the following instructions Configure routing on a global router.

Examples of tasks to be solved

Internet access for a network connected to a global router

For example, a cloud platform's private network is connected to a global router, and you need to:

  • configure Internet access for cloud servers that are located in subnets of this private network;
  • Configure Internet access for the Managed Kubernetes cluster private subnet to deploy nodes;
  • Use a public IP address for a cloud server or for a load balancer on a private network;
  • Use the cloud router as a gateway to access the internet for servers or hosts from other pools and services.

Sending traffic through a cloud server (proxy)

If you need to send traffic to other subnets, you can use the cloud server as a gateway and configure static routing. For example:

  • configure access to the Internet from a subnet;
  • configure connectivity to the external infrastructure via VPN.

Configure static routes in a subnetwork

You can use as the source subnet:

  • a private subnet;
  • subnet of the global router;
  • public subnet — only through the OpenStack CLI;
  • private networks and public subnets to which access is configured in different projects (with the tag Кросспроектная) — only through the OpenStack CLI.

You cannot set a metric (route weight or cost) for a static route, so you cannot configure two or more routes with the same source subnet and destination subnet.

When configuring a static route in the control panel, you can select a private subnet or a global router subnet as the source subnet.

  1. In control panels go to Cloud platformNetwork.
  2. Open the tab Private networks.
  3. Open the private network page → tab Static routes.
  4. Click Add a route.
  5. Select the source subnet.
  6. Enter the CIDR of the destination subnet, which is the subnet to which traffic will be routed.
  7. Enter the gateway (next-hop) — the IP address through which devices on the source subnet will route traffic to the destination subnet. You can enter any address from the source subnet.
  8. Click Add.
  9. Apply the changes. To do this update the network settings on devices in the subnetwork.

Configure static routes on the cloud router

  1. Open the OpenStack CLI.

  2. Configure a static route:

    openstack router add route \
    --route destination=<destination_subnet_cidr>,gateway=<next_hop_ip_address> \
    <router>

    Specify:

    • <destination_subnet_cidr> — CIDR of the destination subnet to which the traffic will be routed, e.g. 172.16.0.8/29;
    • <next_hop_ip_address> — gateway (next-hop) — the IP address that is specified on the cloud router, e.g. 172.16.0.1. Can be viewed with the command openstack router show <router>value ip_address in the field interfaces_info;
    • <router> — The ID or name of the cloud router, can be viewed using the command openstack router list