Hello,

Short answer, seems the code will take care to rename the name in
DHCP_HOSTNAME if the variable is present,

But seems it doesn't add it to the new ifcfg-ethN that doens't have it, or
that vagrant create for the matter.

So, seems you should have to add it manually.

long answer:

Looking at the code that was implemented on:

https://github.com/mitchellh/vagrant/pull/2267/files

What the code does, is set the proper name in DHCP_HOSTNAME in
/etc/sysconfig/network-scripts/ifcfg-eth*

that patch, doesn't add the entry in DHCP_HOSTNAME.

So, if the base machine have DHCP_HOSTNAME just in ifcfg-eth0 like what is
default, then in a future change of hostname by vagrant, that will be taken
care.

>From where you took the option send_hostname_in_dhcp_request ??

Because the only hint I got, was a patch that wasn't merged in vagrant.

If I search my installed vagarant:

find /Applications/Vagrant/ -type f | xargs -n1 grep
send_hostname_in_dhcp_request

or the code in github that returns no hit.




On Fri, Jan 31, 2014 at 4:12 PM, Rajendra Krishnamurthy <
[email protected]> wrote:

> Thanks for looking at it,
>
> I am not trying to assign a static ip address for my host from the dhcp
> server. For my dhcp server to register the hostname, I need to send
> DHCP_HOSTNAME in /etc/sysconfig/network-scripts/ifcfg-eth1. But from the
> vagrant output, it looks like it is setting DHCP_HOSTNAME but when I login
> using 'vagrant ssh' I don't see the DHCP_HOSTNAME entry. I do get a dhcp
> address for eth1 and can login using that dhcp address but the hostname is
> not resolved. This is specific to CentOS systems.
>
> If I add the DHCP_HOSTNAME and restart networking then I can resolve the
> hostname. I am attaching the log file from my run and I am using vagrant
> 1.4.3
>
> [root@rk-c64-web vagrant]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
> #VAGRANT-BEGIN
> # The contents below are automatically generated by Vagrant. Do not modify.
> BOOTPROTO=dhcp
> ONBOOT=yes
> DEVICE=eth1
> #VAGRANT-END
>
> [root@rk-c64-web vagrant]# cat /etc/sysconfig/network
> NETWORKING=yes
> HOSTNAME=rk-c64-web.denali-systems.com
>
>
>
> On Thursday, January 30, 2014 4:14:46 PM UTC-8, Alvaro Miranda Aguilera
> wrote:
>>
>> Hello,
>>
>> Reading his patch when this was introduced
>>
>> https://github.com/mitchellh/vagrant/pull/2267/files
>>
>> what you see is what was implemented
>>
>> it will set DHCP_HOSTNAME in the network file, and will tell the dhcp
>> server what's the vm name.
>>
>> example: http://www.cyberciti.biz/faq/howto-get-linux-static-dhcp-
>> address/
>>
>> That should work on dhcp/dns that allow automatic registration.
>>
>> What dns/dhcp does your network have?
>>
>> Alvaro.
>>
>>
>> On Thu, Jan 30, 2014 at 1:59 PM, Rajendra Krishnamurthy <
>> [email protected]> wrote:
>>
>>> I am sending the option ":send_hostname_in_dhcp_request => true" in my
>>> Vagrantfile, but when I call "vagrant up" it looks like it is setting the
>>> DHCP_HOSTNAME in /etc/sysconfig/network-scripts/ifcfg-eth1 but
>>> overwriting it later on. Can someone help me if my Vagrantfile doesn't look
>>> correct or is there some issue over here?
>>>
>>> Vagrantfile:
>>> # Vagrantfile API/syntax version. Don't touch unless you know what
>>> you're doing!
>>> VAGRANTFILE_API_VERSION = "2"
>>>
>>> Vagrant.configure(VAGRANTFILE_API_VERSION) do |wp|
>>>   # All Vagrant configuration is done here. The most common configuration
>>>   # options are documented and commented below. For a complete reference,
>>>   # please see the online documentation at vagrantup.com.
>>>
>>>   # The url from where the 'config.vm.box' box will be fetched if it
>>>   # doesn't already exist on the user's system.
>>>   wp.vm.box_url = box_url
>>>   wp.ssh.private_key_path = pvt_key
>>>
>>> ...
>>> # Define web-tier
>>> wp.vm.define :web do |web|
>>>   web.vm.box = web_name
>>>   web.vm.hostname = web_name
>>>   web.vm.network :public_network, :send_hostname_in_dhcp_request => true
>>>
>>> ...
>>>
>>>
>>>
>>> Output of 'vagrant up' run at info level:
>>> ...
>>>  INFO ssh: Execute: sed -i 's/\(DHCP_HOSTNAME=\).*/\1"rk-c64-web"/'
>>> /etc/sysconfig/network-scripts/ifcfg-* (sudo=true)
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO ssh: Execute: service network restart (sudo=true)
>>> ...
>>>
>>> [web] Configuring and enabling network interfaces...
>>>  INFO ssh: SSH is ready!
>>>  INFO guest: Execute capability: configure_networks (redhat)
>>>  INFO ssh: SSH is ready!
>>>  INFO guest: Execute capability: network_scripts_dir (redhat)
>>>  INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg-eth1
>>> (sudo=true)
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d'
>>> /etc/sysconfig/network-scripts/ifcfg-eth1 > /tmp/vagrant-ifcfg-eth1
>>> (sudo=true)
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO subprocess: Starting process: ["/usr/bin/VBoxManage",
>>> "showvminfo", "c863aa2b-a7be-47bd-881b-d14d8452875f",
>>> "--machinereadable"]
>>>  INFO ssh: Execute: cat /tmp/vagrant-ifcfg-eth1 >
>>> /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
>>> ...
>>>
>>>
>>> Thanks,
>>> Rajendra
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Vagrant" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to