# Ubuntu – What are the default settings for ‘/etc/hosts’ and ‘/etc/hostname’

16.04etchostnamehosts

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?

• 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