hostnamectl hostname

时间:2021-08-02
本文章向大家介绍hostnamectl hostname,主要包括hostnamectl hostname使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

  

  hostname : 内核变量位置 /proc/sys/kernel/hostname, 启动时,会从 /etc/hostname读取

 

man hostname

 

 

hostname 可获取 fqdn ip domain 还有 nis 等选项

 

设置Linux 的domain的方式,在 /etc/hosts中

 

 

--boot选项 跟没有一样 只设置了 内核 hostname

hostnamectl:

hostnamectl set-hostname 会同时修改 内核 和 /etc/hostname 的主机名 

 

单独设置 transient hostname 没什么用

 

 

设置 pretty-name

 

pretty-name & icon-name are stored  in /etc/machine-info

 

 

 

 

hostname 会被大写字母转为小写字母而且,会把 pretty name重置

 

hostname 可接受纯数字 , 满足 domain name规范

 

icon-name 

https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

 由 systemd提供

machine id : /etc/machine-id

 

boot id:

 

可得到 boot id 从 /proc/sys/kernel/random/boot_id读取, 每次重启都会变化

 

 

 

hostname 并不会与 systemd-hostnamed.service交互

set-location

 

set-deployment

 

set-chassis

 

 

 

原文地址:https://www.cnblogs.com/dissipate/p/15090941.html