How to Configure Multiple Network Interfaces on a VPS

Some VPS configurations include multiple network interfaces — for example, a public-facing interface and a private network interface. This guide covers configuring and using them correctly.

Common Reasons for Multiple Interfaces

  • Separating public internet traffic from private inter-server communication
  • Dedicated interfaces for specific traffic types (management vs application traffic)
  • Provider-specific private networking features (see How to Set Up a Private Network Between Multiple VPS Instances)

Viewing Current Network Interfaces

ip addr show

Lists all network interfaces and their assigned IP addresses — identify which is your public-facing interface (typically eth0) and which might be a private/secondary interface.

Configuring a Second Interface (Netplan, Ubuntu 20.04+)

sudo nano /etc/netplan/50-cloud-init.yaml
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true
    eth1:
      addresses:
        - 10.0.0.5/24
      dhcp4: false
sudo netplan apply

Understanding Routing with Multiple Interfaces

ip route show

With multiple interfaces, understand which one is used as the default route (for general internet traffic) versus specific routes for private network traffic — misconfigured routing can cause traffic to go out the wrong interface.

Binding a Specific Service to a Specific Interface

# Example: bind Nginx to listen only on the private interface
listen 10.0.0.5:80;

Useful for ensuring internal-only services (database connections, internal APIs) are only reachable via the private interface, not accidentally exposed on the public one.

Firewall Rules Per Interface

sudo ufw allow in on eth1 to any port 5432

Restrict specific rules to apply only on a specific interface — letting you have different, appropriate security postures for public vs private-facing traffic.

Checking Which Interface Handles a Specific Connection

ss -tulnp

Shows which interfaces/addresses each listening service is actually bound to, useful for verifying your configuration matches your intent.

Common Use Case: Database on Private Interface Only

# PostgreSQL example
listen_addresses = '10.0.0.5'

Configuring a database to listen only on the private interface ensures it's reachable from other servers on your private network but never directly from the public internet — a meaningful security improvement over binding to all interfaces.

Common Errors

Service unreachable after binding to a specific interface — verify you're connecting from a client that can actually reach that specific interface (e.g. another server on the same private network), not attempting to reach a private-interface-only service from the public internet.

Netplan configuration doesn't apply correctly — check YAML syntax carefully (indentation matters significantly); use sudo netplan try to test changes safely with automatic rollback if connectivity breaks.

Continue Reading

Browse more articles in Networking & DNS.

  • multiple network interfaces, netplan configuration, private and public interface vps, bind service to interface
  • 0 Корисниците го најдоа ова како корисно
Дали Ви помогна овој одговор?

Понудени резултати

DNS Fundamentals: A, AAAA, CNAME, MX, TXT & NS Records Explained

DNS translates human-readable domain names into the information servers actually need — IP...

How to Point a Domain to Your VPS (A/AAAA Records)

Before your website is reachable at yourdomain.com instead of a raw IP address, you need to...

How to Configure MX Records for Email Delivery

MX (Mail Exchange) records tell the internet which servers handle incoming email for your domain....

How to Use CNAME Records Correctly

CNAME records let you alias one domain name to another, but they come with important restrictions...

How to Configure a Static IP on a Linux VPS

Most VPS providers assign a static (unchanging) IP address by default, but understanding how...