Running multiple services that each need their own dedicated IP — separate SSL certificates on legacy clients, multiple mail domains with distinct reverse DNS, or isolating traffic by IP — requires configuring additional IP addresses on a single VPS.
Common Reasons for Multiple IPs
- Hosting multiple websites where each needs a distinct IP for specific compliance or client requirements
- Running multiple mail domains, each needing its own IP with matching reverse DNS/PTR record
- Separating traffic types for monitoring or firewall granularity
Step 1 — Request Additional IPs from Your Hosting Provider
Additional IPs are typically allocated through your VPS provider's control panel or by request — they don't automatically become available without provider-side allocation.
Step 2 — Identify the Additional IP(s) Assigned
Your provider will supply the additional IP address(es), typically along with the same gateway as your primary IP.
Step 3 — Configure the Additional IP via Netplan
sudo nano /etc/netplan/50-cloud-init.yaml
network:
ethernets:
eth0:
addresses:
- 203.0.113.10/24
- 203.0.113.11/24
gateway4: 203.0.113.1
Both addresses are configured on the same physical interface as additional entries.
Step 4 — Apply the Configuration
sudo netplan apply
Step 5 — Verify Both IPs Are Active
ip a show eth0
Binding a Specific Service to a Specific IP
For Nginx, bind different virtual hosts to different IPs:
server {
listen 203.0.113.10:443 ssl;
server_name site1.com;
}
server {
listen 203.0.113.11:443 ssl;
server_name site2.com;
}
Setting Reverse DNS for Each IP (Important for Mail)
Configure the PTR record for each IP through your hosting provider's control panel — particularly critical for mail servers, where mismatched or missing reverse DNS causes major deliverability problems. See Reverse DNS (rDNS) and Its Importance for Email Servers.
Testing Connectivity to Each IP Individually
curl --resolve site1.com:443:203.0.113.10 https://site1.com
curl --resolve site2.com:443:203.0.113.11 https://site2.com
Configuring Outbound Traffic to Use a Specific IP
For applications that need to originate traffic from a specific secondary IP (not just receive on it):
curl --interface 203.0.113.11 https://example.com
Application-specific configuration varies; consult your specific service's documentation for binding outbound connections to a non-primary IP.
Common Errors
Additional IP configured but unreachable — verify the IP was actually allocated to your VPS by the provider (not just configured locally) and that any provider-side network/firewall settings allow it.
Wrong site loads for an IP-bound virtual host — verify the listen directive in each server block correctly specifies the intended IP, not just the port.
Best Practices
- Always configure matching reverse DNS for IPs used for mail sending
- Document which service/purpose each additional IP serves
- Verify with your provider that additional IPs are properly routed to your instance before troubleshooting locally
Related Articles
- Reverse DNS (rDNS) and Its Importance for Email Servers
- How to Configure Static Routes on a Linux VPS
- Nginx Virtual Hosts: Hosting Multiple Websites
