View and modify the Host Name of centos7

Source: Internet
Author: User

You can view and modify the Host Name of centos7 in centos7. There are three defined host names:
    • Static hostname)
      • The "static" host name is also called the kernel host name. It is the host name automatically initialized from/etc/hostname at startup.
    • Transient (tansient hostname)
      • The "transient" host name is a temporary host name allocated during system operation, such as through DHCP or mdns server.
    • Flexible (pretty hostname)
      • "Flexible" host names are also called "alias" host names.
        "Flexible" host names are allowed to be displayed to end users (such as [email protected]) in a free form (including special/blank characters).
        Both "static" and "transient" host names follow the same character restriction rules as Internet domain names.
View and modify host names
    • Hostnamectl command line tool that allows you to view or modify host name-related configurations.
    • Run the hostnamectl command to view the host name.
    • Modify host name
      • Temporary valid command: Hostname xh01
    • Valid permanently
// You can change the host name permanently. Hostnamectl set-hostname XXX // Delete hostnamehostnamectl set-hostname "" hostnamectl set-hostname "" -- statichostnamectl set-hostname "" -- pretty
    • You can also manually modify the/etc/hostname file.
    • Configure the/etc/hosts file
 
// Example 127.0.0.1 localhost192.168.126.128 s201192.168.126.129 s202192.168.126.130 s203192.168.126.131 s204 // test the Modification result Ping s201

View and modify the Host Name of centos7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.