Ask Your Question
0

When changing hostname should I also make changes /etc/hosts?

asked 2014-09-16 09:47:17 -0500

Hello,

Fedora comes with a hostname which is typically also available in /etc/hosts but when you change hostname using hostnamectl set-hostname it changes the hostname but doesn't add it to /etc/hosts. I was wondering if that should be done.

Make it look like following.

$ cat /etc/hostname
localhost.localdomain
$ cat /etc/hosts
127.0.0.1               localhost.localdomain localhost
::1                     localhost6.localdomain6 localhost6

To

$ cat /etc/hostname
fedora
$ cat /etc/hosts
127.0.0.1               fedora localhost
::1                     fedora6 localhost6
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-09-16 10:08:58 -0500

mether gravatar image

hostnamectl does not update /etc/hosts but you can add the name manually there if needed. Usually /etc/hosts is only updated to give aliases to other hosts you connect to and it is not required to be updated just to change the local hostname.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-09-16 09:47:17 -0500

Seen: 1,500 times

Last updated: Sep 16 '14