How to deal with private, public and flexible IP addresses

Overview

This tutorial shows you how to deal with private, public and flexible IP addresses.

When you create an instance, it will get the following by default:

  • A public IP address (which is also a flexible IP)
  • A private IP address

We’ll explain to you what the difference between these IP addresses is, and what you can do with them.

Requirements

Core Concepts

Public IP addresses are routed on the Internet. You can enter the public IP address of your instance into any browser connected to the Internet, and access content being served from that instance. You can think of public IP addresses like postal addresses for buildings - they are unique, and tell the routers directing traffic through the Internet where to find a particular server.

Private IP addresses are not routed on the Internet. If you enter the private IP address of your instance into a random browser connected to the internet, it won’t connect to anything. This is because a private IP address is only relevant within a particular local network. Instances within a local network can communicate between themselves via their private IP addresses.

Flexible IP addresses are public IP addresses which you can hold independently of any instance. When you create a Scaleway instance, its public IP address is also a flexible IP address. Flexible IP addresses can be attached to and detached from any of your instances as you wish. You can keep a number of flexible IP addresses in your account at any given time. When you delete a flexible IP address, it is disassociated from your account to be used by other users.

Exploiting public, private and flexible IP addresses

How can you deal with these different types of IP address to your best advantage? Here are some ideas:

  • You can choose to remove your instance’s public IP. This feature gives you a lot of control, especially if you want to put your instances into a private network so that they can communicate between themselves without being exposed to the Internet. This is particularly useful for instances hosting databases, backups or sensitive content. It also allows you to optimize your costs and to fight the global IPv4 shortage.

  • You can set up a private network between your Scaleway instances, and configure each instance on the private network to have its own private IP address. Remember, this won’t be the same private IP address that is displayed on the overview screen for your instance, as that private IP is relevant only to the Scaleway local network and not on any specific private networks you create. See our Private Networks documentation to learn how to set up a private network and configure private IP addresses. You can also learn more about Private Networks with this blog post.

  • You can use flexible IP addresses to do live migration of IP addresses between your instances. Be aware that attaching a new flexible IP address to an instance will remove the previous public IP of the instance and cut any ongoing public connection to the instance.

The next steps of this tutorial will show you how to detach, create, attach and release flexible IP addresses.

Detach a public IP address from an instance

In the overview of your instance’s information, click detach next to Public IP:

Alternatively, in the Instances section of the management console, click on the Flexible IPs tab. A list of your Flexible IP addresses and their associated instances displays. Click on next to the instance whose IP you want to detach, and select Detach:

Create a new flexible IP address and attach it to an instance

1 . In the Instances section of the management console, click on the Flexible IPs tab, then click on + Create a flexible IP:

Note: if you already have a flexible IP, instead of the Create a flexible IP button you will see a small green button with a + symbol. Click on this to create another flexible IP

2 . Select your choice of availability zone for the flexible IP (the geographical region where it will be located). Choose the instance you would like to link to this flexible IP. Then click “create a flexible IP”.

Note: An instance must have already been detached from any existing public IP before it can be linked to a new flexible IP.

Your flexible IP address is created and linked to the instance you specified.

Attach an existing flexible IP address to an instance

1 . In the Instances section of the management console, click on the Flexible IPs tab. A list of your flexible IPs displays:

2 . Click on next to the IP that you want to attach to an instance. In the drop down menu click on Select another instance.

3 . Confirm the IP that you want to attach to this flexible IP in the pop-up window.

Note: An instance must have already been detached from any existing public IP before it can be attached to a new flexible IP.

Release a flexible IP address

1 . In the Instances section of the management console, click on the Flexible IPs tab. A list of your flexible IPs displays:

2 . Click on next to the flexible IP that you want to delete. In the drop down menu click on Delete.

3 . Confirm the deletion of the flexible IP in the pop-up window.

Discover the Cloud That Makes Sense