For the complete documentation index, see llms.txt. This page is also available as Markdown.

Attach Multi External Interface vào Server

Tính năng attach multi external interface vào Server nhằm mục đích phân tách services/traffic, failover interface, tiết kiệm chi phí hơn khi không cần phải mua nhiều Server.

Tính năng này hiện đã hỗ trợ trên cả 2 region HCM và HAN.

Hướng dẫn triển khai use case phổ biến: Hosting 2 Website trên 2 Public Interface khác nhau (cần Server, hai hoặc nhiều External Interface available)

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

Bước 1: Attach multi external interface trên UI portal

  1. Truy cập portal vServer (ví dụ HCM): https://hcm-3.console.vngcloud.vn/vserver/overview

  2. Vào detail của Server, chọn tab Network Interface và attach nhiều external interface.

Bước 2: Cấu hình Network Interfaces

Kiểm tra interfaces hiện tại:

ip addr show

Sửa file netplan (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

Lưu ý: Server có thể đã tồn tại file netplan, để đảm bảo apply file netplan mới không lỗi, cần thực hiện thêm các bước sau:

a. Disable cloud-init network

Tạo file:

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

Thêm:

network: {config: disabled}

b. Disable file 50-cloud-init.yaml

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

Apply cấu hình và verify

Sau khi apply, nếu đã login bằng SSH qua floating IP trước đó, cần re-login SSH bằng External interface (ví dụ eth1 hoặc eth2)

Bước 3: Cấu hình Policy-Based Routing

Bước 4: Cài đặt Web Server (ví dụ Nginx)

Cấu hình Website 1:

Cấu hình Website 2:

Enable sites:

Ngoài ra còn có thể cấu hình thêm SSL/HTTPS (Let's Encrypt) và cần mở thêm Security Group rule cho inbound và outbound: tcp/80 (HTTP), tcp/443 (HTTPS).

Kiểm tra:

Last updated