Floating IP addresses

From Luna Node
Revision as of 22:57, 5 January 2016 by Favyen Bastani (Talk | contribs)

Jump to: navigation, search

Floating IP addresses enables dynamic IP address association with virtual machine instances (they can be associated with a VM, transferred between VMs, or removed back to the pool while the VMs are still running). On Luna Node Dynamic, all external IP addresses are floating IP addresses, and a virtual machine instance is allocated one when it is created.

Use cases

Here are some use cases for floating IP addresses.

  • Upgrading your website: suppose you want to upgrade your web software with minimal downtime. You could first snapshot your virtual machine to create a clone, and then perform the upgrade on the clone. When you are satisfied that the site is operational, you can seamlessly switch the floating IP address from the original virtual machine to the clone.
  • Reserving IP address: if you want to take a break from working on a project and avoid paying for the virtual machine instance, you can snapshot your virtual machine, de-associate the floating IP and place it on your account, and then delete the VM. Then, when you want to resume work, you only have to create a new VM from the snapshot and assign it the floating IP.

Usage

When your VM is provisioned, it already comes with an external IP address, which is also a floating IP (this is directly associated with a private IP address on your VM network interface). These IP addresses are included in the VM plan hourly price. You can also have a number of floating IP addresses reserved on your account, but not assigned to any VM; these are charged hourly at $1/month.

To transfer the IP of a VM to your account, go to the Virtual Machines sidebar entry, select your VM, switch to the IP tab, and then click De-associate floating IP. Then, to assign it to another VM, select the other VM, de-associate its current IP if it has one (you may want to also delete the IP from your account so it isn't charged), and then associate it with the desired floating IP.

You can use the Manage Floating IPs page (in the sidebar) to add and remove floating IP address to and from your account.

Multiple IPs

You can assign up to three additional IP addresses (four total) to each virtual machine instance. This can be done by selecting a virtual machine instance, clicking on the IP tab, and adding additional IP addresses.

Note that your VM will have multiple internal IPs, each of which map to one external floating IP. For example, your VM may have two IP addresses 192.168.0.5 → 1.2.3.4 and 192.168.0.6 → 4.3.2.1. To accept incoming connections on the different IP addresses, you should configure your applications to listen on one of the internal IP addresses. To connect via a specific floating IP, configure your application to bind the outgoing connection to the corresponding internal IP. The virtual router will handle translation between internal and external IPs automatically.

Configuring software for floating IP addresses

If you have one IP address assigned to your VM, typically special configuration is not needed. The configuration below is generally intended to manage multiple IP addresses assigned to one container.

cPanel

cPanel provides 1:1 NAT support to make it easy to use the panel on cloud infrastructures such as Luna Node Dynamic. See http://releases.cpanel.net/releases/11-40/11-nat-support/ or details on how you should add the IP addresses to cPanel. Note that "public IP address" in the link refers to the floating IP address, while "private IP address" refers to the address configured on the network interface on your VM.

Apache

Suppose that you are assigned two floating IP addresses for two private interfaces:

  • 170.75.160.2 for 172.20.0.2
  • 170.75.160.3 for 172.20.0.3

If you want to run a website on 170.75.160.2, use 172.20.0.2 in the Apache configuration. If you want to run a website on 170.75.160.3, then use 172.20.0.3.