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
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.
| Step | Panel | CLI |
|---|---|---|
| 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 | ✅ | ✅ |
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).
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:
| Item | Example |
|---|---|
| Project A private network | 10.10.10.0/24 |
| Project B private network | 10.20.20.0/24 |
| Transit network | 172.31.255.0/29 |
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.
- In the panel, open the project and go to
Settings>API credentials. - Click Create.
- 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.
- Name: a unique name, such as
- Click Create.
- In the Credentials created window, copy the credential ID and the API secret key.
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.
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.
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
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)
- Panel
- CLI
- Go to
Networksand create a new network, as described in Virtual Networks. - 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
- Name:
- Finish creating the network.
source project-a-openrc.sh
openstack network create transit-net -c id -f value
openstack subnet create --network <TRANSIT_NETWORK_ID> --subnet-range 172.31.255.0/29 --no-dhcp transit-subnet -c id -f value
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)
- Panel
- CLI
- Go to
Routersand click Router A's name. - On the Interfaces tab, click Add interface.
- Select the
transit-netnetwork. Leave the IP field empty to use the subnet's gateway. - Click Add.
openstack router add subnet <ROUTER_A_ID> <TRANSIT_SUBNET_ID>
Router A gets the subnet's gateway IP: 172.31.255.1.
Step 4 -- Share the transit network with Project B (Project A)
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)
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>
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.
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)
- Panel
- CLI
- Go to
Routersand click Router B's name. - On the Static routes tab, click Add static route.
- Fill in:
- Destination subnet and mask:
10.10.10.0/24 - Next hop:
172.31.255.1
- Destination subnet and mask:
- Click Add.
openstack router set --route destination=10.10.10.0/24,gateway=172.31.255.1 <ROUTER_B_ID>
Step 7 -- Route on Router A (Project A)
- Panel
- CLI
- Go to
Routersand click Router A's name. - On the Static routes tab, click Add static route.
- 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)
- Destination subnet and mask:
- Click Add.
source project-a-openrc.sh
openstack router set --route destination=10.20.20.0/24,gateway=172.31.255.5 <ROUTER_A_ID>
Check:
openstack router show <ROUTER_A_ID> -c routes -c interfaces_info
Step 8 -- Allow traffic in the Security Groups
Security groups block traffic from other networks by default. Allow the remote range in both projects.
- Panel
- CLI
In each project, add an ingress rule to the VMs' security group, as described in Creating a Security Group:
| Project | Protocol | Source (CIDR) |
|---|---|---|
| Project A | ICMP | 10.20.20.0/24 |
| Project B | ICMP | 10.10.10.0/24 |
In Project A:
openstack security group rule create --ingress --protocol icmp --remote-ip 10.20.20.0/24 <SECURITY_GROUP_A_ID>
In Project B:
openstack security group rule create --ingress --protocol icmp --remote-ip 10.10.10.0/24 <SECURITY_GROUP_B_ID>
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
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.
- Panel
- CLI
In Routers > router > Static routes, click the ellipsis icon next to the route, then Delete. Repeat on the other router.
openstack router unset --route destination=10.20.20.0/24,gateway=172.31.255.5 <ROUTER_A_ID>
openstack router unset --route destination=10.10.10.0/24,gateway=172.31.255.1 <ROUTER_B_ID>
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).
- Panel
- CLI
In Routers > Router A > Interfaces, click the ellipsis icon next to the 172.31.255.1 interface, then Delete.
openstack router remove subnet <ROUTER_A_ID> <TRANSIT_SUBNET_ID>
4. Remove the share (Project A, CLI only):
openstack network rbac delete <RBAC_ID>
5. Delete the transit network (Project A).
- Panel
- CLI
In Networks, click the ellipsis icon next to transit-net, then Delete.
openstack network delete <TRANSIT_NETWORK_ID>
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.