Static Routes in Cloud Platform Networks
Static routing can be used if there is a device in the cloud subnet that acts as a router. You can:
- configure static routes in a subnet that contains devices, for example cloud servers;
- configure static routes on a cloud router.
Для настройки статических маршрутов on глобальном роутере используйте инструкцию Настроить маршрутизацию on глобальном роутере.
Examples of use cases
Internet access for a network connected to a global router
For example, a private Cloud Platform network is connected to a global router, and you need to:
- configure internet access for cloud servers located in the 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
The following can be used as the source subnet:
- a private subnet;
- a global router subnet;
- a public subnet — only via OpenStack CLI;
- private networks and public subnets with access configured across different projects (tagged **Cross-project **) — only via OpenStack CLI.
You cannot set a metric (weight or cost of a route) for a static route, which makes it impossible to configure two or more routes with the same source and destination subnets.
Control panel
OpenStack CLI
When configuring a static route in the control panel, you can select a private subnet or a global router subnet as the source subnet.
- In the Control panel, on the top menu, click Products and select Cloud Servers.
- Перейдите in раздел Сеть → вкладка Приватные сети.
- Откройте страницу приватной сети → вкладка Подсети.
- В карточке подсети откройте блок Автоматические сетевые настройки.
- Click Add route.
- Enter the destination subnet CIDR—this is the subnet to which traffic will be directed.
- Enter the gateway (next-hop)—the IP address through which devices in the source subnet will direct traffic to the destination subnet. You can enter any address from the source subnet.
- Click .
- Apply the changes. To do this, update the network settings on the devices in the subnet.
Configure static routes on a cloud router
OpenStack CLI
-
Configure the 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 traffic will be directed, for example172.16.0.8/29;<next_hop_ip_address>— 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 cloud router IP address;<router>— ID or name of the cloud router; you can view it using theopenstack router list.