Set up access to and from the Internet
For the cloud server, cloud load balancer, and Managed Database cluster, you can configure access to and from the Internet:
- through a public IP address. To filter incoming traffic, you will be able to use a cloud firewall and security groups;
- through a public subnet. To filter incoming traffic, you will be able to use security groups.
If your device only needs internet access without access from the internet, you can set it up through a cloud router.
Set up access to and from the Internet via a public IP address
To configure Internet access to and from the Internet for devices on a private subnet, you must connect the subnet to a cloud router with Internet access and connect a public IP address to the device. The cloud router acts as a 1:1 NAT via the external IP address that is allocated when the router is connected to the Internet: it organizes Internet access from the private subnet and handles incoming traffic packets for the public IP addresses.
You can connect a public IP address when creating a cloud server, creating a cloud load balancer, creating a Managed Database cluster (example for PostgreSQL), and after creation.
The device must be on a private subnet or a global router subnet that meets the requirements. To prepare the subnet, use the instructions Prepare a private subnet to connect a public IP address.
- Create a public IP address.
- Create a cloud router with internet connection.
- Connect the private subnet to the cloud router.
- Connect a public IP address to a device port on the private subnet.
- If the subnet gateway does not match the IP address of the cloud router, configure a static route to the Internet on the subnet.
1. Create a public IP address
Control panel
OpenStack CLI
-
Create a public IP address:
openstack floating ip create external-network
2. Create a cloud router with internet connection
Control Panel
OpenStack CLI
- In the Dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Cloud routers tab.
- Click Create router.
- Select the pool where the cloud router will be created.
- Enter the name of the router.
- Check the box Connect router to the Internet - 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.. -
Connect the cloud router to the Internet - an external IP address will be assigned to the router:
openstack router set --external-gateway external-network <router>Specify
<router>- Cloud router ID or name, can be viewed using theopenstack routerlistcommand
3. Connect a subnet to the cloud router
Control Panel
OpenStack CLI
-
In the Dashboard, on the top menu, click Products and select Cloud Servers.
-
Go to Network → Cloud routers tab.
-
Open the router page.
-
Click Connect Subnet.
-
Select a private subnet or a global router subnet.
-
Optional: Enter the IP address of the router - any free IP address from the subnet. If you do not specify an IP address, it will be automatically selected from free subnet addresses.
To allow devices on the subnet to access the Internet without configuring additional routes, the IP address of the cloud router must match the gateway of the private subnet. If the subnet gateway is already busy, you will need to configure a static route through the cloud router on the subnet to access the Internet.
You can view the subnet gateway in the Control Panel: in the top menu, click Products → Cloud Servers → Network → Private Networks tab → Network page → Subnets tab → Subnet card → Automatic Network Settings block → Subnet Gateway field.
-
Click Connect.
-
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 with the commandopenstack router list;<subnet>- The ID or name of a private subnet can be viewed with the commandopenstack subnet list.
4. Connect a public IP address to a device port on a private subnet
Control panel
OpenStack CLI
- In the dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Private Networks tab.
- Open the Network page → Ports tab.
- In the port card of the cloud server or load balancer, click Connect Public IP.
- Select a public IP address.
- Click Connect.
-
Connect a public IP address to the port:
openstack floating ip set --port <port> <public_ip_address>Specify:
<port>- The port ID of a cloud server or load balancer can be viewed with the commandopenstack port list;<public_ip_address>-ID or public IP address, can be viewed with the commandopenstack floating ip list.
5. Configure a static route to the Internet on a subnet
If you specified a router IP address other than the subnet gateway when connecting the subnet to the cloud router, you must configure a static route to the Internet through the cloud router in the subnet. When configuring, specify:
- the destination subnet is
0.0.0.0/0;; - gateway (next-hop) - IP address of the cloud router.
Configure access to and from the Internet via a public subnet
To configure access to and from the Internet via a public subnet, you must connect the device to the public subnet. For a load balancer and cloud database cluster, this can only be done when creating the load balancer and creating the cluster (example for PostgreSQL). A cloud server can be connected to the public subnet either when the server is created or after it is created - to do this, you need to add the cloud server to the public subnet via a port.
1. Create a public subnet
Control Panel
- In the Dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Public Networks tab.
- Click Create Subnet.
- Select the pool where the public subnet will be created.
- Select the subnet size - the range of IP addresses available on the subnet.
- Optional: To change the DNS servers, click . Enter one to three values. Click .
- Click Create.
2. Add the cloud server to the public subnet via port
Control panel
OpenStack CLI
- In the dashboard, on the top menu, click Products and select Cloud Servers.
- Open the server page → Ports tab.
- Click Add Port.
- Select a public subnet.
- Enter the IP address of the port.
- Click Add Port.
-
Create a port on the public subnet:
openstack port create \
--network <subnet> \
--fixed-ip subnet=<subnet>,ip-address=<port_ip_address> \
<port_name>Specify:
<subnet>- The ID or name of the public subnet can be viewed with the commandopenstack network list;<port_ip_address>- The IP address of the port;<port_name>- port name.
-
Add a port to the cloud server:
openstack server add port <server> <port>Specify:
<server>- The ID or name of the cloud server can be viewed with the commandopenstack server list;<port>- The port ID or name can be viewed with the commandopenstack port list.
Set up internet access via cloud router
You can configure Internet access for devices on a private subnet without external access from the Internet.
To do this, you need to connect a cloud router with internet access to the private subnet or the global router subnet where the device is located. If the cloud router is connected to the Internet, it acts as a 1:1 NAT for access from the private network to the Internet via the router's external IP address. The external address is only used to access the Internet from the device, it cannot be used to connect to devices on the subnet.
- Create a cloud router with internet connection.
- Connect the private subnet to the cloud router.
- If the subnet gateway does not match the IP address of the cloud router, configure a static route to the Internet on the subnet.
1. Create a cloud router with internet connection
Control Panel
OpenStack CLI
- In the Dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Cloud routers tab.
- Click Create router.
- Select the pool where the cloud router will be created.
- Enter the name of the router.
- Check the box Connect router to the Internet - 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.. -
Connect the cloud router to the Internet - an external IP address will be assigned to the router:
openstack router set --external-gateway external-network <router>Specify
<router>- Cloud router ID or name, can be viewed using theopenstack routerlistcommand
2. Connect the subnet to the cloud router
Control Panel
OpenStack CLI
-
In the Dashboard, on the top menu, click Products and select Cloud Servers.
-
Go to Network → Cloud routers tab.
-
Open the router page.
-
Click Connect Subnet.
-
Select a private subnet or a global router subnet.
-
Optional: Enter the IP address of the router - any free IP address from the subnet. If you do not specify an IP address, it will be automatically selected from free subnet addresses.
To allow devices on the subnet to access the Internet without configuring additional routes, the IP address of the cloud router must match the gateway of the private subnet. If the subnet gateway is already busy, you will need to configure a static route through the cloud router on the subnet to access the Internet.
You can view the subnet gateway in the Control Panel: in the top menu, click Products → Cloud Servers → Network → Private Networks tab → Network page → Subnets tab → Subnet card → Automatic Network Settings block → Subnet Gateway field.
-
Click Connect.
-
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 with the commandopenstack router list;<subnet>- The ID or name of a private subnet can be viewed with the commandopenstack subnet list.
3. Configure a static route to the Internet in the subnetwork
If you specified a router address other than the subnet gateway when connecting the subnet to the cloud router, you must configure a static route to the Internet through the cloud router in the subnet. When configuring, specify:
- the destination subnet is
0.0.0.0/0;; - gateway (next-hop) - IP address of the cloud router.