Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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
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

Configuring DHCP

Updated on 2024-10-31 GMT+08:00

Scenarios

If a private image is created from an ECS or external image file and the VM where the ECS or external image file is located is configured with a static IP address, you need to configure DHCP so that the new ECSs created from the private image can dynamically obtain an IP address.

The configuration method varies depending on OSs.

NOTE:

When registering an external image file as a private image, configure DHCP on the VM where the external image file is located. You are advised to configure DHCP on the VM and then export the image file.

Prerequisites

You have logged in to the ECS used to create a Windows private image.

For details about how to log in to an ECS, see Elastic Cloud Server User Guide.

Ubuntu 18 or Later

  1. Run vi /etc/netplan/01-netcfg.yaml on the ECS to open the /etc/netplan/01-netcfg.yaml file, and check whether the value of dhcp4 is true.
    • If dhcp4 is set to true, enter :q to exit the editor. No further action will be required.
       network:
          version:2
          renderer:NetworkManager
          ethernets:
              eth0:
                  dhcp4: true
    • If dhcp4 is set to no and a static IP address is configured, go to the next step.
      network:
          version:2
          renderer:NetworkManager
          ethernets:
              eth0:
                  dhcp4: no
                 addresses: [192.168.1.109/24]
                 gateway4: 192.168.1.1
                 nameservers:
                    addresses: [8.8.8.8,114.114.114.114]
  2. Press i to enter the editing mode.

    Delete the static IP address settings and set dhcp4 to true. You can also use a number sign (#) to comment out the static IP address settings.

    network:
        version:2
        renderer:NetworkManager
        ethernets:
            eth0:
              dhcp4: true   # Set dhcp4 to true.
              #dhcp4: no    # Delete or comment out the static IP address settings.
              #addresses: [192.168.1.109]
              #gateway4: 192.168.1.1
              #nameservers:
              # addresses: [8.8.8.8,114.114.114.114]
  3. If your ECS has more than one NIC, configure DHCP for all of them.
    network:
        version:2
        renderer:NetworkManager
        ethernets:
             eth0:
                dhcp4: true
             eth1:
                 dhcp4: true
             eth2:
                 dhcp4: true
             eth3:
                 dhcp4: true
  4. Press Esc, enter :wq, and press Enter to save the settings and exit the vi editor.
  5. Run the netplan apply command to make the settings take effect.

Ubuntu 16.04

  1. Run the following command on the ECS to open the /etc/network/interfaces file:

    vi /etc/network/interfaces

    • If DHCP has been configured for all NICs, enter :q to exit the vi editor.
      auto lo
      iface lo inet loopback
      auto eth0
      iface eth0 inet dhcp
      
      auto eth1
      iface eth1 inet dhcp
    • If static IP addresses are set on the NICs, go to 2.
      auto lo
      iface lo inet loopback
      auto eth0
      #iface eth0 inet dhcp
      iface eth0 inet static
      address 192.168.1.109
      netmask 255.255.255.0
      gateway 192.168.1.1
  2. Press i to enter the editing mode.
  3. Delete the static IP address settings and configure DHCP for the NICs.

    You can also use a number sign (#) to comment out the static IP address settings.

    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet dhcp

    If the ECS has multiple NICs, you must configure DHCP for all the NICs.

    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet dhcp
    auto eth1
    iface eth1 inet dhcp
  4. Press Esc, enter :wq, and press Enter.

    The system saves the settings and exits the vi editor.

Related Operations

Configure DHCP to enable the ECS to obtain IP addresses continuously.

  • For CentOS and EulerOS, use the vi editor to add PERSISTENT_DHCLIENT="y" to configuration file /etc/sysconfig/network-scripts/ifcfg-ethX.
  • For SUSE Linux Enterprise, use the vi editor to set DHCLIENT_USE_LAST_LEASE to no in the configuration file /etc/sysconfig/network/dhcp.
  • For Ubuntu 12.04 or later, upgrade dhclient to ISC dhclient 4.2.4 so that the NIC can consistently obtain IP addresses from the DHCP server. To perform the upgrade, you need to install isc-dhcp-server first.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback