How to connect private networks using SDN Router API

Last updated on: October 27, 2026

Using SDN Private Networks, you have a lot of freedom to configure secure connectivity between your cloud servers. With the introduction of SDN Router API, you can create a gateway between any number of SDN Private Networks within a data centre.

SDN Routers are expanding the customisation possibilities of SDN Private Networking.

If you are not yet familiar with the UpCloud API, we would suggest taking a quick look at our guide to getting started with UpCloud API to set up your API user account and access rights.

Creating a new SDN router

SDN Router API makes it very simple to connect existing SDN Private Networks without added complexity or new IP addresses to configure. Getting started managing SDN Routers via the UpCloud API is quick and easy.

You can get the list of all currently available routers using the following request. By default, you’ll only see the Utility network routers, one for each location.

GET /1.3/router/

You will get a response listing the Utility network routers. The example below shows one of them.

{
   "routers": {
      "router": [
         {
            "attached_networks": {
               "network": [
                  {
                     "uuid": "039fe709-053a-4790-9290-572e2c32ba0e"
                  }
               ]
            },
            "name": "Utility network router for zone fi-hel1",
            "type": "service",
            "uuid": "04104678-d957-4c4d-9775-46621f2841e1"
         }
      ]
   }
}

Deploy a new router by sending a request that includes the following body formatted in JSON to name your router.

POST /1.3/router/
{
   "router": {
      "name": "My Router"
   }
}

If successful, you’ll get a response similar to the example below.

{
   "router": {
      "attached_networks": {
         "network": []
      },
      "name": "My Router",
      "type": "normal",
      "uuid": "04f42ad3-309e-43fc-8576-68869fdf5678"
   }
}

Your new router will then appear on the list of available routers if you query it again.

Attaching network

Once you’ve created your first SDN Router, you can begin attaching SDN Private Networks. If you haven’t yet got started with SDN Private Networks, check out our guide on how to configure SDN Private Networks using the UpCloud API.

In practice, attaching private networks to a router works by setting the router parameter in the network details to match the UUID of the router you wish to connect to. Each network can only be attached to one router at a time.

Check the UUID of your SDN Router in response to creating it, then set the router UUID in the details of your SDN Private Network. Replace the UUIDs in the following request and body message accordingly.

PUT /1.3/network/{network-uuid}
{
   "network": {
      "router": "{router-uuid}"
   }
}

If your network was successfully attached to the router, you’ll see a response similar to the example below.

{
   "network": {
      "ip_networks": {
         "ip_network": [
            {
               "address": "10.0.1.0/24",
               "dhcp": "yes",
               "dhcp_default_route": "no",
               "family": "IPv4",
               "gateway": "10.0.1.1"
            }
         ]
      },
      "name": "Private network 1",
      "router": "04f42ad3-309e-43fc-8576-68869fdf5678",
      "type": "private",
      "uuid": "035661db-570c-4c46-9903-6dc890f56343",
      "zone": "fi-hel1"
   }
}

You can find the UUIDs of your SDN Private Networks using the following request.

GET /1.3/network/
{
   "networks": {
      "network": [
         ...
         {
            "ip_networks": {
               "ip_network": [...]
            },
            "name": "Private network 1",
            "servers": {
               "server": [...]
            },
            "type": "private",
            "uuid": "035661db-570c-4c46-9903-6dc890f56343",
            "zone": "fi-hel1"
         },
         {
            "ip_networks": {
               "ip_network": [...]
            },
            "name": "Private network 2",
            "servers": {
               "server": [...]
            },
            "type": "private",
            "uuid": "03beb27f-73a5-4333-93fd-7052b7b0791b",
            "zone": "fi-hel1"
         }
      ]
   }
}

Once your private networks are connected via the router, you still need to create new routes to enable communication between the private networks. To accomplish this log into the cloud servers and add the relevant routes between the networks to their corresponding network interfaces.

For example, to connect SDN Private Networks with the IP ranges 10.0.1.0/24 and 10.0.2.0/24, add the following route on cloud servers connected to 10.0.1.0/24, with the gateway 10.0.1.1. Replace the IP addresses and the network interface eth2 in the example with your network details.

ip route add 10.0.2.0/24 via 10.0.1.1 dev eth2

Routes are needed in both directions, so add the matching route on cloud servers connected to 10.0.2.0/24, with the gateway 10.0.2.1.

ip route add 10.0.1.0/24 via 10.0.2.1 dev eth2

Afterwards, if you check the configured routes with the next command, you should see the new route connecting to the other private network.

ip route
Output
...
10.0.1.0/24 dev eth2 proto kernel scope link src 10.0.1.2 metric 100
10.0.2.0/24 via 10.0.1.1 dev eth2

Repeat these steps on each cloud server you want to use between the private networks.

Instead of adding the routes by hand, you can switch on route auto-population on both networks. The networks' DHCP service then hands out the routes to the servers. See SDN Private Networks.

That’s it! Your cloud servers connected to either private network can now communicate via the router gateway.

Detaching networks

When you no longer need to connect a specific SDN Private Network, you can detach it from your router at any point.

To detach a network from a router, set the router in your network details to empty.

PUT /1.3/network/{network-uuid}
{
   "network": {
      "router": ""
    }
}

You will then get a response to confirm your private network has been detached. Note that the router parameter is no longer present.

{
   "network": {
      "ip_networks": {
         "ip_network": [
            {
               "address": "10.0.1.0/24",
               "dhcp": "yes",
               "dhcp_default_route": "no",
               "family": "IPv4",
               "gateway": "10.0.1.1"
            }
         ]
      },
      "name": "Private network 1",
      "type": "private",
      "uuid": "035661db-570c-4c46-9903-6dc890f56343",
      "zone": "fi-hel1"
   }
}

The selected network will then have been detached from your router.

Contributed by: Janne Ruostemaa

Can't find what you're looking for?

For more help you can contact our awesome 24/7 support team

Contact Support