How to Configure Multiple IP Addresses on One VPS

Some setups need more than one IP address on a single server: several mail domains that each need their own reverse DNS, sites that must sit on separate addresses for a client or compliance reason, or traffic you want to separate for firewalling and monitoring. This guide covers getting the extra addresses, adding them in Linux, binding services to them and setting reverse DNS.

Step 1 — Get the Additional Addresses Allocated

An address only works once it has been routed to your server by the host; configuring it in Linux on its own does nothing. On VPS For Life, every plan includes one dedicated IPv4 address, and more can be added — the per-range limits and current prices are on the multiple IPv4 page and the order form. If you need many addresses, IPv6 addresses are a far cheaper way to add them.

Once they are allocated you will have each new address with its prefix length and gateway. Keep them to hand for the steps below.

Step 2 — Find Your Interface Name

ip -br addr

Note the interface that carries your main public address — often eth0, ens3 or enp1s0. Use that name below.

Step 3a — Ubuntu and Debian with Netplan

Netplan files live in /etc/netplan/. Edit the existing one (keep a copy first):

sudo cp /etc/netplan/50-cloud-init.yaml /root/netplan-backup.yaml
sudo nano /etc/netplan/50-cloud-init.yaml
network:
  version: 2
  ethernets:
    eth0:
      addresses:
        - 203.0.113.10/24
        - 203.0.113.11/24
      routes:
        - to: default
          via: 203.0.113.1
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]

Use the prefix length (/24, /32 and so on) you were given for each address. Recent Netplan versions use routes: rather than the older gateway4:, which now prints a deprecation warning.

Test before you apply, so a mistake does not lock you out:

sudo netplan try

netplan try rolls the change back automatically after 120 seconds unless you confirm it. If it works, press Enter to keep it.

Step 3b — AlmaLinux and Rocky Linux with NetworkManager

nmcli con show
sudo nmcli con mod "System eth0" +ipv4.addresses 203.0.113.11/24
sudo nmcli con up "System eth0"

Replace System eth0 with the connection name from the first command.

Step 3c — Debian with /etc/network/interfaces

auto eth0
iface eth0 inet static
    address 203.0.113.10/24
    gateway 203.0.113.1

iface eth0 inet static
    address 203.0.113.11/24
sudo systemctl restart networking

Step 4 — Verify

ip -br addr show eth0
ping -c 3 -I 203.0.113.11 1.1.1.1

Both addresses should be listed, and the ping should succeed from the new address.

Binding a Website to a Specific Address

server {
    listen 203.0.113.10:443 ssl;
    server_name site1.example;
}

server {
    listen 203.0.113.11:443 ssl;
    server_name site2.example;
}

Test each one directly:

curl --resolve site1.example:443:203.0.113.10 https://site1.example
curl --resolve site2.example:443:203.0.113.11 https://site2.example

Sending Mail From a Specific Address

For mail, the address a message leaves from is what receiving servers judge, so each sending address needs its own reverse DNS. In Postfix you can choose the outgoing address with smtp_bind_address, or per transport in master.cf when different domains should use different addresses. Each address also needs to be listed in the SPF record of the domain that sends from it.

Reverse DNS for Each Address

Set a PTR record for every address you send mail from, matching the hostname the mail server announces. Request it by ticket, one per address; see rDNS VPS for the exact steps and how to verify it, or check an address with the PTR lookup tool.

Common Problems

The new address does not respond — confirm the address has actually been allocated to your server, that the prefix length is right, and that your firewall accepts traffic on it.

Locked out after applying — this is what netplan try prevents. If it happens anyway, open a ticket and we will help you get back in to restore the backup file.

The wrong site answers on an address — check that each listen line names the address, not only the port.

Mail rejected from the second address — it usually lacks reverse DNS or an SPF entry. Check it with the SPF, DKIM and DMARC checker.

Continue Reading

Browse more articles in Advanced Networking & VPN.

  • multiple ip addresses, additional vps ip, netplan multiple ip, ip binding services
  • 35 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a VPN Server with WireGuard

WireGuard is a modern, fast, and simple VPN protocol — significantly easier to configure...

How to Set Up an OpenVPN Server on a VPS

OpenVPN is a mature, widely-supported VPN protocol — a solid choice when you need broad...

How to Configure a VPS as a Forward Proxy with Squid

A forward proxy routes outbound requests through your VPS, useful for accessing geo-restricted...

How to Set Up IPv6 on Your VPS

IPv6 adoption continues to grow, and many VPS providers now offer IPv6 addresses alongside IPv4....

How to Bond Multiple Network Interfaces for Redundancy

Network interface bonding combines multiple physical/virtual network interfaces into a single...