Creating a private network with Gateway (EN)

Objective

A Gateway offers a secure outbound connection method from your private network instances or the ability to use Floating IPs with your instance or Load Balancer for service exposition.

This can be created via the OVHcloud Control Panel, the OpenStack API or the OVHcloud API.

Learn how to create a private network with a gateway.

Requirements

Instructions


Dostęp do Panelu klienta OVHcloud


Via the OVHcloud Control Panel

Tip

Click on the tabs below to view each of the 6 steps in turn.

Step 1
Step 2
Step 3
Step 4
Step 5
Step 6

Click on Gateway in the left-hand menu under Network.

Please note that you need to have activated the vRack before proceeding, if you do not have a vRack, please consult this section of the relevant guide.

Next, click on Create a Gateway.

gateway creation

Via Terraform

Before proceeding, it is recommended that you consult this guide:

Once your environment is ready, you can create a Terraform file called 'private_network_simple.tf' and write the following:

# Create a Private Network
resource "ovh_cloud_project_network_private" "mypriv" {
  service_name  = "my_service_name"  # Replace with your OVHcloud project ID
  vlan_id       = "0"             # VLAN ID (usually 0)
  name          = "mypriv"
  regions       = ["GRA11"]
}
# Create a private subnet
resource "ovh_cloud_project_network_private_subnet" "myprivsub" {
  service_name  = ovh_cloud_project_network_private.mypriv.service_name
  network_id    = ovh_cloud_project_network_private.mypriv.id
  region        = "GRA11"
  start         = "10.0.0.2"
  end           = "10.0.255.254"
  network       = "10.0.0.0/16"
  dhcp          = true
}
# Create a custom gateway
resource "ovh_cloud_project_gateway" "gateway" {
  service_name = ovh_cloud_project_network_private.mypriv.service_name
  name         = "my-gateway"
  model        = "s"  # Gateway model ("s" for small, "m" for medium, etc.)
  region       = ovh_cloud_project_network_private_subnet.myprivsub.region
  network_id   = tolist(ovh_cloud_project_network_private.mypriv.regions_attributes[*].openstackid)[0]
  subnet_id    = ovh_cloud_project_network_private_subnet.myprivsub.id
}

You can create your resources by entering the following command:

terraform apply

Via the OpenStack API

Before proceeding, it is recommended that you consult these guides:

Step 1

Once your environment is ready, type the following at the command line to create a network and subnet:

openstack network create my_network

openstack subnet create my_subnet --subnet-range <my_private_ip_range/mask> --network my_network --no-dhcp

Step 2

List the quality of service available:

openstack network qos policy list
+--------------------------------------+---------------+--------+---------+----------------------------------+
| ID                                   | Name          | Shared | Default | Project                          |
+--------------------------------------+---------------+--------+---------+----------------------------------+
| a5524eb5-944e-4106-b209-9478bbdcedab | large_router  | True   | False   | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| c210f5b2-db59-4973-a25f-9131195b6bcf | medium_router | True   | False   | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| ec0ee74d-a1f3-43f6-87aa-b0e69ef8ce45 | small_router  | True   | False   | XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
+--------------------------------------+---------------+--------+---------+----------------------------------+

Step 3

openstack router create my_router 

openstack router add subnet my_router my_subnet

openstack router set --external-gateway Ext-Net --qos-policy QOS_ID_OF_YOUR_CHOICE my_router

If you omit the --qos-policy parameter the "small" quality of service will be applied.

Via the OVHcloud API

Step 1
Step 2

Log in to the OVHcloud APIv6 interface according to the relevant guide (First steps with the OVHcloud API).

In case the project ID is unknown, the calls below allow you to retrieve it.

GET/cloud/project
Info

This call retrieves the list of projects.

Info

This call identifies the project via the "description" field.

Go further

Learn more about Gateway and its scenarios on our dedicated page.

If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.

Join our community of users.

Czy ta strona była pomocna?