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.

Reply via email to