Post

OpenStack Neutron - Expand and/or Update Floating IP Range

OpenStack Neutron - Expand and/or Update Floating IP Range

Managing Floating IP Ranges in OpenStack Neutron

Sometimes you run out of public IP addresses and need to expand the floating IP range. This guide explains how to modify your existing IP allocation pools.

Expanding a Continuous IP Range

If a non-interrupted range is available to expand into from the current range, simply use:

1
neutron subnet-update --allocation-pool start=<original-start-ip>,end=<new-end-ip>

This will overwrite the existing range and expand it to the new end-IP.

Adding a Separate IP Range

To add an extra, separate IP range while still keeping the original range, use:

1
neutron subnet-update <subnet-id> --allocation-pool start=<original-start-ip>,end=<original-end-ip> --allocation-pool start=<additional-start-ip>,end=<additional-end-ip>

Example 1: Extending a Continuous IP Range

Step 1: List Available Subnets

1
2
3
4
5
6
7
8
9
[root@c6320-n1 ~(keystone_admin)]# neutron subnet-list
+--------------------------------------+-----------+---------------+-----------------------------------------------+
| id                                   | name      | cidr          | allocation_pools                              |
+--------------------------------------+-----------+---------------+-----------------------------------------------+
| 1b66dad8-2f2c-4667-9460-7729e2a68d1c | sub-pub   | 172.17.4.0/24 | {"start": "172.17.4.130", "end": "172.17.4.199"} |
| 74c90d00-af79-4f7c-92ef-4e38231e850c | sub_priv2 | 192.168.0.0/24| {"start": "192.168.0.40", "end": "192.168.0.50"}  |
| e6cb6f7e-5efd-42df-93e6-67ad4b056035 | sub_internal | 192.168.0.0/24 | {"start": "192.168.0.100", "end": "192.168.0.200"} |
| e47c7f4b-85ec-41e4-ad1a-cf9290a97d87 | sub_priv  | 172.16.0.0/24 | {"start": "172.16.0.100", "end": "172.16.0.200"} |
+--------------------------------------+-----------+---------------+-----------------------------------------------+

Step 2: View Subnet Details

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@c6320-n1 ~(keystone_admin)]# neutron subnet-show 1b66dad8-2f2c-4667-9460-7729e2a68d1c
+------------------+--------------------------------------------------+
| Field            | Value                                            |
+------------------+--------------------------------------------------+
| allocation_pools | {"start": "172.17.4.130", "end": "172.17.4.199"} |
| cidr             | 172.17.4.0/24                                    |
| dns_nameservers  |                                                  |
| enable_dhcp      | False                                            |
| gateway_ip       | 172.17.4.1                                       |
| host_routes      |                                                  |
| id               | 1b66dad8-2f2c-4667-9460-7729e2a68d1c             |
| ip_version       | 4                                                |
| ipv6_address_mode|                                                  |
| ipv6_ra_mode     |                                                  |
| name             | sub-pub                                          |
| network_id       | fa9fb87f-70d9-4e18-83cb-c04695cbed5a             |
| subnetpool_id    |                                                  |
| tenant_id        | 8d93e4b0f8454ad7b539d14633d72136                 |
+------------------+--------------------------------------------------+

Step 3: Update the Subnet with Extended Range

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@c6320-n1 ~(keystone_admin)]# neutron subnet-update 1b66dad8-2f2c-4667-9460-7729e2a68d1c --allocation-pool start=172.17.4.130,end=172.17.4.240
Updated subnet: 1b66dad8-2f2c-4667-9460-7729e2a68d1c

[root@c6320-n1 ~(keystone_admin)]# neutron subnet-show 1b66dad8-2f2c-4667-9460-7729e2a68d1c
+------------------+--------------------------------------------------+
| Field            | Value                                            |
+------------------+--------------------------------------------------+
| allocation_pools | {"start": "172.17.4.130", "end": "172.17.4.240"} |
| cidr             | 172.17.4.0/24                                    |
| dns_nameservers  |                                                  |
| enable_dhcp      | False                                            |
| gateway_ip       | 172.17.4.1                                       |
| host_routes      |                                                  |
| id               | 1b66dad8-2f2c-4667-9460-7729e2a68d1c             |
| ip_version       | 4                                                |
| ipv6_address_mode|                                                  |
| ipv6_ra_mode     |                                                  |
| name             | sub-pub                                          |
| network_id       | fa9fb87f-70d9-4e18-83cb-c04695cbed5a             |
| subnetpool_id    |                                                  |
| tenant_id        | 8d93e4b0f8454ad7b539d14633d72136                 |
+------------------+--------------------------------------------------+

Example 2: Adding a Separate IP Range

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@c6320-n1 ~(keystone_admin)]# neutron subnet-update 1b66dad8-2f2c-4667-9460-7729e2a68d1c --allocation-pool start=172.17.4.130,end=172.17.4.199 --allocation-pool start=172.17.4.209,end=172.17.4.240
Updated subnet: 1b66dad8-2f2c-4667-9460-7729e2a68d1c

[root@c6320-n1 ~(keystone_admin)]# neutron subnet-show 1b66dad8-2f2c-4667-9460-7729e2a68d1c
+------------------+--------------------------------------------------+
| Field            | Value                                            |
+------------------+--------------------------------------------------+
| allocation_pools | {"start": "172.17.4.130", "end": "172.17.4.199"} |
|                  | {"start": "172.17.4.209", "end": "172.17.4.240"} |
| cidr             | 172.17.4.0/24                                    |
| dns_nameservers  |                                                  |
| enable_dhcp      | False                                            |
| gateway_ip       | 172.17.4.1                                       |
| host_routes      |                                                  |
| id               | 1b66dad8-2f2c-4667-9460-7729e2a68d1c             |
| ip_version       | 4                                                |
| ipv6_address_mode|                                                  |
| ipv6_ra_mode     |                                                  |
| name             | sub-pub                                          |
| network_id       | fa9fb87f-70d9-4e18-83cb-c04695cbed5a             |
| subnetpool_id    |                                                  |
| tenant_id        | 8d93e4b0f8454ad7b539d14633d72136                 |
+------------------+--------------------------------------------------+

Notes

  • When extending a range, make sure the new IPs aren’t already in use elsewhere
  • You can have multiple non-contiguous allocation pools within the same subnet
  • Changes take effect immediately, but existing floating IP allocations are not affected
  • Remember that the gateway IP (typically .1) and any reserved IPs cannot be included in allocation pools
This post is licensed under CC BY 4.0 by the author.