Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Virtual Private Cloud/ User Guide/ Elastic Network Interface and Supplementary Network Interface/ Network Interface Configuration Examples/ Binding an EIP to the Extended Network Interface of an ECS to Enable Internet Access

Binding an EIP to the Extended Network Interface of an ECS to Enable Internet Access

Updated on 2025-01-17 GMT+08:00

Scenarios

As shown in Figure 1, the ECS has two network interfaces, one primary network interface and one extended network interface. You can bind an EIP to the extended network interface of the ECS and configure policy-based routes to ensure that the ECS can access the Internet through the EIP.

Figure 1 Accessing the Internet through the EIP bound to the extended network interface
NOTE:

This section uses a Linux ECS as an example.

Step 1: Create Cloud Resources and Attach an Extended Network Interface

  1. Create a VPC and two subnets in the VPC.

    In this example, the primary and extended network interfaces of the ECS are in different subnets.

    For details, see Creating a VPC and Subnet.

  2. Create an ECS in the VPC subnet.

    For details, see Purchasing a Custom ECS.

  3. Create a network interface and attach it to the ECS as an extended network interface.

    When creating a network interface, select a different subnet from where the primary network interface is created. For details, see Creating a Network Interface.

    Attach the network interface to the ECS. For details, see Attaching a Network Interface to a Cloud Server.

  4. Assign an EIP and bind it to the extended network interface of the ECS.

    For details, see Assigning an EIP.

    Bind the EIP to the extended network interface of the ECS. For details, see Binding an EIP to a Network Interface.

Step 2: Obtain the ECS Network Information

Before configuring policy-based routes for the extended network interface, you need to obtain the network information in Table 1.
Table 1 Required ECS network information

Item

Primary Network Interface

Extended Network Interface

Private IP address of the network interface

192.168.11.42

192.168.17.191

Subnet gateway address

192.168.11.1

192.168.17.1

  1. Obtain the private IP addresses of the ECS's network interfaces.
    1. Log in to the management console.
    1. Click in the upper left corner and select the desired region and project.
    1. Click Service List and choose Compute > Elastic Cloud Server.
    2. In the ECS list, locate the target ECS and click its name.

      The Summary tab page of the ECS is displayed.

    3. Click the Network Interfaces tab and view the private IP addresses of the primary and extended network interfaces of the ECS.
  2. Obtain the gateway address of the subnet.
    1. Log in to the management console.
    1. Click in the upper left corner and select the desired region and project.
    1. Click Service List and choose Compute > Elastic Cloud Server.
    2. In the ECS list, locate the target ECS and click its name.

      The Summary tab page of the ECS is displayed.

    1. In the ECS Information area, click the VPC name.

      The Virtual Private Cloud page is displayed.

    2. In the VPC list and click the number in the Subnets column.

      The Subnets page is displayed.

    3. In the subnet list, click the subnet name.

      The Summary page is displayed.

    4. In the Gateway and DNS Information area, view the gateway address of the subnet.
      Figure 2 Viewing the gateway address of the subnet

Step 3: Configure Policy-based Routes for the Extended Network Interface

  1. ECS Remotely log in to the ECS.

    For details, see How Do I Log In to My ECS?

  2. Run the following command to query the route information of the network interface:

    route -n

    The following figure is displayed. In this figure:
    • The destination of the route for the primary network interface is 192.168.11.0/24.
    • The destination of the route for the extended network interface is 192.168.17.0/24.

  3. Run the following command to query the network interface names of the ECS:

    ifconfig

    The following figure is displayed. Search for the network interface name based on the network interface address. In this figure:
    • 192.168.11.42 is the IP address of the primary network interface, and the network interface name is eth0.
    • 192.168.17.191 is the IP address of the extended network interface, and the network interface name is eth1.

  4. Configure the default route for the ECS so that it can access the Internet through the extended network interface.
    1. Run the following command to delete the default route of the primary network interface:

      route del -net 0.0.0.0 gw <subnet-gateway-IP-address> dev <network interface-name>

      The parameters are described as follows:

      • 0.0.0.0: destination IP address, indicating that multiple IP addresses are matched. Do not change the value.
      • Subnet gateway IP address: Enter the subnet gateway address of the primary network interface collected in section Table 1.
      • Network interface name: Enter the name of the primary network interface obtained in 3.

      Example command:

      route del -net 0.0.0.0 gw 192.168.11.1 dev eth0
      NOTE:

      This operation will interrupt ECS traffic.

    2. Run the following command to configure the default route for the extended network interface:

      route add default gw Subnet-gateway-IP-address

      The parameters are described as follows:

      Subnet gateway IP address: Enter the subnet gateway address of the extended network interface collected in section Table 1.

      Example command:

      route add default gw 192.168.17.1

  5. Verify network connectivity.

    Run the following command to check whether the ECS can access the Internet:

    ping Public-IP-address-or-domain-name

    Example command:

    ping support.huaweicloud.com

    If information similar to the following is displayed, the ECS can communicate with the Internet.
    [root@ecs-a01 ~]# ping support.huaweicloud.com
    PING hcdnw.cbg-notzj.c.cdnhwc2.com (203.193.226.103) 56(84) bytes of data.
    64 bytes from 203.193.226.103 (203.193.226.103): icmp_seq=1 ttl=51 time=2.17 ms
    64 bytes from 203.193.226.103 (203.193.226.103): icmp_seq=2 ttl=51 time=2.13 ms
    64 bytes from 203.193.226.103 (203.193.226.103): icmp_seq=3 ttl=51 time=2.10 ms
    64 bytes from 203.193.226.103 (203.193.226.103): icmp_seq=4 ttl=51 time=2.09 ms
    ...
    --- hcdnw.cbg-notzj.c.cdnhwc2.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3004ms
    rtt min/avg/max/mdev = 2.092/2.119/2.165/0.063 ms
    

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback