Skip to main content

Example of configuring Internet access for a dedicated server via a cloud router

Configuration goal

Unite a dedicated server and a cloud router with an L3 private network and organize Internet access for the dedicated server through the cloud router, which will allow you to limit direct Internet access for the dedicated server.

To do this, you need to connect the dedicated server and cloud router with a private network using a global router. Then configure routing in the network so that the devices can reach each other and internet traffic from the dedicated server passes through the cloud router.

What you need for configuration

DeviceDevice settings in the example
Dedicated server in a private subnet without direct internet access
Cloud router in a private subnet with an external IP address

Configuration result

The dedicated server and cloud router will be interconnected by an L3 private network, and Internet access will be organized for the dedicated server through the cloud router:

Configuration steps

  1. Create a global router.
  2. Connect the dedicated server subnet to the global router.
  3. Connect the cloud platform project subnet to the global router.
  4. Configure a route in the cloud platform project subnet.
  5. Configure a route on the cloud router.
  6. Configure a route on the dedicated server.
  7. Configure a route on the global router.

1. Create a global router

  1. In the control panel, in the top menu, click Products and select Global Router.
  2. Click Create router. Each account has a limit of five global routers.
  3. Enter the router name.
  4. Click Create.
  5. If the router was created with the status ERROR or is stuck in one of the statuses, create a ticket.

2. Connect the dedicated server subnet to the global router

  1. In the control panel, from the top menu, click Products and select Global Router.
  2. Open the router page.
  3. Click Create network.
  4. Enter a network name. It will only be used in the control panel.
  5. Select the Servers and hardware service.
  6. Select the network location.
  7. Select or enter a VLAN; in the example, it is VLAN 2044.
  8. Enter a subnet name. It will only be used in the control panel.
  9. Enter the CIDR — IP address and subnet mask of the private subnet, in the example — 192.168.0.0/24.
  10. Enter the gateway IP address or leave the first address from the subnet assigned by default, in the example — 192.168.0.1. Do not assign this address to your devices to avoid network disruption.
  11. Enter service IP addresses or leave the last addresses from the subnet assigned by default, in the example — 192.168.0.5 and 192.168.0.6. Do not assign these addresses to your devices to avoid network disruption.
  12. Click Create network.
  13. Optional: check the network topology on the global router. In the control panel, from the top menu, click Products → Global Router → desired router page → Network map.

3. Connect the cloud platform project subnet to the global router

  1. In the control panel, from the top menu, click Products and select Cloud Servers.

  2. Go to Network → Private networks tab.

  3. Make sure that the network to which the cloud platform project subnet belongs is not yet connected to any of the account's global routers — it does not have the Global Router tag.

  4. From the network menu, select Connect to global router.

  5. Select the global router.

  6. For each of the network subnets, enter the IP address to be assigned to the router or leave the first available address from the subnet assigned by default, in the example — 172.16.0.1. Do not assign this address to your devices to avoid network disruption. The last two available subnet addresses will be reserved as service addresses.

  7. Click Connect. Do not close the window until a message appears confirming that the network is connected. After that, in the control panel:

    • the network will appear in the section Selectel Global Router on the page of the router you connected it to;
    • in the section Cloud Servers → Network → Private networks tab, the network will have the tag Global Router.

4. Add a route in the cloud platform project subnet

Add a static route for the subnet of the cloud platform project that you connected to the global router in step 3, in the example — 172.16.0.0/29.

During configuration, specify:

  • destination subnet — dedicated server subnet on the global router, in the example — 192.168.0.0/24;
  • gateway — gateway of the cloud platform project subnet on the global router, in the example — 172.16.0.1.

5. Add a route on the cloud router

Static routes on a cloud router can only be configured via OpenStack API.

  1. Open the OpenStack CLI.

  2. Create a static route:

    openstack router set --route destination=192.168.0.0/24,gateway=172.16.0.1 13b6da27-4409-456c-b9aa-5dcf84690aaf

    Where:

    • 192.168.0.0/24 — dedicated server subnet on the global router specifying the mask;
    • 172.16.0.1 — gateway of the cloud platform project subnet on the global router;
    • 13b6da27-4409-456c-b9aa-5dcf84690aaf — cloud router UUID, which can be viewed in the control panel: from the top menu, click Products → Cloud Servers → Network → Cloud Routers tab → alphanumeric value under the router name.

6. Add a route on the dedicated server

The configuration process is described for Ubuntu 22.04 OS. If you need to configure routes on a server running Debian, CentOS, or Windows, follow the instructions in Configure static routes on the server.

  1. Connect to the server.

  2. Open the CLI.

  3. Open the network configuration file; in Ubuntu 22.04 OS, this is the configuration file of the netplan utility:

    vi /etc/netplan/50-cloud-init.yaml
  4. At the end of the block with private network interface data, add the route:

    routes:
    - to: 0.0.0.0/0
    via: 192.168.0.1

    Where:

    • 0.0.0.0/0 — default subnet for sending internet traffic;
    • 192.168.0.1 — gateway of the dedicated server subnet on the global router.
  5. Save the file.

  6. Check the settings:

    sudo netplan try
  7. Apply the changes:

    netplan apply

7. Add a route on the global router

  1. In the control panel, from the top menu, click Products and select Global Router.
  2. Open the router page → Static routes tab.
  3. Click Create route.
  4. Enter a route name — you can use any name, it will only be displayed in the control panel.
  5. Enter the destination subnet CIDR 0.0.0.0/0.
  6. Enter the Next hop IP address — private IP address of the cloud router, in the example — 172.16.0.3.
  7. Click Create.