Cloud routers
With a cloud router, you can:
- route traffic between private subnets. All private subnets connected to the same router can communicate with each other and use the router's IP address as the default route;
- configure Internet access for devices in the private subnet (outgoing traffic) and from the Internet (incoming traffic), see the instructions for details. Set up access to and from the Internet. The cloud router performs 1:1 NAT via an external IP address that is allocated when the router is connected to an external network: it organizes access to the Internet from a private subnet and processes incoming traffic packets for public IP addresses.
On a cloud router, you can configure static routes.
A cloud router can only be used within one projects and one pool.
Cloud routers have a limit on the amount of traffic — bandwidth. You can see it in the table Throughput.
Working with cloud routers can be in the control panels with the help of OpenStack CLI or Terraform.
Create a cloud router
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- Click Create a router.
- Select pool in which a cloud router will be created.
- Enter the name of the router.
- Optional: check the checkbox Connect the router to an external network — an external IP address will be assigned to the router.
- Click Create.
-
Create a cloud router:
openstack router create <router_name>
Specify
<router_name>
— the name of the cloud router. -
Optional: connect the cloud router to an external network — an external IP address will be assigned to the router:
openstack router set --external-gateway external-network <router>
Specify
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
Connect a subnet to the cloud router
For private subnets to communicate with each other, they must be connected to the same cloud router. The subnets must have different CIDRs.
To set up access to and from the Internet for devices on private subnets using a cloud router, use these instructions Set up access to and from the Internet.
Control panel
OpenStack CLI
-
В control panels go to Cloud platform → Network.
-
Open the tab Cloud routers.
-
Open the router card.
-
Click Add a subnet.
-
Select a private subnet or a global router subnet.
-
Enter the IP address of the router. The IP address of the cloud router must match the default gateway of the private subnet. To view the default gateway on the private subnet, click the tab Private networks → network page → tab Subnetworks → subnet card → block Automatic network settings → field Subnet Gateway.
If you are connecting a global router subnet, the IP address of the cloud router must match the default gateway of the global router subnet and be different from the global router's IP address, the IP addresses of devices on the network, and service addresses
.253
и.254
. -
Click Add a subnet.
-
Connect the subnet to the cloud router:
openstack router add subnet <router> <subnet>
Specify:
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
;<subnet>
— ID or private subnet name, can be viewed with the commandopenstack subnet list
Disconnect the subnet from the cloud router
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- Open the router card.
- On the menu. of the private subnet, select Delete port.
- Click Delete.
-
Disconnect the subnet from the cloud router:
openstack router remove subnet <router> <subnet>
Specify:
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
;<subnet>
— ID or subnet name, can be viewed with the commandopenstack subnet list
Connect the cloud router to an external network
To configure Internet access for devices on a private subnet, the subnet must be connected to a cloud router with access to an external network (external-network
). When you connect the router to an external network, an external IP address will be assigned to the router, through which the router will perform 1:1 NAT function.
If the router connects multiple private subnets, devices on all subnets will be able to access the Internet.
To set up access from the Internet for devices on private subnets using a cloud router, use these instructions Set up access to and from the Internet.
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- On the menu. of the cloud router, select Connect to an external network.
-
Connect the cloud router to an external network:
openstack router set --external-gateway external-network <router>
Specify
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
Disconnect the cloud router from the external network
If you disconnect the Cloud Router from the external network, its external IP address will return to the address pool. When you reconnect, the IP address will change.
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- On the menu. of the cloud router, select Disconnect from external power supply.
-
Disconnect the cloud router from the external network:
openstack router unset --external-gateway <router>
Specify
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
Assign a firewall to a cloud router port
Inbound and outbound traffic that is not allowed in the cloud firewall rules will be denied on the cloud router port. Active sessions on the router that cannot be established by the new rules will be interrupted.
You cannot assign more than one firewall to a single router port.
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- Open the cloud router card.
- In the row of the private subnet for which you want to configure traffic filtering, in the column Firewall click Connect.
- Select a firewall.
- Click Assign.
-
Assign a firewall to the cloud router port:
openstack firewall group set --port <router_port> <firewall>
Specify:
<router_port>
— The ID or port name of the router to which the firewall will be assigned can be viewed using the commandopenstack port list
. To assign a firewall to multiple router ports, list their IDs or names with a space;<firewall>
— ID or name of the firewall can be viewed with the commandopenstack firewall group list
Disconnect the firewall from the cloud router port
The cloud firewall rules will no longer apply — all inbound and outbound traffic that passes through the cloud router port will be allowed.
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- Open the router card.
- On the menu. Select the private subnet for which you configured traffic filtering, and then select Disconnect the port from the port.
- Click Disconnect.
-
Disconnect the firewall from the router port:
openstack firewall group unset --port <router_port> <firewall>
Specify:
<router_port>
— The ID or port name of the router from which the firewall will be disconnected can be viewed using the commandopenstack port list
;<firewall>
— ID or name of the firewall can be viewed with the commandopenstack firewall group list
Turn on the cloud router
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- In the cloud router card, turn on the router.
-
Turn on the cloud router:
openstack router set --enable <router>
Specify
<router>
— The ID or name of the router can be viewed with the commandopenstack router list
Turn off the cloud router
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- In the cloud router card, disable the router.
-
Disconnect the cloud router:
openstack router set --disable <router>
Specify
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
Remove the cloud router
Control panel
OpenStack CLI
- В control panels go to Cloud platform → Network.
- Open the tab Cloud routers.
- If subnets are connected to the router, delete the router ports in the subnets. To do this, open the router card and in the menu subnets, select Delete port.
- On the menu. of the router, select Remove the router.
- Click Delete.
-
If subnets are connected to the router, delete the router ports:
openstack router remove port <router> <port_id>
Specify:
<router>
— The ID or name of the cloud router, can be viewed using the commandopenstack router list
;<port_id>
— The ID of the port connected to the router can be viewed using the commandopenstack port list --router <router>
-
Remove the router:
openstack router delete <router>