Skip to main content

Static routes in Cloud Platform networks

Last update:

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

Для настройки статических маршрутов on глобальном роутере используйте инструкцию Настроить маршрутизацию on глобальном роутере.

Use cases

Internet access for a network connected to a global router

For example, a Cloud Platform private network is connected to a global router, and you need to:

  • configure internet access for cloud servers located in subnets of this private network;
  • configure internet access for a Managed Kubernetes cluster private subnet to deploy nodes;
  • use a public IP address for a cloud server or for a load balancer in a private network;
  • use a cloud router as a gateway for internet access 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 a cloud server as a gateway and configure static routing. For example:

  • configure internet access from a subnet;
  • configure connectivity with external infrastructure via VPN.

Configure static routes in a subnet

You can use the following as the source subnet:

  • a private subnet;
  • a global router subnet;
  • a public subnet — only via OpenStack CLI;
  • private networks and public subnets that have access configured in different projects (with the Cross-project tag) — only via OpenStack CLI.

You cannot set a metric (weight or cost of a route) for a static route, so it is impossible to configure two or more routes with the same source and destination subnets.

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 the Control panel, on the top menu, click Products and select Cloud Servers.
  2. Перейдите in раздел Сеть → вкладка Приватные сети.
  3. Откройте страницу приватной сети → вкладка Подсети.
  4. В карточке подсети откройте блок Автоматические сетевые настройки.
  5. Click Add route.
  6. Enter the destination subnet CIDR — this is the subnet to which traffic will be directed.
  7. Enter the gateway (next-hop) — the IP address through which the source subnet devices will direct traffic to the destination subnet. You can enter any address from the source subnet.
  8. Click .
  9. Apply the changes. To do this, update network settings on the devices in the subnet.

Configure static routes on a 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> — the CIDR of the destination subnet to which traffic will be directed, for example 172.16.0.8/29;
    • <next_hop_ip_address> — the gateway (next-hop) — the router IP address through which traffic will be directed to the destination subnet. The subnet with the router must be connected to the cloud router. The router address must not match the IP address of the cloud router;
    • <router> — the ID or name of the cloud router; you can view it using the openstack router list.