9

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? Thanks

12

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
  • and myhostname is in /etc/hostname. – josifoski Sep 26 '18 at 10:58
  • That's what's there is it not? – thomasrutter Sep 27 '18 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.