{"id":4625,"date":"2014-04-14T11:22:05","date_gmt":"2014-04-14T09:22:05","guid":{"rendered":"http:\/\/blog.zhaw.ch\/icclab\/?p=4625"},"modified":"2014-04-17T09:57:49","modified_gmt":"2014-04-17T07:57:49","slug":"floating-ips-management-in-openstack","status":"publish","type":"post","link":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/","title":{"rendered":"Floating IPs management in Openstack"},"content":{"rendered":"<p>Openstack is generally well suited for typical use cases and there is hardly reasons to tinker with advance options and features available. Normally you would plan your public IP addresses usage and management well in advance, but if you are an experimental lab like ours, many a times things are handled in an ad-hoc manner. Recently, we ran into a unique problem which took us some time to figure out a solution.<\/p>\n<p>We manage a full 160.xxx.xxx.xxx\/24 block of 255 public IP addresses. Due to an underestimated user demand forecast, in our external cloud we ended up with a floating-ip pool that was woefully inadequate. One solution was to remove the external network altogether and recreate a new one with the larger floating-ip pool. The challenge was &#8211; we had real users, with experiments running on our cloud and destroying the external network was not an option.<\/p>\n<p>So here is what we did to add more floating ips to the pool without even stopping or restarting any of the neutron services &#8211;<\/p>\n<ol>\n<li>Log onto your openstack controller node<\/li>\n<li>Read the neutron configuration file (usually located at \/etc\/neutron\/neutron.conf<\/li>\n<li>Locate the connection string &#8211; this will tell you where the neutron database in located<\/li>\n<li>Depending on the database type (mysql, sqlite) use appropriate database managers (ours was using sqlite)<\/li>\n<\/ol>\n<p>I will next show you what to do to add more IPs to the floating pool for sqlite3, this can be easily adapted for mysql.<\/p>\n<pre>$ sqlite3 \/var\/lib\/neutron\/ovs.sqlite\r\nSQLite version 3.7.9 2011-11-01 00:52:41\r\nEnter \".help\" for instructions\r\nEnter SQL statements terminated with a \";\"\r\nsqlite&gt; .tables<\/pre>\n<p>The list of tables used by neutron dumped by the previous command will be similar to &#8211;<\/p>\n<pre>agents ovs_tunnel_endpoints\r\nallowedaddresspairs ovs_vlan_allocations\r\ndnsnameservers portbindingports\r\nexternalnetworks ports\r\nextradhcpopts quotas\r\nfloatingips routerl3agentbindings\r\nipallocationpools routerroutes\r\nipallocations routers\r\nipavailabilityranges securitygroupportbindings\r\nnetworkdhcpagentbindings securitygrouprules\r\nnetworks securitygroups\r\novs_network_bindings subnetroutes\r\novs_tunnel_allocations subnets<\/pre>\n<p>The tables that are of interest to us are &#8211;<\/p>\n<ul>\n<li>ipallocationpools<\/li>\n<li>ipavailabilityranges<\/li>\n<\/ul>\n<p>Next look into the schema of these tables, this will shed more light into what needs to be modified &#8211;<\/p>\n<pre>sqlite&gt; .schema ipavailabilityranges\r\nCREATE TABLE ipavailabilityranges (\r\nallocation_pool_id VARCHAR(36) NOT NULL,\r\nfirst_ip VARCHAR(64) NOT NULL,\r\nlast_ip VARCHAR(64) NOT NULL,\r\nPRIMARY KEY (allocation_pool_id, first_ip, last_ip),\r\nFOREIGN KEY(allocation_pool_id) REFERENCES ipallocationpools (id) ON DELETE CASCADE\r\n);\r\nsqlite&gt; .schema ipallocationpools\r\nCREATE TABLE ipallocationpools (\r\nid VARCHAR(36) NOT NULL,\r\nsubnet_id VARCHAR(36),\r\nfirst_ip VARCHAR(64) NOT NULL,\r\nlast_ip VARCHAR(64) NOT NULL,\r\nPRIMARY KEY (id),\r\nFOREIGN KEY(subnet_id) REFERENCES subnets (id) ON DELETE CASCADE\r\n);\r\nsqlite&gt;<\/pre>\n<p>Next look into the content of these tables, for brevity only partial outputs are shown below. Also I have masked some of the IP addresses with xxx, replace these with real values when using this guide.<\/p>\n<pre>sqlite&gt; select * from ipallocationpools;\r\nb5a7b8b4-ad10-4d92-b877-e406df8ceb91|f0034b20-3566-4f9f-a6d5-b725c02f98fc|10.10.10.2|10.10.10.254\r\n7bca3261-e578-4cfa-bba1-51ba6eae7791|765adcdf-72a4-4e07-8860-f443c7b9098b|160.xxx.xxx.32|160.xxx.xxx.80\r\na9994f70-2b9a-45f3-b5db-31ccc6cb7e90|72250c58-5fda-4d1b-a847-b71b432ea218|10.10.1.2|10.10.1.254\r\n23032620-731a-4092-9509-7591b53b5ddf|12849c1f-4456-4fc1-bea6-444cce4f1ac6|10.10.2.2|10.10.2.254\r\nfcf22336-2bd6-4e1c-92cd-e33af0b23ad9|bcf1082d-50d5-4ebc-a311-7e0618096356|10.10.11.2|10.10.11.254\r\nbc961a47-4902-4ca2-b4f4-c5fd581a364e|09b79d08-aa92-4b99-b1fd-61d5f31d3351|10.10.25.2|10.10.25.254<\/pre>\n<pre>sqlite&gt; select * from ipavailabilityranges;\r\nb5a7b8b4-ad10-4d92-b877-e406df8ceb91|10.10.10.6|10.10.10.254\r\na9994f70-2b9a-45f3-b5db-31ccc6cb7e90|10.10.1.2|10.10.1.2\r\n7bca3261-e578-4cfa-bba1-51ba6eae7791|160.xxx.xxx.74|160.xxx.xxx.74\r\n7bca3261-e578-4cfa-bba1-51ba6eae7791|160.xxx.xxx.75|160.xxx.xxx.75<\/pre>\n<p>Looking at the above two outputs, it is immediately clear what needs to be done next in order to add more IPs to the floating-ip range.<\/p>\n<ol>\n<li>modify the floating-ip record in the ipallocationpools table, extend the first_ip and\/or last_ip value(s)<\/li>\n<li>for each new ip address to be added in the pool, create an entry in the ipavailabilityranges table with first_ip same as last_ip value (set to the actual IP address)<\/li>\n<\/ol>\n<p>An an example, say I want to extend my pool from 160.xxx.xxx.80 to 160.xxx.xxx.82, this is what I would do<\/p>\n<pre>sqlite&gt; update ipallocationpools set last_ip='160.xxx.xxx.82' where first_ip='160.xxx.xxx.32';\r\nsqlite&gt; insert into ipavailabilityranges values ('7bca3261-e578-4cfa-bba1-51ba6eae7791', '160.xxx.xxx.81', '160.xxx.xxx.81');\r\nsqlite&gt; insert into ipavailabilityranges values ('7bca3261-e578-4cfa-bba1-51ba6eae7791', '160.xxx.xxx.82', '160.xxx.xxx.82');\r\nsqlite&gt; .exit<\/pre>\n<p>And that&#8217;s all, you have 2 additional IPs available for use from your floating-ip pool. And you don&#8217;t even need to restart any of the neutron services. make sure that the subnet id is the same as in the ipallocationpools table entry.<\/p>\n<div class=\"pt-sm\">Schlagw\u00f6rter: <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/floating-ip\/\">floating ip<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/neutron\/\">neutron<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/openstack\/\">openstack<\/a><br><\/div>","protected":false},"excerpt":{"rendered":"<p>Openstack is generally well suited for typical use cases and there is hardly reasons to tinker with advance options and features available. Normally you would plan your public IP addresses usage and management well in advance, but if you are an experimental lab like ours, many a times things are handled in an ad-hoc manner. [&hellip;]<\/p>\n","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[15,21],"tags":[403,404,240],"features":[],"class_list":["post-4625","post","type-post","status-publish","format-standard","hentry","category-howtos","category-openstack-2","tag-floating-ip","tag-neutron","tag-openstack"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Floating IPs management in Openstack - Service Engineering (ICCLab &amp; SPLab)<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Floating IPs management in Openstack\" \/>\n<meta property=\"og:description\" content=\"Openstack is generally well suited for typical use cases and there is hardly reasons to tinker with advance options and features available. Normally you would plan your public IP addresses usage and management well in advance, but if you are an experimental lab like ours, many a times things are handled in an ad-hoc manner. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Engineering (ICCLab &amp; SPLab)\" \/>\n<meta property=\"article:published_time\" content=\"2014-04-14T09:22:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-04-17T07:57:49+00:00\" \/>\n<meta name=\"author\" content=\"Piyush Harsh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Piyush Harsh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\"},\"author\":{\"name\":\"Piyush Harsh\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/2769375907ea1077b28a72e26889f003\"},\"headline\":\"Floating IPs management in Openstack\",\"datePublished\":\"2014-04-14T09:22:05+00:00\",\"dateModified\":\"2014-04-17T07:57:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\"},\"wordCount\":477,\"commentCount\":1,\"keywords\":[\"floating ip\",\"neutron\",\"openstack\"],\"articleSection\":[\"HowTos\",\"OpenStack\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\",\"name\":\"Floating IPs management in Openstack - Service Engineering (ICCLab &amp; SPLab)\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\"},\"datePublished\":\"2014-04-14T09:22:05+00:00\",\"dateModified\":\"2014-04-17T07:57:49+00:00\",\"author\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/2769375907ea1077b28a72e26889f003\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\/\/blog.zhaw.ch\/icclab\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Floating IPs management in Openstack\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/\",\"name\":\"Service Engineering (ICCLab &amp; SPLab)\",\"description\":\"A Blog of the ZHAW Zurich University of Applied Sciences\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/2769375907ea1077b28a72e26889f003\",\"name\":\"Piyush Harsh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/1bff005c7d14996aa22495163abeb371e92daff6c0219e40790dea7d8723d578?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1bff005c7d14996aa22495163abeb371e92daff6c0219e40790dea7d8723d578?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1bff005c7d14996aa22495163abeb371e92daff6c0219e40790dea7d8723d578?s=96&d=mm&r=g\",\"caption\":\"Piyush Harsh\"},\"sameAs\":[\"http:\/\/piyush-harsh.info\/\"],\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/author\/harh\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Floating IPs management in Openstack - Service Engineering (ICCLab &amp; SPLab)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/","og_locale":"en_US","og_type":"article","og_title":"Floating IPs management in Openstack","og_description":"Openstack is generally well suited for typical use cases and there is hardly reasons to tinker with advance options and features available. Normally you would plan your public IP addresses usage and management well in advance, but if you are an experimental lab like ours, many a times things are handled in an ad-hoc manner. [&hellip;]","og_url":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/","og_site_name":"Service Engineering (ICCLab &amp; SPLab)","article_published_time":"2014-04-14T09:22:05+00:00","article_modified_time":"2014-04-17T07:57:49+00:00","author":"Piyush Harsh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Piyush Harsh","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#article","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/"},"author":{"name":"Piyush Harsh","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/2769375907ea1077b28a72e26889f003"},"headline":"Floating IPs management in Openstack","datePublished":"2014-04-14T09:22:05+00:00","dateModified":"2014-04-17T07:57:49+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/"},"wordCount":477,"commentCount":1,"keywords":["floating ip","neutron","openstack"],"articleSection":["HowTos","OpenStack"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/","url":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/","name":"Floating IPs management in Openstack - Service Engineering (ICCLab &amp; SPLab)","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#website"},"datePublished":"2014-04-14T09:22:05+00:00","dateModified":"2014-04-17T07:57:49+00:00","author":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/2769375907ea1077b28a72e26889f003"},"breadcrumb":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.zhaw.ch\/icclab\/floating-ips-management-in-openstack\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/blog.zhaw.ch\/icclab\/"},{"@type":"ListItem","position":2,"name":"Floating IPs management in Openstack"}]},{"@type":"WebSite","@id":"https:\/\/blog.zhaw.ch\/icclab\/#website","url":"https:\/\/blog.zhaw.ch\/icclab\/","name":"Service Engineering (ICCLab &amp; SPLab)","description":"A Blog of the ZHAW Zurich University of Applied Sciences","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/2769375907ea1077b28a72e26889f003","name":"Piyush Harsh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1bff005c7d14996aa22495163abeb371e92daff6c0219e40790dea7d8723d578?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1bff005c7d14996aa22495163abeb371e92daff6c0219e40790dea7d8723d578?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1bff005c7d14996aa22495163abeb371e92daff6c0219e40790dea7d8723d578?s=96&d=mm&r=g","caption":"Piyush Harsh"},"sameAs":["http:\/\/piyush-harsh.info\/"],"url":"https:\/\/blog.zhaw.ch\/icclab\/author\/harh\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/4625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/comments?post=4625"}],"version-history":[{"count":21,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/4625\/revisions"}],"predecessor-version":[{"id":4670,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/4625\/revisions\/4670"}],"wp:attachment":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/media?parent=4625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/categories?post=4625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/tags?post=4625"},{"taxonomy":"features","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/features?post=4625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}