Update Subnet Properties
Learn how to update the properties of an existing subnet. This can be needed if you want to comply with the prerequisites to be able to use the Public Cloud Gateway: have a gateway IP defined in your subnet.
For this example, we will use a private network and a subnet with the following properties:
- CIDR 10.4.0.0/16
- DHCP enabled with allocation pool on the global range
- No gateway IP
We will see how to update it to have a Gateway IP set to 10.4.0.1 and remove that IP from the allocation pool.
Requirements
- created a private network and a subnet as explained in this guide.
Instructions
Using the OVHcloud Control Panel
It is currently not possible to update a subnet through this interface but you can use our Horizon interface instead (see the instructions below).
Using Horizon
Connect to Horizon and choose the region where the subnet is defined as explained in this guide.
Click on Project > Network > Networks. The page will display the list of networks available that contain an OVHcloud-managed network for public connectivity (Ext-Net) as well as your network.

In that list, click on your network name ("Private_Network_VIN" in this example). The network detail page is then displayed.

Click the Subnets tab to see the subnets from the private network.

Click on Edit Subnet. For this guide, our target is to add a gateway IP:
- Uncheck the
Disable Gateway box. The field Gateway IP will appear. Fill it in with an IP within your CIDR (usually the first IP of the range is used). In our case, 10.4.0.1.

- Click on
Subnet Details. Update the Allocation Pools to remove the Gateway IP that you entered in the previous step. In our case, we need to update from 10.4.0.1,10.4.255.254 to 10.4.0.2,10.4.255.254

Click on Save and your subnet is updated with a Gateway IP!
Using the OpenStack Command Line Interface
You need to have your CLI environment set up and your variables defined.
Run the following command (replace Private_Network_VIN with the name of your private network):
❯ openstack network show Private_Network_VIN
Example result:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | nova |
| created_at | 2024-09-13T20:04:09Z |
| description | |
| dns_domain | None |
| id | 0ff9XXXX-XXXX-XXXX-XXXX-XXXXXXXXX8a |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | None |
| is_vlan_transparent | None |
| l2_adjacency | True |
| mtu | 1500 |
| name | Private_Network_VIN |
| port_security_enabled | True |
| project_id | REDACTED |
| provider:network_type | vrack |
| provider:physical_network | None |
| provider:segmentation_id | 4 |
| qos_policy_id | None |
| revision_number | 5 |
| router:external | Internal |
| segments | None |
| shared | False |
| status | ACTIVE |
| subnets | 50a7b953-b6a8-4097-92e4-6b71f0eada84 |
| tags | |
| tenant_id | REDACTED |
| updated_at | 2024-09-13T20:04:15Z |
+---------------------------+--------------------------------------+
In this output, the subnets line provides the UID of your subnet. You can check your subnet details by running the following command (update the UID according to your value):
❯ openstack subnet show 50a7b953-b6a8-4097-92e4-6b71f0eada84
Example result:
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| allocation_pools | 10.4.0.1-10.4.255.254 |
| cidr | 10.4.0.0/16 |
| created_at | 2024-09-13T20:04:13Z |
| description | |
| dns_nameservers | 213.186.33.99 |
| dns_publish_fixed_ip | None |
| enable_dhcp | True |
| gateway_ip | |
| host_routes | |
| id | 50a7b953-b6a8-4097-92e4-6b71f0eada84 |
| ip_version | 4 |
| ipv6_address_mode | None |
| ipv6_ra_mode | None |
| name | |
| network_id | 0ff9XXXX-XXXX-XXXX-XXXX-XXXXXXXXX8a |
| project_id | REDACTED |
| revision_number | 0 |
| segment_id | None |
| service_types | |
| subnetpool_id | None |
| tags | |
| updated_at | 2024-09-13T20:04:15Z |
+----------------------+--------------------------------------+
Now let's update the gateway_ip and the allocation_pool:
❯ openstack subnet set --gateway 10.4.0.1 --no-allocation-pool --allocation-pool start=10.4.0.2,end=10.4.255.254 50a7b953-b6a8-4097-92e4-6b71f0eada84
You can check that the subnet has been updated:
❯ openstack subnet show 50a7b953-b6a8-4097-92e4-6b71f0eada84
Example result:
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| allocation_pools | 10.4.0.2-10.4.255.254 |
| cidr | 10.4.0.0/16 |
| created_at | 2024-01-19T10:44:33Z |
| description | |
| dns_nameservers | 213.186.33.99 |
| dns_publish_fixed_ip | None |
| enable_dhcp | True |
| gateway_ip | 10.4.0.1 |
| host_routes | |
| id | 50a7b953-b6a8-4097-92e4-6b71f0eada84 |
| ip_version | 4 |
| ipv6_address_mode | None |
| ipv6_ra_mode | None |
| name | |
| network_id | 0ff9XXXX-XXXX-XXXX-XXXX-XXXXXXXXX8a |
| project_id | REDACTED |
| revision_number | 1 |
| segment_id | None |
| service_types | |
| subnetpool_id | None |
| tags | |
| updated_at | 2024-09-13T20:05:15Z |
+----------------------+--------------------------------------+
Go further
Browse all the Networking guides.
Browse the rest of the OVHcloud US documentation for guides on our other products and services.
Learn more about Public Cloud Network on the OVHcloud US website.
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 a custom analysis of your project.