What are the default settings for '/etc/hosts' and '/etc/hostname'?
23,523
They are based on what you specified as the hostname when you installed: in my below examples "myhostname" is the name you chose. The defaults look a bit like this:
/etc/hostname
myhostname
/etc/hosts
127.0.1.1 myhostname
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Related videos on Youtube
Author by
muru
Updated on September 18, 2022Comments
-
muru over 1 year
I'm using Ubuntu 16.04. I recently started learning DevOps and got a bit crazy with my
/etc/hosts
and/etc/hostname
files. In my frantic attempt to spin up a couple of servers from my local machine I lost track of the default settings, and was just curious to know what they are/were.As I recall
/etc/hosts
and/etc/hostname
had only one entry, which was the username of my local machine. However I'm not entirely sure.By any chance does anyone know what the default settings are with a fresh install?
-
josifoski over 5 yearsand myhostname is in /etc/hostname.
-
thomasrutter over 5 yearsThat's what's there is it not?
-
buncis over 2 yearsin 20.04 the
127.0.0.1 localhost
is on first line instead127.0.1.1 myhostname