While a management IP address provides a fixed address for each server, floating IP addresses can be moved from one server to another as needed.
A floating IP address helps handle various services or applications on the same server. This guide will explain how to set up a floating IP address on your server by editing the network interfaces configuration file using “Network Manager”
Some key points to consider:
- This guide applies to VPS, VDS, and Bare Metal servers running Debian OS.
- For Debian 11, VPS/VDS and dedicated servers use “Network Manager”.
- For Debian 12, dedicated servers use “Network Manager”.
- For Debian 12, VPS/VDS servers use “netplan”. For detailed instructions, please refer to this link.
- Ensure you have root access to the server.
Step-by-step instructions
Step 1: Access the Client Portal
- Log in to your client portal.
- Click on the "Network" button at the top of the menu bar (see Fig. 1).
Fig. 1. Accessing the ”Network” section in the client portal.
Step 2: Verify your floating IP address
- In the "Network" section, confirm that a floating IP address is linked to an instance.
- Assign it using the "Attach +" button (see Fig. 2).
Fig. 2. Verify and attach a floating IP address in the client portal.
Step 3: Disable “Cloud-init” for network configuration
If your server contains critical data, it is advisable to configure the floating IP manually. To ensure that your network configuration changes are persistent and not overwritten by “Cloud-init”, disable “Cloud-init’s” network configuration.
- Create a configuration file to disable “Cloud-inits” network configuration (see Fig 3):
$ echo "network: {config: disabled}" | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Fig. 3. Disabling ” Cloud-inits” network configuration.
Step 4: Identify your network interface name
- Use the “ip route” command to find the primary network interface (see Fig. 4):
$ ip route show default
Fig. 4. Finding the main network interface
This command will show the default route, which includes the main network interface (e.g., eth0, bond0).
Step 5: Configure the floating IP address manually
- Edit the network interfaces configuration file:
$ sudo nano /etc/network/interfaces.d/50-cloud-init
- Under the current configuration, add your new floating IP address using the /32 subnet notation (e.g., 93.115.24.186/32). This should be added below your primary IP address (see Fig. 5):
Fig. 5. Editing the configuration file to add the floating IP address. - Save the changes:
- Press Ctrl + X to exit.
- Press Y to confirm you want to save the changes.
- Press Enter to finalize the save.
- Restart the networking service to apply the changes:
$ sudo systemctl restart networking
Step 6: Verify configuration persistence
- Verify your IP addresses (see Fig. 6):
$ ip addr show
Ensure that both your primary and floating IP addresses are listed.
Fig. 6 Verifying IP addresses - Test connectivity:
$ ping -c 5 93.115.24.186
Replace the IP address with your own and check that the floating IP address responds correctly.
Summary
Following these steps, you can successfully set up a floating IP on your Debian server, ensuring it remains persistent through reboots. This process allows for flexible IP management and improves the scalability and reliability of your services. For further information and detailed instructions for Debian 12 VPS/VDS servers using “netplan”, please refer to this link.