Skip to main content

Cross Connect Between Virtual Routers in Nuvion

Cross Connect links private networks behind different virtual routers. By default, each router only knows the private networks attached to it. For VMs behind different routers to communicate over private IPs, including across different projects, the routers must be connected by a transit network and given static routes pointing to each other.


Why not use the other router's public IP?​

In a static route, the next hop must belong to one of the networks connected to the router. If the next hop is another router's external gateway IP, the route is only accepted when both gateways are on the same public subnet. This is not guaranteed, since public IPs are assigned automatically.

When the gateways are on different public subnets, the panel returns the error:

Invalid format for routes: [...] the nexthop is not connected with router
tip

A transit network solves this: both routers share a private network, so the next hop is always connected.


Topology​

 PROJECT A                                                    PROJECT B
net-a 10.10.10.0/24 ── Router A (.1) ── transit ── (.x) Router B ── net-b 10.20.20.0/24
172.31.255.0/29
(owner: Project A, shared with Project B)
  • Project A creates the transit network and shares it with Project B.
  • Router A uses the transit subnet's gateway IP (172.31.255.1).
  • Router B gets an IP on the transit network (e.g. 172.31.255.5).
  • Each router gets a static route to the other's network.

Panel or CLI?​

Most steps can be done from the panel or with the CLI. Steps that involve sharing resources between projects can only be done with the CLI.

StepPanelCLI
1. Get the Project B ID✅
2. Create the transit network✅✅
3. Attach Router A to the transit network✅✅
4. Share the network with Project B✅
5. Attach Router B to the transit network✅
6. and 7. Static routes✅✅
8. Security Groups✅✅
info

If both routers are in the same project, steps 1 and 4 are not needed and step 5 can also be done from the panel. In other words, the whole process can be done from the panel only.


Prerequisites​

  • A router in each project, with its private network already attached. See Virtual Routers.
  • Non-overlapping IP ranges: the private networks on both sides and the transit network must use different ranges.
  • For the CLI steps: OpenStack CLI installed, with an API credential and an openrc file for each project (see Setting up the OpenStack CLI).
warning

If both private networks use the same range (e.g. both on 192.168.0.0/24), routing will not work. In that case, one of the networks must be recreated with a different range.

Example values used in this guide:

ItemExample
Project A private network10.10.10.0/24
Project B private network10.20.20.0/24
Transit network172.31.255.0/29
info

In the commands, <...> marks a value you must replace. Always prefer using resource IDs (UUIDs) instead of names, since names can be duplicated.


Setting up the OpenStack CLI​

1. Install the client​

With Python 3 installed, run:

pip install python-openstackclient

Check the installation:

openstack --version

2. Create an API credential​

CLI access uses an API credential (application credential) instead of your panel password. Each credential is tied to one user and one project, so create one per project involved.

  1. In the panel, open the project and go to Settings > API credentials.
  2. Click Create.
  3. Fill in:
    • Name: a unique name, such as cli-project-a.
    • Project: the project the credential will access.
    • Expiration date: at most one year after creation.
  4. Click Create.
  5. In the Credentials created window, copy the credential ID and the API secret key.
warning

The secret key is shown only once. If the window is closed without saving it, it cannot be recovered and a new credential must be created.

info

A credential never has more permissions than your user already has in the project.

More details in the Virtuozzo documentation on API credentials.

3. Create the openrc file​

The openrc is a script that loads the credential into the terminal. Create one file per project, for example project-a-openrc.sh:

export OS_AUTH_TYPE=v3applicationcredential
export OS_AUTH_URL=https://sp1-api.saveincloud.io:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_INTERFACE=public
export OS_APPLICATION_CREDENTIAL_ID=<CREDENTIAL_ID>
export OS_APPLICATION_CREDENTIAL_SECRET=<SECRET_KEY>
  • OS_AUTH_TYPE: tells the client to authenticate with an API credential.
  • OS_AUTH_URL: the platform's authentication endpoint.
  • OS_APPLICATION_CREDENTIAL_ID: the ID of the credential created in the previous step.
  • OS_APPLICATION_CREDENTIAL_SECRET: the credential's secret key.
tip

Treat the openrc file like a password: do not share it or commit it to Git repositories. If the key leaks, delete the credential in the panel and create a new one.

4. Load and test​

source project-a-openrc.sh
openstack token issue -c project_id -f value

If the command returns the project ID, authentication is working.


Configuring the Cross Connect​

Step 1 -- Get the Project B ID​

CLI only

The project ID is obtained with the CLI, using Project B's openrc.

source project-b-openrc.sh
openstack token issue -c project_id -f value

Write down the value. It is used in Step 4.

Step 2 -- Create the transit network (Project A)​

  1. Go to Networks and create a new network, as described in Virtual Networks.
  2. Use the following values:
    • Name: transit-net
    • IP address management: enabled
    • IPv4 subnet CIDR: 172.31.255.0/29
    • Gateway: keep the default (172.31.255.1)
    • Built-in DHCP: disabled
  3. Finish creating the network.
info

