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.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- An SSH key
- An installed Elastic Metal server
- A flexible IP address attached to your Elastic Metal server
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.Your configuration file should look like the following example:
network: version: 2 renderer: networkd ethernets: enp1s0f0: addresses: [163.172.123.123/24, 212.83.123.123/32] gateway4: 163.172.123.1 nameservers: addresses: [ "51.159.47.28", "51.159.47.26" ] # Replace the IP of the DNS cache server with the one located in the same physical location as your machine for optimal performances (https://www.scaleway.com/en/docs/account/reference-content/scaleway-network-information/#dns-cache-servers)
-
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 interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 195.154.123.123 netmask 255.255.255.0 gateway 195.154.123.1 auto eth0:0 iface eth0:0 inet static address ip_flexible netmask 255.255.255.255
-
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=static IPADDR="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:
51.159.47.28
and51.159.47.26