Configuring Floating IPs as the source of outbound traffic
A Floating IP is a publicly accessible IP address that can be assigned to a Dedicated Server and then reassigned to another Dedicated Server as needed.
It can be used to send outbound traffic or to implement a failover mechanism. This guide approaches the outbound traffic use case.
By default, when you assign a Floating IP to a Dedicated Server, the traffic originating from the server to the Internet does not use the Floating IP as the source address. In Linux, your default gateway typically uses the first IP address of the public network interface.
This guide describes how to reconfigure your operating system to use the Floating IP as the source address for outbound traffic across several common operating systems.
Step 1: Check the current Outbound IP
First, check which IP is currently used as the source for outbound traffic. You can use a service like ifconfig.co:
$ curl -4 ifconfig.co 212.32.230.67
In this example, 212.32.230.67 is the public IP of the Dedicated Server. Your goal is to change this to your Floating IP.
Step 2: Identify the Public Interface
Before you begin, you must identify the name of your server’s public network interface (Example: eno0, enp2s0, eth0).
On Linux
Use the ip a command and find the interface with your main public IP:
# ip a
On FreeBSD
Use ifconfig:
# ifconfig
On Windows
Use Get-NetAdapter in PowerShell.
You will need this interface name (<interface-name>) and your server’s main public IP (<main-ip>), gateway (<gateway>) and new (<floating-ip>) for the following steps.
Step 3: Add the Floating IP, configure routing and announce
Follow the instructions for your specific operating system below.
Ubuntu 24.04
Ubuntu 24.04
- Add IP and Configure Route
- Method: Netplan (
/etc/netplan/) - File:
/etc/netplan/01-netcfg.yaml - Content:
network: version: 2 renderer: networkd ethernets: <interface-name>: dhcp4: no addresses: - <main-ip>/<prefix> - <floating-ip>/32 routes: - to: default via: <gateway> from: <floating-ip> metric: 100 on-link: true # ... (nameservers etc.)
- Apply:
# netplan apply
- Method: Netplan (
- Announce IP (Send GARP)
- Install arping:
# apt update # apt install iputils-arping
- Send GARP:
# arping -c 3 -A -I <interface-name> <floating-ip>
- Install arping:
Debian 11, 12, 13 / Proxmox VE 8, 9
Debian 11, 12, 13 / Proxmox VE 8, 9
- Add IP and configure route
- Method: ifupdown (
/etc/network/interfaces). - File:
/etc/network/interfaces - Content:
# ... (existing config for <interface-name>) auto <interface-name> iface <interface-name> inet static address <main-ip> netmask <netmask> gateway <gateway> # Add this new block auto <interface-name>:1 iface <interface-name>:1 inet static address <floating-ip> netmask 255.255.255.255 up ip route replace default via <gateway> dev <interface-name> src <floating-ip>
- Apply:
# systemctl restart networking
- Method: ifupdown (
- Announce IP (Send GARP)
- Install arping:
# apt update # apt install iputils-arping
- Send GARP:
# arping -c 3 -A -I <interface-name> <floating-ip>
- Install arping:
AlmaLinux 8, 9, 10 / Rocky Linux 8, 9, 10
AlmaLinux 8, 9, 10 / Rocky Linux 8, 9, 10
- Add IP & Configure Route
- Method: NetworkManager (nmcli).
Replace<conn-name>with your connection name (fromnmcli con show). - Add IP:
# nmcli con mod "<conn-name>" +ipv4.addresses <floating-ip>/32
- Add routing:
# nmcli con mod "<conn-name>" +ipv4.routing-rules "from <floating-ip> table 100" # nmcli con mod "<conn-name>" +ipv4.routes "0.0.0.0/0 <gateway> table=100"
- Apply:
# nmcli con up "<conn-name>"
- Method: NetworkManager (nmcli).
- Announce IP (Send GARP)
- Install iputils:
# dnf install iputils
- Send GARP:
# arping -c 3 -A -I <interface-name> <floating-ip>
- Install iputils:
FreeBSD 13.5, 14.4
FreeBSD 13.5, 14.4
- Add IP and configure route
- Method: PF (Packet Filter) NAT.
Edit config file:
File:/etc/rc.conf# ... (your existing network config) ifconfig_<interface-name>_alias0="inet <floating-ip>/32" pf_enable="YES"
- Create PF rule:
File:/etc/pf.confnat on <interface-name> from <main-ip> to any -> <floating-ip>
- Apply:
# service netif restart && service pf start
- Method: PF (Packet Filter) NAT.
- Announce IP (Send GARP)
- Install arpsend:
# pkg install arpsend
- Send GARP:
# arpsend -c 3 -D -i <interface-name> <floating-ip>
- Install arpsend:
Windows Server 2022
Windows Server 2022
- Add IP and configure the route
- Method: PowerShell (as Administrator).
- Add Floating IP:
PS> New-NetIPAddress -InterfaceAlias "<interface-name>" -IPAddress <floating-ip> -PrefixLength 32
- Set Main IP to not be a source:
PS> Set-NetIPAddress -IPAddress <main-ip> -SkipAsSource $true
- Announce IP (Send GARP)
- Windows sends a GARP automatically. To manually refresh, you can ping the gateway:
PS> ping <gateway>
- Windows sends a GARP automatically. To manually refresh, you can ping the gateway:
VMware ESXi 8.0
VMware ESXi 8.0
- Add IP and configure the route
- This configuration is not performed on the ESXi hypervisor. The Floating IP must be assigned to a Virtual Machine (VM).
- Log in to the guest OS (Ubuntu, AlmaLinux, or Windows) running on that VM and follow the instructions specific to that operating system from this guide.
- Announce IP (Send GARP)
- This step is performed within the Guest OS after it is configured (see the Guest OS instructions in this guide).
Step 4: Check if the IP was added successfully
After applying the configuration, verify that the new IP is attached to the interface.
On Linux:
Use the ip a command again:
# ip a show <interface-name> ... inet <main-ip>/<prefix> ... scope global <interface-name> valid_lft forever preferred_lft forever inet <floating-ip>/32 ... scope global <interface-name> valid_lft forever preferred_lft forever ...
On Windows Server:
Use PowerShell:
PS> Get-NetIPAddress -InterfaceAlias "<interface-name>"
You should see both the <main-ip> and the <floating-ip> listed.
Step 5: Check if the Floating IP is the new Outbound IP
Run the same command from Step 1. The output should now show your Floating IP:
# curl -4 ifconfig.co <floating-ip>
If it shows your floating IP, the configuration is complete and successful.
Back to the top ↑