Configure static routes on dedicated servers
Static routing is a type of routing where routes are explicitly defined when configuring a network interface on a server or router.
To configure static routing, specify static routes on the server.
Examples of tasks that can be solved using static routing:
Specify static routes on a server
Ubuntu
Debian
CentOS
Windows
-
Open the network interfaces configuration file with the
vitext editor:vi /etc/netplan/01-netcfg.yaml -
At the end of the block with the parameters for the required network interface, add the route:
routes:- to: <ip_address>/<mask>via: <gateway>Specify:
<ip_address>— the subnet to which a route is needed;<mask>— the subnet mask to which a route is needed;<gateway>— the gateway for the current server's subnet, such as the gateway specified on the global router. The gateway address must be in the same subnet as the server.
-
If you need to specify multiple routes, add them sequentially in the same block, for example:
routes:- to: 192.168.0.0/28via: 192.168.0.1- to: 192.168.1.0/28via: 192.168.0.1 -
Exit the
vitext editor saving your changes::wq -
Check the route configuration:
sudo netplan try -
Apply the changes:
netplan apply
Example of organizing static routes to connect dedicated servers and a cloud server via a private network
Configuration goal
Connect two dedicated servers in the SPB-2 pool and a cloud server in the ru-2 pool with a private network using a global router, and configure routing in the network so that the devices can see each other.
What you need for configuration
In the configuration example, we used two dedicated servers in the SPB-2 pool with access to a private network and a cloud server in the ru-2 pool.
Configuration result
Private connectivity will be configured between two dedicated servers in the SPB-2 pool and a cloud server in the ru-2 pool.

Configuration steps
-
Connect private subnets to the global router:
192.168.0.0/28for the VLAN containing the dedicated servers in the SPB-2 pool;172.16.0.0/28for the cloud platform project in the ru-2 pool.
-
Assign IP addresses from the private subnets you connected to the global router to the dedicated servers and the cloud server. For more details, see the Assigning IP addresses to servers subsection.
-
Specify routes:
- on each dedicated server in the SPB-2 pool — to the
172.16.0.0/28subnet through gateway192.168.0.1; - on the cloud server in the ru-2 pool — to the
192.168.0.0/28subnet through gateway172.16.0.1.
- on each dedicated server in the SPB-2 pool — to the