หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

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/ Bare Metal Server/ FAQs/ OS FAQ/ How Do I Configure the Static Host Name of a BMS?

How Do I Configure the Static Host Name of a BMS?

Updated on 2023-07-10 GMT+08:00

Symptom

The static host name of a Linux BMS is user-defined and injected on the console during the BMS creation. You can use the console or run the hostname command to change the host name of a BMS. However, if you restart the BMS, its host name will be automatically changed to the user-defined one injected on the console.

Automatically Updating the Host Name (Recommended)

Change the host name of the BMS on the console and enable automatic host name synchronization in the BMS OS. In this way, after the BMS is restarted, it automatically synchronizes the host name from the console.

This method has the following restrictions:

  • The host name contains a maximum of 63 characters.
  • Special characters except hyphens (-), underscores (_), and periods (.) are not supported.
  • Uppercase letters are not supported.
  • This method does not apply to Windows BMSs.
  1. Log in to the management console, click Bare Metal Server under Computing.
  2. Click the name of the BMS whose name is to be changed.
  3. On the displayed page, click next to Name, enter a new name that meets the preceding requirements, and click to save the change.
  4. Log in to the BMS OS and run the following command to enable automatic hostname synchronization:

    sed -i 's/auto_synchronize_hostname.*/auto_synchronize_hostname = True/g' `find / -name bms-network-config.conf

    Check that automatic synchronization is enabled.

    cat `find / -name bms-network-config.conf

  5. Log in to the management console again. Locate the row that contains the BMS, click More in the Operation column, and select Restart.

    After about 10 minutes, verify that the BMS is restarted and its hostname is automatically updated.

    NOTE:

    If you set the value of auto_synchronize_hostname in step 4 to False, the host name configured during BMS creation will be retained.

Manually Updating the Host Name

To make the changed host name take effect even after the BMS is stopped or restarted, save the changed name into configuration files.

For example, if the changed host name is new_hostname, perform the following steps:

  1. Modify the /etc/hostname configuration file.
    1. Run the following command to edit the /etc/hostname configuration file:

      sudo vim /etc/hostname

    2. Change the host name to new_hostname.
    3. Run the following command to save and exit the configuration file:

      :wq

  2. (Optional) For Red Hat Enterprise Linux, CentOS, and Fedora 6, modify the configuration file /etc/sysconfig/network.
    1. Run the following command to edit the /etc/sysconfig/network configuration file:

      sudo vim /etc/sysconfig/network

    2. Change the HOSTNAME value to new_hostname.

      HOSTNAME=new_hostname

    3. Run the following command to save and exit the configuration file:

      :wq

  3. Modify the /etc/cloud/cloud.cfg configuration file.
    1. Run the following command to edit the /etc/cloud/cloud.cfg configuration file:

      sudo vim /etc/cloud/cloud.cfg

    2. Use either of the following methods to modify the configuration file:
      • Method 1: Change the preserve_hostname parameter value or add the preserve_hostname parameter to the configuration file.

        If preserve_hostname: false is already available in the /etc/cloud/cloud.cfg configuration file, change it to preserve_hostname: true.

        If preserve_hostname: false is unavailable in the /etc/cloud/cloud.cfg configuration file, add preserve_hostname: true before cloud_init_modules.

      • Method 2: Delete or comment out the following content:

        update_hostname

    3. Run the following command to save and exit the configuration file:

      :wq

  4. Change the BMS network configuration script bms-network-config.conf.

    The value of parameter enable_preserve_hostname in the bms-network-config.conf file is False by default, indicating that the host name is updated each time the board resets. To disable this function, change its value to True.

    1. Change the value of enable_preserve_hostname in the bms-network-config.conf file to True:

      sed -i 's/enable_preserve_hostname.*/enable_preserve_hostname = True/g' `find / -name bms-network-config.conf

  5. (Optional) For SUSE, modify the configuration file /etc/sysconfig/network/dhcp.
    1. Run the following command to edit the /etc/sysconfig/network/dhcp configuration file:

      sudo vim /etc/sysconfig/network/dhcp

    2. Set the value of DHCLIENT_SET_HOSTNAME to no to ensure that DHCP does not automatically allocate host names.

      DHCLIENT_SET_HOSTNAME="no"

    3. Run the following command to save and exit the configuration file:

      :wq

  6. Run the following command to restart the BMS:

    sudo reboot

  7. Run the following command to check whether the static host name is changed:

    sudo hostname

    If the changed host name new_hostname is displayed in the command output, the host name is changed and the new name permanently takes effect.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback