[Openstack-operators] Extending a flatdhcp network, or adding a new one

Gui Maluf guimalufb at gmail.com
Fri Mar 8 17:40:14 UTC 2013


Guys, I was successful with my network extension.

I'd a 192.168.22.0/24 network in FlatDHCP mode, Essex, and I would like to
extend into a larger network range(e.g 192.168.0.0/16), so I can have more
IP for instances.

So here is how I've done this. Remember that this is VERY RISKS, it's only
for thug life guys!

Nova database backup
# mysqldump -uroot -p'' nova > nova.dump

Then check your network and plan the extension. In my case all my instances
were at 192.168.22.0/24, changing the network to 192.168.0.0/16 does not
affect the IP's from VM's.

# mysql -uroot -p''  -e 'SELECT * FROM networks' nova

You have to change the values: cidr, netmask, gateway, broadcast, dhcp_start
# mysql -uroot -p'' -e "UPDATE networks set
cidr='192.168.0.0/16',netmask='255.255.0.0',gateway='192.168.0.1',broadcast='192.168.255.255',dhcp_start='192.168.0.2'"
nova

Now we have to create the missing fixed_ips
# for i in {0..21} {23..255}; do for j in {0..255}; do echo INSERT INTO
fixed_ips (created_at, deleted, address, network_id, allocated,leased,
reserved) values (now(),0,\'192.168.$i.$j\',1,0,0,0) ;done ;done >
insert_fixed_ips.sql

The command above will create all ips in the range 192.168.0.0 -
192.168.21.255 and 192.168.23.0 -> 192.168.255.255, because all
192.168.22.{0..255} exists already.

Then I change the two firsts IP and the last as RESERVED, cause they are
use to assign the network, gateway and broadcast.
# vim insert_fixed_ips.sql

INSERT INTO fixed_ips (created_at, deleted, address, network_id,
allocated,leased, reserved) values (now(),0,'192.168.0.0',1,0,0,1);
INSERT INTO fixed_ips (created_at, deleted, address, network_id,
allocated,leased, reserved) values (now(),0,'192.168.0.1',1,0,0,1);
INSERT INTO fixed_ips (created_at, deleted, address, network_id,
allocated,leased, reserved) values (now(),0,'192.168.0.2',1,0,0,0);
...
INSERT INTO fixed_ips (created_at, deleted, address, network_id,
allocated,leased, reserved) values (now(),0,'192.168.255.254',1,0,0,0);
INSERT INTO fixed_ips (created_at, deleted, address, network_id,
allocated,leased, reserved) values (now(),0,'192.168.255.255',1,0,0,1);

and use this script in mysql
# mysql -uroot -p'' nova < insert_fixed_ips.sql

Now change these values on /etc/nova/nova.conf in all nova-network
instances you have.
# vim /etc/nova/nova.conf
--fixed_range=192.168.0.0/16
--network_size=65535
--flat_network_dhcp_start=192.168.0.2

Kill dnsmasq in all nova-network instances and restart the service

# pkill dnsmasq
# service nova-network restart

That's it!.
 I hope this could be usefull to someone!



On Thu, Mar 7, 2013 at 2:23 PM, Gui Maluf <guimalufb at gmail.com> wrote:

> I'm having the same doubt, in the same environment(essex, flatdhcp). I've
> created a small network, and now I want to extend it, so I can get more
> fixed IPs. Is this possible?
> Thanks in advance.
>
>
> On Mon, Oct 1, 2012 at 4:09 PM, Ryan Lane <rlane at wikimedia.org> wrote:
>
>> Based on what I'm seeing from the documentation and from nova-network,
>> it's currently impossible to change a network range that's already
>> created. Am I incorrect on this? What options do I have if my network
>> is too small and it needs to be extended? Can I create a second
>> network? It seems that this is something that nova is completely
>> deficient at currently.
>>
>> Will this situation be fixed in quantum? It's a fairly normal
>> operation to change networks, it would be really nice if OpenStack
>> tools could do this too.
>>
>> - Ryan
>>
>> _______________________________________________
>> OpenStack-operators mailing list
>> OpenStack-operators at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>>
>
>
>
> --
> *guilherme* \n
> \t *maluf*
>



-- 
*guilherme* \n
\t *maluf*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20130308/e298ea00/attachment.html>


More information about the OpenStack-operators mailing list