Skip to content

Instantly share code, notes, and snippets.

@ghoneycutt
Created May 2, 2018 21:13
Show Gist options
  • Save ghoneycutt/e531984406b4b86ace687ea8958a6dc3 to your computer and use it in GitHub Desktop.
Save ghoneycutt/e531984406b4b86ace687ea8958a6dc3 to your computer and use it in GitHub Desktop.
default /etc/hosts

macos

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 

el6

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

el7

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

ubuntu1604

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
127.0.1.1	ubuntu-xenial	ubuntu-xenial

ubuntu1404

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

amazon201703

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost6 localhost6.localdomain6

debian7

127.0.0.1	localhost
127.0.1.1	wheezy.raw	wheezy

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

debian8

127.0.0.1	localhost
127.0.1.1	jessie.vagrantup.com	jessie

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

debian9

127.0.0.1	localhost
127.0.1.1	stretch.localdomain	stretch

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
@lzap
Copy link

lzap commented Mar 3, 2020

Oh thanks! Exactly what I needed. :-)

@spirit-q2
Copy link

spirit-q2 commented Sep 15, 2020

Ubuntu 20.04

127.0.0.1  localhost
127.0.1.1  ubuntu-focal # here you should have your hostname

# 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

@oshliaer
Copy link

Ubuntu 20.04 Server

127.0.0.1       localhost.localdomain   big # the second place is your server name
::1             localhost6.localdomain6 localhost6

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

@rubyFeedback
Copy link

Hey guys - could someone briefly explain the entries after the first ::1

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Reason I ask: IPv4 works here but IPv6 on my system. I modified /etc/hosts + use dhcpcd. While
a lot of the internet works, many other things suddenly no longer work. I think this is because I
broke the ip6 part; I am trying to figure out what exactly changed (I actually installed cisco
vpn client which does automagic changes ... but did not tell me about this. So now I have to
run debugging of things that were not announced to me by this cisco clown code ... and me
then trying to do damage mitigation like a blind)

@oshliaer
Copy link

@Erfan-ram
Copy link

Erfan-ram commented Apr 6, 2023

Ubuntu 22.04

127.0.0.1	localhost
127.0.1.1	junior #my hostname


::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment