Openstack is a well-known cloud system, it is being used extensively to setup private and public cloud infrastructures. Many renowned hosting companies are using openstack based cloud setups to fulfill the modern day computing requirements of their customers. Openstack is a well-organized, well-structured system, but you need to have a decent amount of system administration experience to setup cloud infrastructure using this system. You should have good knowledge of operating systems and general understanding of networking concepts. Today, we are going to discuss how we can assign public IPs (known as “Floating IPs” in openstack terminology) to the virtual machines (known as “instances” in openstack terminology) using VLAN.
Assigning Public IPs and Internet to Openstack Virtual Machines
In order to assign public IPs to your openstack instances/virtual machines, you need to go through following steps.
- Create an internal (tenant) network
- Create an external network
- Add a Router
- Add internal (tenant) network as an interface to the router
- Add external network as gateway to the router
Internal network (also called Tenant network) should be created with type as “Gre” or “VXLAN”. Following neutron command should take care of this.
In order to create internal network of type GRE, run:
Once internal network has been created, add subnet for this network.
Now let’s create an external network of type VLAN.
Just like we did for internal network, we will add a subnet for external network, specifying the allocation pool and gateway IP for the vlan we intend to use. Replace IP range and gateway with your own addresses.
Some tests to perform before proceeding further:
Make sure your host is able to reach the external gateway you provided in above step via tracert or ping. Also verify that the IP address range you allocated as pool shouldn’t be in use at any other hosts.
We will now add a router for successful internal and external communication.
Add tenant network to the router as an interface.
Add external network to this router as “Gateway”.
That’s it, we are done, spin instances on internal network and assign public/floating IP for internet and external connectivity.