From 7e1a946f61d92226453f57cf6d38967303f1bc76 Mon Sep 17 00:00:00 2001 From: Lenz Grimmer Date: Sat, 13 Jun 2015 01:08:41 +0200 Subject: [PATCH] use `hostname` for DHCP_HOSTNAME in ifcfg-eth0 Updated centos/fedora/oracle templates to use `hostname` for DHCP_HOSTNAME in /etc/sysconfig/network/ifcfg-eth0, so the container's host name is propagated to the host's DHCP server (e.g. dnsmasq, which also acts as the DNS server). This resolves lxc/lxd#756 Signed-off-by: Lenz Grimmer --- templates/lxc-centos.in | 2 +- templates/lxc-fedora.in | 1 + templates/lxc-oracle.in | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/lxc-centos.in b/templates/lxc-centos.in index 5e1f50be7..946eb5ced 100644 --- a/templates/lxc-centos.in +++ b/templates/lxc-centos.in @@ -253,7 +253,7 @@ HOSTNAME=${UTSNAME} NM_CONTROLLED=no TYPE=Ethernet MTU=${MTU} -DHCP_HOSTNAME=$name +DHCP_HOSTNAME=\`hostname\` EOF # set the hostname diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in index 013546ad9..7faa9398a 100644 --- a/templates/lxc-fedora.in +++ b/templates/lxc-fedora.in @@ -226,6 +226,7 @@ DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes HOSTNAME=${utsname} +DHCP_HOSTNAME=\`hostname\` NM_CONTROLLED=no TYPE=Ethernet MTU=${MTU} diff --git a/templates/lxc-oracle.in b/templates/lxc-oracle.in index 13fad95db..fbd0fd2ea 100644 --- a/templates/lxc-oracle.in +++ b/templates/lxc-oracle.in @@ -336,7 +336,7 @@ DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes HOSTNAME=$name -DHCP_HOSTNAME=$name +DHCP_HOSTNAME=\`hostname\` NM_CONTROLLED=no TYPE=Ethernet EOF