Attach Multi External Interface

Attaching multiple external interfaces to a server helps you:

  • Separate services/traffic by public IP

  • Add interface-level failover options

  • Reduce cost when you don't need multiple servers

This feature is currently supported in both HCM and HAN regions.

Common use case: host 2 websites on 2 different public interfaces (requires 1 server and 2+ available external interfaces).

Kiến trúc mục tiêu:

VM Ubuntu/CentOS ├── eth1 (IP: 103.245.255.167) → website1.com ├── eth2 (IP: 103.245.255.166) → website2.com └── Nginx/Apache phân biệt traffic theo IP

Step 1: Attach multiple external interfaces in the portal UI

  1. Open the server details, go to the Network Interface tab, then attach additional external interfaces.

Step 2: Configure network interfaces

Check current interfaces:

ip addr show

Edit the netplan file (Ubuntu 22.04):

sudo nano /etc/netplan/01-netcfg.yaml

network:
  version: 2
  ethernets:
    eth1:
      addresses:
        - 103.245.255.167/24
      routes:
        - to: default
          via: 103.245.255.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

    eth2:
      addresses:
        - 103.245.255.166/24
      routes:
        - to: 0.0.0.0/0
          via: 103.245.255.1
          table: 200
      routing-policy:
        - from: 103.245.255.166/32
          table: 200

Note: the server may already have a netplan config. To avoid errors when applying the new config, do the following:

a. Disable cloud-init network

Create this file:

sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

Add:

network: {config: disabled}

b. Disable 50-cloud-init.yaml

mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.disabled

Apply and verify:

After applying, if you previously SSH’ed via a floating IP, re-login via an external interface IP (eth1 or eth2).

Step 3: Configure Policy-Based Routing (PBR)

If you already configured routing-policy in netplan (Step 2), you can skip this step. Use this step if you prefer configuring PBR via iproute2.

Step 4: Install a web server (example: Nginx)

Configure Website 1:

Configure Website 2:

Enable the sites:

You can also add SSL/HTTPS (Let’s Encrypt). Make sure your Security Group allows inbound/outbound: tcp/80 (HTTP) and tcp/443 (HTTPS).

Validation checks:

Last updated