Recently I have installed Fedora 33-workstation on my machine. The first thing I was noticed was about hostname in the terminal. It is shown as myname@dhcppc2
. I was wondering why dhcppc2
? After running hostnamectl status | grep hostname
, I figured out that my system is using transient hostname, as the output was:
Static hostname: localhost.localdomain
Transient hostname: dhcppc2
Based on my prior experiences, I used to see static hostname in the terminal. Also I thought that systemd
determines the hostname if /etc/hostname
is unavailable, but in my system running cat /etc/hostname
shows localhost.localdomain
.
Would you please let me know that why my system is using transient hostname and how can I use static hostname rather than the transient one?
答案1
Disable DHCP for changing your hostname ; append the above to dhcpcd.conf:
nohook hostname
Then set a permanent hostname entry :
hostnamectl set-hostname --static "<hostname>"