Floating IP addresses
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.
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.
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.
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 → 126.96.36.199 and 192.168.0.6 → 188.8.131.52. 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 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.
Suppose that you are assigned two floating IP addresses for two private interfaces:
- 184.108.40.206 for 172.20.0.2
- 220.127.116.11 for 172.20.0.3
If you want to run a website on 18.104.22.168, use 172.20.0.2 in the Apache configuration. If you want to run a website on 22.214.171.124, then use 172.20.0.3.