How to Extend Subnet Allocation Pool in OpenStack

extend subnet IP allocation pool in neutron
After OpenStack installation it can turn out, that the IP allocation pool of the subnet, we have just created is too small. If the allocation pool refers to public / provider network, we will quickly run out of free Floating IPs. Moreover, OpenStack Dashboard (Horizon) doesn’t provide the ability to extend or modify subnet IP alocation pool of already created subnet with already allocated IPs. But we can use dirty workaround and manually edit MariaDB which stores Openstack configuration data.

Steps:

1. Login to MariaDB

[root@controller ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 50
Server version: 5.5.40-MariaDB-wsrep MariaDB Server, wsrep_25.11.r4026Edit 

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

2. Verify existing subnet IP allocation pools before changes

MariaDB [neutron]> select * from ipallocationpools;
+--------------------------------------+--------------------------------------+--------------+----------------+
| id                                   | subnet_id                            | first_ip     | last_ip        |
+--------------------------------------+--------------------------------------+--------------+----------------+
| 0b3ba5c1-9898-4e55-8aad-6f629fbec25e | 377bc480-09ea-4e59-a127-18db0fd8c534 | 192.168.66.2 | 192.168.66.254 |
| d7818954-616d-4c89-83b8-4e53d84c36ce | 298f533d-35d7-436e-a0a6-df5de32ce7ff | 192.168.2.50 | 192.168.2.60   |
+--------------------------------------+--------------------------------------+--------------+----------------+
2 rows in set (0.05 sec)

3. Extend subnet IP allocation pool

Add new allocation pool record for existing subnet:

MariaDB [neutron]> INSERT into ipallocationpools VALUES (UUID(),"298f533d-35d7-436e-a0a6-df5de32ce7ff","192.168.2.75","192.168.2.100");
Query OK, 1 row affected (0.07 sec)

4. Verify existing subnet IP allocation pools after changes

MariaDB [neutron]> select * from ipallocationpools;
+--------------------------------------+--------------------------------------+--------------+----------------+
| id                                   | subnet_id                            | first_ip     | last_ip        |
+--------------------------------------+--------------------------------------+--------------+----------------+
| 0b3ba5c1-9898-4e55-8aad-6f629fbec25e | 377bc480-09ea-4e59-a127-18db0fd8c534 | 192.168.66.2 | 192.168.66.254 |
| b96e71d2-0b30-11e6-8744-52540000cb3f | 298f533d-35d7-436e-a0a6-df5de32ce7ff | 192.168.2.75 | 192.168.2.100  |
| d7818954-616d-4c89-83b8-4e53d84c36ce | 298f533d-35d7-436e-a0a6-df5de32ce7ff | 192.168.2.50 | 192.168.2.60   |
+--------------------------------------+--------------------------------------+--------------+----------------+
3 rows in set (0.00 sec)

Note: for subnet_id = 298f533d-35d7-436e-a0a6-df5de32ce7ff we have now 2 ip allocation pools (192.168.2.50 – 192.168.2.60) and (192.168.2.75 – 192.168.2.100).

Verify extended subnet allocation pools in Neutron:

[root@controller ~(keystone_admin)]# neutron subnet-list
+--------------------------------------+----------------+-----------------+----------------------------------------------------+
| id                                   | name           | cidr            | allocation_pools                                   |
+--------------------------------------+----------------+-----------------+----------------------------------------------------+
| 377bc480-09ea-4e59-a127-18db0fd8c534 | private_subnet | 192.168.66.0/24 | {"start": "192.168.66.2", "end": "192.168.66.254"} |
| 298f533d-35d7-436e-a0a6-df5de32ce7ff | public_subnet  | 192.168.2.0/24  | {"start": "192.168.2.75", "end": "192.168.2.100"}  |
|                                      |                |                 | {"start": "192.168.2.50", "end": "192.168.2.60"}   |
+--------------------------------------+----------------+-----------------+----------------------------------------------------+

Share on: Share on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponShare on LinkedInPin on PinterestBuffer this pageShare on TumblrDigg thisFlattr the authorShare on RedditShare on VKShare on Yummly
Liked it? Take a second to support tuxfixer.com on Patreon!
Hadoop Developer Training

Leave a Reply

Name *
Email *
Website