How to configure a flexible IP on an Elastic Metal server
Learn how to configure a flexible IP address on your Elastic Metal server. The configuration depends on the Linux distribution running on your machine. You can configure your flexible IP on machines running one of Ubuntu Linux, Debian Linux or CentOS.
You may need certain IAM permissions to carry out some actions described on this page. This means:
- you are the Owner of the Scaleway Organization in which the actions will be carried out, or
- you are an IAM user of the Organization, with a policy granting you the necessary permission sets
- You have an account and are logged into the Scaleway console
- You have configured your SSH key
- You have created and installed an Elastic Metal server
- You have attached a flexible IP address to your Elastic Metal server
You can find information about the DNS resolver to use in each datacenter at the network reference documentation.
How to configure a flexible IP on Ubuntu Linux
Since the LTS release of Ubuntu Version 18.04 (Bionic Beaver) the recommended way to configure a flexible IP is by using Netplan. If you prefer a more traditional configuration, refer to the instructions for flexible IP configuration on Debian.
-
Log into your server using SSH with a user having super-user rights.
-
Open the file
/etc/netplan/01-netcfg.yaml
with superuser rights in your favorite text editor and configure the networking for your machine.Note:IP addresses in the configuration file have to be specified in CIDR notation. The netmask is
/24
for the principal IP of the server and/32
for each flexible IP.Your configuration file should look like the following example:
network:version: 2renderer: networkdethernets:enp1s0f0:addresses: [163.172.123.123/24, 212.83.123.123/32]gateway4: 163.172.123.1nameservers:addresses: [ "62.210.16.6", "62.210.16.7" ]Tip:The interface name for your primary interface may be different from
enp1s0f0
. You can use theip link show
command to determine the name of your public Internet interface. -
Once the file is edited as required, save it and quit the text editor. Then apply the configuration using the following command:
sudo netplan apply
Your server now responds on both the primary IP address and the flexible IP address.
How to configure a flexible IP on Debian Linux
-
Log into your server using SSH with a user having super-user rights.
-
Open the file
/etc/network/interfaces
with superuser rights in your favorite text editor and configure the networking for your machine. -
Edit the file and add the flexible IP as shown in the following example:
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0iface eth0 inet staticaddress 195.154.123.123netmask 255.255.255.0gateway 195.154.123.1auto eth0:0iface eth0:0 inet staticaddress ip_flexiblenetmask 255.255.255.255Note:The interface name of your server might be different depending on the hardware of the server. You can use the
ip link show
command to determine the name of your public Internet interface. -
Save the file and quit the editor.
-
Bring the interface up using the
ifup
command:ifup eth0:0
Your server now responds on both the primary IP address and the flexible IP address.
How to configure a flexible IP on CentOS
- Log into your server using SSH using the
root
user. - Copy the default network configuration file to create an alias:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
- Open the file
/etc/sysconfig/network-scripts/ifcfg-eth0:0
in your favorite text editor and modify it as in the following example:DEVICE="eth0:0"BOOTPROTO=staticIPADDR="my_flexible_ip"NETMASK="255.255.255.255"ONBOOT=yes - Save the file, exit the text editor and run the following command to reload the network configuration:
/etc/init.d/network restart
Your server now responds on both the primary IP address and the flexible IP address.
How to configure a flexible IP in a virtual machine (VM)
When you install your Elastic Metal server with a virtualization solution like VMware vSphere Hypervisor (ESXi) or Proxmox you can create multiple virtual machines on the physical server.
To communicate on the Internet each of your virtual machines needs an IP address. You can use flexible IPs to have additional IP addresses available for your virtual machines.
Configure the networking of your VM’s as follows:
- IP address: Your flexible IP
- Netmask:
255.255.255.255
- Gateway:
62.210.0.1
- DNS resolver:
62.210.16.6
and62.210.16.7
The gateway of all flexible IPs is 62.210.0.1
. This allows you to move your VMs between your hypervisors without changing the network configuration of the virtual machine.