On 19-Aug-2013, at 5:32 PM, Gaspare A Silvestri <g.silves...@netsons.com> wrote:

> Hi Shanker,
>
> thank you for your answer.
>
> Which way have we to use the indicated hook? Within the  same password 
> script, or as external script to execute at the machine startup?

On a fresh default Debian Guest VM, "vi 
/etc/dhcp/dhclient-exit-hooks.d/hostname" with the following contents:

vi /etc/dhcp/dhclient-exit-hooks.d/hostname
<start-cut-here>
#!/bin/sh
#
# Update hostname from DHCP
#
if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] && [ "$reason" != REBIND ] 
&& [ "$reason" != REBOOT ]; then
    return
fi

hostname $new_host_name
echo $new_host_name > /etc/hostname
<end-cut-here>

These changes are unrelated to any other scripts you might have.

Hth.
@shankerbalan

>
> Thanks in advance,
>
> Gaspare
>
> On 19/08/2013 12:42, Shanker Balan wrote:
>> On 09-Aug-2013, at 9:42 AM, Prasanna Santhanam <t...@apache.org> wrote:
>>
>>> FWIW, the debian image of our system VM is Debian 7 and uses the dhcp
>>> client from:
>>>
>>> deb http://http.us.debian.org/debian wheezy-backports main
>>> apt-get install dhcp3-client
>>>
>>> Can you try that and see if it works?
>>
>> Another FWIW: I just looked back at my scripts and I seem to creating a DHCP 
>> exit hook as below on Debian templates.
>>
>> $ cat /etc/dhcp/dhclient-exit-hooks.d/hostname
>> #!/bin/sh
>> #
>> # Update hostname from DHCP
>> #
>> if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] && [ "$reason" != REBIND 
>> ] && [ "$reason" != REBOOT ]; then
>>     return
>> fi
>>
>> hostname $new_host_name
>> echo $new_host_name > /etc/hostname
>>
>>
>>> On Thu, Aug 08, 2013 at 09:52:07PM +0000, Musayev, Ilya wrote:
>>>> Perhaps, make sure you don't set the hostname in your template anywhere in 
>>>> the config and use dhcp provided hostname instead?
>>>>
>>>> From: Netsons > Roberto Iervolino [mailto:r.iervol...@netsons.com]
>>>> Sent: Thursday, August 08, 2013 3:10 AM
>>>> To: users@cloudstack.apache.org
>>>> Subject: Re: Debian 7 does not get hostname from dhcp.
>>>>
>>>> There is a way to solve this known issue?
>>>>
>>>> Thanks.
>>>>
>>>> [cid:image001.png@01CE945F.FFAC77E0]
>>>>
>>>> Supernova s.r.l.
>>>> Via G. Misiticoni, 3
>>>> 65126 - Pescara
>>>> ITALY
>>>>
>>>>
>>>> www.netsons.com<http://www.netsons.com>
>>>>
>>>> Roberto Iervolino
>>>> IT System Administrator - L2 Support
>>>>
>>>>
>>>> t. (+39) 085 45 100 52
>>>> m. (+39) 393 85 677 48
>>>> e. r.iervol...@netsons.com<mailto:r.iervol...@netsons.com>
>>>>
>>>>
>>>> [View Roberto Iervolino's profile on 
>>>> LinkedIn]<http://it.linkedin.com/pub/roberto-iervolino/70/b81/3aa>
>>>>
>>>>
>>>>
>>>> Netsons? ? un marchio registrato dalla Supernova s.r.l.
>>>> Le informazioni trasmesse sono riservate alla persona o alla societ? 
>>>> indicata come destinatario, e possono includere contenuti considerati 
>>>> confidenziali. Ogni elaborazione, comunicazione, trasmissione o altro 
>>>> utilizzo, anche azioni conseguenti alla conoscenza di queste informazioni 
>>>> da parte di chiunque non sia espressamente indicato come destinatario ? 
>>>> proibita. Nel caso abbiate ricevuto per errore questa comunicazione, siete 
>>>> pregati di darne avviso a info [at] netsons.com ed eliminare ogni stampa 
>>>> ed ogni traccia informatica. Il ricevente dovr? inoltre accertarsi che gli 
>>>> eventuali allegati non contengano virus prima di aprirli. Qualunque 
>>>> opinione o affermazione presentata in questo messaggio ? da ritenersi 
>>>> propria dell'autore e non rappresenta necessariamente la posizione della 
>>>> Societ?.
>>>>
>>>> The information transmitted is intended only for the person or entity to 
>>>> which it is addressed and may contain confidential material. Any review, 
>>>> retransmission, dissemination or other use of, or taking of any action in 
>>>> reliance upon this information by persons or entities other than the 
>>>> intended recipient is prohibited. If you received this in error, please 
>>>> contact: info [at] netsons.com and delete the material from any computer. 
>>>> If this email contains attachments you should ensure they are checked for 
>>>> viruses before opening them. Any views or opinions presented are solely 
>>>> those of the author and do not necessarily represent those of the company.
>>>> Il 08/08/2013 00:14, David Nalley ha scritto:
>>>>
>>>> On Wed, Aug 7, 2013 at 12:36 PM, Netsons > Roberto Iervolino <
>>>>
>>>> r.iervol...@netsons.com<mailto:r.iervol...@netsons.com>> wrote:
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>>
>>>>
>>>> I've done a template using debian 7.0.0, when i deploy an istance from
>>>>
>>>> this template the VM at the first boot get correctly the hostname from the
>>>>
>>>> DHCP server, then when I reboot the VM does not get the hostname from the
>>>>
>>>> DHCP server, and the setted hostname is "localhost".
>>>>
>>>>
>>>>
>>>> I've also created other template using CentOS 6.4 and it works fine.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> There is a known issue with debian 7.0.0? How can i solve it?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> IIRC this is a known issue with Debian and the version of dhclient they
>>>>
>>>> ship.
>>>>
>>>>
>>>>
>>>> --David
>>>>
>>>>
>>>>
>>>
>>> --
>>> Prasanna.,
>>>
>>> ------------------------
>>> Powered by BigRock.com
>>>
>> --
>> @shankerbalan
>>
>> M: +91 98860 60539 | O: +91 (80) 67935867
>> shanker.ba...@shapeblue.com | www.shapeblue.com | Twitter:@shapeblue
>> ShapeBlue Services India LLP, 22nd floor, Unit 2201A, World Trade Centre, 
>> Bangalore - 560 055
>>
>> This email and any attachments to it may be confidential and are intended 
>> solely for the use of the individual to whom it is addressed. Any views or 
>> opinions expressed are solely those of the author and do not necessarily 
>> represent those of Shape Blue Ltd or related companies. If you are not the 
>> intended recipient of this email, you must neither take any action based 
>> upon its contents, nor copy or show it to anyone. Please contact the sender 
>> if you believe you have received this email in error. Shape Blue Ltd is a 
>> company incorporated in England & Wales. ShapeBlue Services India LLP is 
>> operated under license from Shape Blue Ltd. ShapeBlue is a registered 
>> trademark.
>
>
>

--
@shankerbalan

M: +91 98860 60539 | O: +91 (80) 67935867
shanker.ba...@shapeblue.com | www.shapeblue.com | Twitter:@shapeblue
ShapeBlue Services India LLP, 22nd floor, Unit 2201A, World Trade Centre, 
Bangalore - 560 055

This email and any attachments to it may be confidential and are intended 
solely for the use of the individual to whom it is addressed. Any views or 
opinions expressed are solely those of the author and do not necessarily 
represent those of Shape Blue Ltd or related companies. If you are not the 
intended recipient of this email, you must neither take any action based upon 
its contents, nor copy or show it to anyone. Please contact the sender if you 
believe you have received this email in error. Shape Blue Ltd is a company 
incorporated in England & Wales. ShapeBlue Services India LLP is operated under 
license from Shape Blue Ltd. ShapeBlue is a registered trademark.

Reply via email to