M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Recent Posts
Archives
- January 2016 (2)
- October 2014 (2)
- September 2014 (15)
Live and Learn
In CentOS 7, there are three kinds of hostnames defined: static, transient, and pretty. The static hostname is also known as kernel hostname, which is initialized from /etc/hostname automatically at boot time. The transient hostname – a temporary hostname assigned at run time, for example, by a DHCP or mDNS server. Both static and transient hostnames follow the same character restriction rules as Internet domain names. On the other hand, the pretty hostname is allowed to have a free-form (including special/whitespace characters) hostname, presented to end users (e.g., Wenjian’s VPS).
In CentOS 7, there is a command line utility called hostnamectl which allows you to view or modify hostname related configurations.
root@vps-wenjian ~>hostnamectl status
To view static, transient or pretty hostname only, use “–static”, “–transient” or “–pretty” option, respectively.
root@vps-wenjian ~ >hostnamectl set-hostname vps-wenjian
root@vps-wenjian ~ >vim /etc/hosts #127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 127.0.0.1 vps-wenjian ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Recent Comments