RHEL7--Modify host name

Source: Internet
Author: User

RHEL7, there are three kinds of defined hostname:

A, static: the "static" hostname, also known as the kernel hostname, is the host name that the system automatically initializes from/etc/hostname at startup

b, transient (transient): the "transient" hostname is a host name that is temporarily assigned while the system is running, managed by the kernel, for example, by a DHCP or MDNs server, such as localhost

C, Flexible (pretty): "Flexible" hostname is the UTF8 format of the free host name, to show to the end user

1. Use Nmtui to modify the host name

# Nmtui

After modifying the static hostname (/etc/hostname file) with the Nmtui interface of NetworkManager, Hostnamectl is not notified. To force Hostnamectl to know that the static hostname has been modified, you need to restart the hostnamed service

# systemctl Restart Systemd-hostnamed

2. Use Hostnamectl to modify the host name

#查看主机名

# hostnamectl Status   Static hostname:yb.example.com   ...

#设置新的主机名

Set-hostname test.example.com

#查看主机名

# hostnamectl Status   Static hostname:test.example.com   ...

3. NetworkManager command Line Interface nmcli Modify host name
NMCLI can modify the static host name in the/etc/hostname

#查看主机名

[Email protected] ~]# NMCLI General hostnametest.example.com

#设置新的主机名

[Email protected] ~~]# nmcli General Hostnamemytest

#重启hostnamed服务让hostnamectl知道静态主机名已经被修改

[Email protected] ~]# systemctl restart systemd-hostnamed

RHEL7--Modify host name

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.