How to Use Multiple IPv6 Addresses for Hosting Multiple Websites (Nginx & Apache with Netplan)
A practical, production-ready guide to assigning and managing multiple IPv6 addresses on a single server using Netplan, and serving multiple websites via Nginx or Apache.
IPv6 has fundamentally changed how we approach IP allocation. Instead of working around scarce IPv4 space, you can assign virtually unlimited addresses to a single server. This makes it ideal for hosting multiple websites, isolating services, and improving routing flexibility.
In this guide, we'll walk through configuring multiple IPv6 addresses using Netplan on Ubuntu, then binding them to websites using both Nginx and Apache.
Why Use Multiple IPv6 Addresses?
- Host multiple SSL websites without relying solely on SNI
- Assign unique IPs per customer or application
- Improve email deliverability with separate IP reputation
- Better isolation between services
- Future-proof infrastructure with IPv6-native design
Step 1: Configure Multiple IPv6 Addresses with Netplan
On modern Ubuntu systems, Netplan handles network configuration. You can assign multiple IPv6 addresses directly in your Netplan YAML file.
network:
version: 2
ethernets:
eth0:
dhcp4: no
dhcp6: no
addresses:
- 2001:db8:abcd::1/64
- 2001:db8:abcd::2/64
- 2001:db8:abcd::3/64
gateway6: 2001:db8:abcd::ffff
nameservers:
addresses:
- 2001:4860:4860::8888
- 2001:4860:4860::8844
Apply the configuration:
sudo netplan apply
After applying, verify with:
ip -6 addr show
Step 2: Configure Nginx for Multiple IPv6 Websites
With Nginx, you can bind each site to a specific IPv6 address using the listen directive.
server {
listen [2001:db8:abcd::1]:80;
server_name example1.com;
root /var/www/example1;
}
server {
listen [2001:db8:abcd::2]:80;
server_name example2.com;
root /var/www/example2;
}
Restart Nginx:
sudo systemctl restart nginx
Step 3: Configure Apache Virtual Hosts with IPv6
Apache uses VirtualHost blocks to bind IP addresses to sites.
<VirtualHost [2001:db8:abcd::1]:80>
ServerName example1.com
DocumentRoot /var/www/example1
</VirtualHost>
<VirtualHost [2001:db8:abcd::2]:80>
ServerName example2.com
DocumentRoot /var/www/example2
</VirtualHost>
Restart Apache:
sudo systemctl restart apache2
Best Practices for IPv6 Web Hosting
- Always configure reverse DNS (PTR records) for each IPv6 address
- Use proper firewall rules (UFW or iptables) for IPv6 traffic
- Enable HTTPS with separate certificates where needed
- Monitor traffic per IP for debugging and analytics
- Ensure your DNS provider fully supports AAAA records for proper IPv6 resolution
Final Thoughts
Leveraging multiple IPv6 addresses is one of the simplest ways to scale modern hosting infrastructure without additional cost. Whether you're running a multi-tenant platform, hosting client websites, or building isolated services, IPv6 provides flexibility that IPv4 never could.
Once configured with Netplan, integrating with Nginx or Apache is straightforward-and gives you far more granular control over your network stack.
VPS Servers Starting at £0.99/mo
View Packages