From 1bb2bc244affed23d3f36320884496e219caec41 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Thu, 6 Jun 2013 22:28:15 +0200 Subject: [PATCH 1/3] Use 127.0.1.1 for local host name alias Fixes #91 --- boxes/debian/lxc-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boxes/debian/lxc-template b/boxes/debian/lxc-template index 1a9d145..33e9197 100755 --- a/boxes/debian/lxc-template +++ b/boxes/debian/lxc-template @@ -69,7 +69,7 @@ EOF # set the host in case it is not set so that sudo does not complain about the host if ! (grep -q $hostname $rootfs/etc/hosts); then chroot $rootfs sed -i -e \ - "s/^127.0.0.1\(\s\+\)localhost$/127.0.0.1\1localhost\n127.0.0.1\1${hostname}/g" \ + "s/^127.0.0.1\(\s\+\)localhost$/127.0.0.1\1localhost\n127.0.1.1\1${hostname}/g" \ /etc/hosts >/dev/null 2>&1 || true fi From 70f3b90f6f3bc7af86ae639cb566fe021c9be194 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Thu, 6 Jun 2013 22:33:25 +0200 Subject: [PATCH 2/3] Remove sed magic to set /etc/hosts for Debian templates Hosts file is changed according to http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution --- boxes/debian/lxc-template | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/boxes/debian/lxc-template b/boxes/debian/lxc-template index 33e9197..5af9502 100755 --- a/boxes/debian/lxc-template +++ b/boxes/debian/lxc-template @@ -65,13 +65,19 @@ EOF cat < $rootfs/etc/hostname $hostname EOF + # set minimal hosts + cat < $rootfs/etc/hosts +127.0.0.1 localhost +127.0.1.1 $hostname - # set the host in case it is not set so that sudo does not complain about the host - if ! (grep -q $hostname $rootfs/etc/hosts); then - chroot $rootfs sed -i -e \ - "s/^127.0.0.1\(\s\+\)localhost$/127.0.0.1\1localhost\n127.0.1.1\1${hostname}/g" \ - /etc/hosts >/dev/null 2>&1 || true - fi +# 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 +EOF # set default locale cat < $rootfs/etc/locale.gen From 1bef25364aadc39486a5669ce96ca2b49dadf549 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Thu, 6 Jun 2013 22:37:17 +0200 Subject: [PATCH 3/3] Update /etc/hosts for Ubuntu templates Change the Ubuntu hosts file similar to Debian --- boxes/ubuntu/lxc-template | 1 + 1 file changed, 1 insertion(+) diff --git a/boxes/ubuntu/lxc-template b/boxes/ubuntu/lxc-template index 58724f4..da81453 100755 --- a/boxes/ubuntu/lxc-template +++ b/boxes/ubuntu/lxc-template @@ -67,6 +67,7 @@ fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters +ff02::3 ip6-allhosts EOF if [ ! -f $rootfs/etc/init/container-detect.conf ]; then