---
title: "Creating a private network with Gateway (EN)"
description: "Discover how to create a Private network with a Gateway"
url: https://docs.ovhcloud.com/pt/guides/public-cloud/network-services/create-private-network-gateway
lang: pt
lastUpdated: 2025-04-22
---
# Creating a private network with Gateway (EN)

## Objective

A [Gateway](https://www.ovhcloud.com/pt/public-cloud/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](/pt/guides/public-cloud/cross-functional/compute-prepare-openstack-api-environment.md)
 or the [OVHcloud API](https://eu.api.ovh.com/)
.
**Learn how to create a private network with a gateway.**

## Requirements

- A [Public Cloud project](https://www.ovhcloud.com/pt/public-cloud/) in your OVHcloud account
- Access to the [OVHcloud API](https://eu.api.ovh.com/) or the OpenStack command line environment ([Tutorial](/pt/guides/public-cloud/cross-functional/compute-prepare-openstack-api-environment.md))
- The [OpenStack Command Line Interface](https://docs.openstack.org/newton/user-guide/common/cli-install-openstack-command-line-clients.html) tool installed on your working environment (optional)

## Instructions


***

### Acesso à Área de Cliente OVHcloud

- **Ligação direta:** <ManagerLink to="/#/pci/projects">Public Cloud Projects</ManagerLink>
- **Caminho de navegação:** <code className="action">Public Cloud</code> > Selecione o seu projeto

***


### Via the OVHcloud Control Panel

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

:::


**Step 1**

Click on <code className="action">Gateway</code> 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](/pt/guides/public-cloud/network-services/vrack.md#activation) of the relevant guide.
Next, click on <code className="action">Create a Gateway</code>.
![gateway creation](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/firstgatewaycreation.png)

**Step 2**

First, select a location. It is best to create a Public Gateway in the region where you intend to deploy your private instances.
![select location](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/select_region.png)

**Step 3**

In the next step, select your gateway size.
![gateway size selection](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/select_size.png)| Size | Bandwith      | Cost                      |
| ---- | ------------- | ------------------------- |
| S    | up to 200Mbps | 2€/month, excluding tax   |
| M    | up to 500Mbps | 8€/month, excluding tax   |
| L    | up to 2Gbps   | 35€/month, excluding tax  |
| XL   | up to 4Gbps   | 121€/month, excluding tax |
| 2XL  | up to 8Gbps   | 304€/month, excluding tax |


**Step 4**

The next step allows you to edit the default name of your gateway and attach a private network to it. You can use the drop down list to select an existing private network. Be aware that only single-region private networks are supported by Gateway.
![dropdownlist](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/gatewayandprivatenetwork.png)Otherwise, click on <code className="action">Add a private network</code> to create a new one (in simplified dialog box with predefined values).
![create private network](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/newprivatenetwork.png)In our example, a private network does not exist yet in the region we selected, so we create a new one.
In the popup window, enter a name for your private network, select a subnet and click on <code className="action">Add</code>.
![create private network](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/createprivatenetwork.png)

**Step 5**

Once the network has been added, click on <code className="action">Create a gateway</code>.
![create gateway](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/confirmcreation.png)The creation may take several minutes, you may need to refresh the page after a couple of minutes to display the new service.


**Step 6**

Once the creation is done, you now have a private network linked to a public gateway.
To view your newly created private network, click on <code className="action">Private Networks</code> in the left-hand menu under **Network**.
![new private network](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/createdprivatenetwork.png)You can view the new gateway in the <code className="action">Gateway</code> section.
![new private network](/images/public-cloud/network-services/getting-started-02-create-private-network-gateway/mynewgateway.png)

### Via Terraform

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

- [How to use Terraform](/pt/guides/public-cloud/cross-functional/how-to-use-terraform.md)

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

```python
# 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:

```console
terraform apply
```

### Via the OpenStack API

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

- [Preparing an environment to use the OpenStack API](/pt/guides/public-cloud/cross-functional/compute-prepare-openstack-api-environment.md)
- [Setting OpenStack environment variables](/pt/guides/public-cloud/cross-functional/compute-set-openstack-environment-variables.md)


**Step 1**

Once your environment is ready, type the following at the command line to create a network and subnet:
```console
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:
```console
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**

```console
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**

Log in to the OVHcloud APIv6 interface according to the relevant guide ([First steps with the OVHcloud API](/pt/guides/manage-and-operate/api/first-steps.md)).
In case the project ID is unknown, the calls below allow you to retrieve it.

🇪🇺EU▾

[GET/cloud/project](https://eu.api.ovh.com/console/?section=/cloud&branch=v1#get-/cloud/project)

:::info
This call retrieves the list of projects.
:::

🇪🇺EU▾

[GET/cloud/project/{serviceName}](https://eu.api.ovh.com/console/?section=/cloud&branch=v1#get-/cloud/project/-serviceName-)

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


**Step 2**

**Create your private network and gateway**

🇪🇺EU▾

[POST/cloud/project/{serviceName}/region/{regionName}/gateway](https://eu.api.ovh.com/console/?section=/cloud&branch=v1#post-/cloud/project/-serviceName-/region/-regionName-/gateway)

Fill in the fields according the following table.
| Field       | Description                                                                                                  |                                                     |
| ----------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- |
| serviceName | 'The ID of your project'                                                                                     |                                                     |
| regionName  | Example: GRA9                                                                                                |                                                     |
| model       | size of your gateway (l, m ,s) depending on your needs                                                       |                                                     |
| name        | set a name for your gateway, you can click on the dropdown arrow and select "null" for a default one         |                                                     |
| name        | set a name for your private network, you can click on the dropdown arrow and select "null" for a default one |                                                     |
| cidr        | IP block for your subnet                                                                                     | Ex : 192.168.1.0/24                                 |
| enableDhcp  | check the box for yes                                                                                        |                                                     |
| ipVersion   | 4                                                                                                            | please note that this is not available yet for IPv6 |
The VLAN identifier (vlanId) is required if you want to create a specific VLAN. You can enter a value (between 2 - 4000) or leave it empty. If left empty, the system will automatically assign one by default.
:::info
This is the step of creating the private network and gateway by region.
You will need to do the same for each region where your private instances are present.
:::
The creation will take a few minutes.
To verify the details of your gateway, you can use the following API call:

🇪🇺EU▾

[GET/cloud/project/{serviceName}/region/{regionName}/gateway](https://eu.api.ovh.com/console/?section=/cloud&branch=v1#get-/cloud/project/-serviceName-/region/-regionName-/gateway)

Fill in the field with the previously obtained information:
- **serviceName**: The Public Cloud project ID in the form of a 32-character string
- **regionName**: the name of your region
You can leave the “subnetId” field blank in order to obtain all the gateways created in the region specified.


## Go further

Learn more about Gateway and its scenarios on our [dedicated page](https://www.ovhcloud.com/pt/public-cloud/gateway/).

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/pt/professional-services/) 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](https://community.ovhcloud.com/).