A /29 provides up to 6 usable IPs, enough to connect routers. DHCP is disabled because this network will hold only routers, not VMs.

Step 3 -- Attach Router A to the transit network (Project A)​

  1. Go to Routers and click Router A's name.
  2. On the Interfaces tab, click Add interface.
  3. Select the transit-net network. Leave the IP field empty to use the subnet's gateway.
  4. Click Add.

Router A gets the subnet's gateway IP: 172.31.255.1.

Step 4 -- Share the transit network with Project B (Project A)​

CLI only

Sharing networks between projects is not available in the panel.

openstack network rbac create --target-project <PROJECT_B_ID> --action access_as_shared --type network <TRANSIT_NETWORK_ID> -c id -f value

The network becomes available only to Project B.

Step 5 -- Attach Router B to the transit network (Project B)​

CLI only

Since the transit network belongs to another project, the attachment is done with the CLI.

source project-b-openrc.sh

Create a port on the transit network without specifying an IP:

openstack port create --network <TRANSIT_NETWORK_ID> transit-port-router-b -c id -c fixed_ips -f json

Write down the port ID and the returned IP (e.g. 172.31.255.5), then attach the port to Router B:

openstack router add port <ROUTER_B_ID> <PORT_ID>
info

Since Project B does not own the transit network, it cannot choose the port's IP. The IP is assigned automatically and is used in Router A's route.

tip

Routers in the same project? Do this step from the panel: in Routers > Router B > Interfaces > Add interface, select transit-net and enter a free IP, such as 172.31.255.2. The gateway (.1) is already used by Router A.

Step 6 -- Route on Router B (Project B)​

  1. Go to Routers and click Router B's name.
  2. On the Static routes tab, click Add static route.
  3. Fill in:
    • Destination subnet and mask: 10.10.10.0/24
    • Next hop: 172.31.255.1
  4. Click Add.

Step 7 -- Route on Router A (Project A)​

  1. Go to Routers and click Router A's name.
  2. On the Static routes tab, click Add static route.
  3. Fill in:
    • Destination subnet and mask: 10.20.20.0/24
    • Next hop: Router B's IP on the transit network (e.g. 172.31.255.5)
  4. Click Add.

Step 8 -- Allow traffic in the Security Groups​

Security groups block traffic from other networks by default. Allow the remote range in both projects.

In each project, add an ingress rule to the VMs' security group, as described in Creating a Security Group:

ProjectProtocolSource (CIDR)
Project AICMP10.20.20.0/24
Project BICMP10.10.10.0/24
warning

Allow only the ports and protocols you need (e.g. TCP 5432 for PostgreSQL). Avoid allowing all traffic.

Step 9 -- Test​

From a VM in Project A:

ping -c 4 10.20.20.72

Expected result:

64 bytes from 10.20.20.72: seq=0 ttl=62 time=1.662 ms
64 bytes from 10.20.20.72: seq=1 ttl=62 time=0.423 ms
...
4 packets transmitted, 4 packets received, 0% packet loss
info

TTL 62 (64 minus 2 hops) confirms the packet went through both routers over the transit network.


Notes​

  • Internet access is not affected. Static routes are more specific than the default route (0.0.0.0/0), so only traffic between the networks goes through the transit network.
  • No SNAT between the networks. Traffic keeps the VM's real source IP, which simplifies firewall rules and log analysis.
  • More networks. To connect more networks, add new static routes. Existing routes are kept.

Removing the configuration​

Follow this order. Items with tabs can be done from the panel or with the CLI.

1. Remove the static routes from both routers.

In Routers > router > Static routes, click the ellipsis icon next to the route, then Delete. Repeat on the other router.

2. Detach Router B from the transit network (Project B, CLI only). The port is removed with it:

openstack router remove port <ROUTER_B_ID> <PORT_ID>

3. Detach Router A from the transit network (Project A).

In Routers > Router A > Interfaces, click the ellipsis icon next to the 172.31.255.1 interface, then Delete.

4. Remove the share (Project A, CLI only):

openstack network rbac delete <RBAC_ID>

5. Delete the transit network (Project A).

In Networks, click the ellipsis icon next to transit-net, then Delete.

warning

Once the configuration is removed, private communication between the networks stops immediately. Make sure no application depends on it.


Troubleshooting​

Error "the nexthop is not connected with router"​

  • The next hop does not belong to any network attached to the router.
  • Check on the router's Interfaces tab that the transit network is attached.
  • Check that the next hop is the other router's IP on the transit network.

Project B cannot find the transit network​

  • Check that the share was created for the correct Project B ID:
openstack network rbac list

Ping does not respond​

  • Do the security groups allow the remote range on both sides?
  • Are there routes on both routers? Without the return route, replies are lost.
  • Do the private networks not overlap?
  • Does the VM's operating system firewall (firewalld, ufw, Windows Firewall) allow the traffic?

CLI authentication error​

  • Check OS_AUTH_URL, the credential ID and the secret key in the openrc.
  • Check that the credential has not expired under Settings > API credentials.
  • Load the file again with source.

If you have questions or need help, contact SaveInCloud technical support through the available channels.