Several questions about bridging and DHCP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Several questions about bridging and DHCP

michael.jinks
Vagrant newbie, using 1.2.0 on Ubuntu Precise, guest VM is the precise64 image from the download site.  VM provider is the VirtualBox included with Vagrant.

What I'd like to have:

  - eth0 on the guest, attached to the private network, acting as a backnet for administrative purposes, configured any old way by Vagrant;

  - eth1 bridged to my outer net, where a DHCP server is running; static MAC address, to allow hosting of services accesible from my local network.

What I'm trying currently:

  - eth0 isn't referenced at all in my Vagrantfile.  It comes up fine, "vagrant ssh" connects, outbound traffic (e.g. "ping www.google.com") works.

  - eth1 is configured like so in my Vagrantfile:

      config.vm.network :public_network, :bridge => 'eth1'

That configuration is a guess, based on trial and error and docs I could find for the previous Vagrant series.  I haven't tried setting a MAC address yet, because at this point I start to have trouble.

When my VM comes up, it pauses for a long time at:

[...]
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[...]

While it's at that stage, "vagrant ssh" can already connect, so I know that eth0 is working fine, and 'ifconfig eth1' shows an unconfigured interface.  Eventually that stage times out, and eth1 never gets an address.

I know that our DHCP server works, because that's how the VM host machine and lots of others get their addresses.

I think my configuration syntax is correct, because Vagrant is really good about telling me when I get it wrong, either by throwing an error or doing a stack trace.

My hunch is that eth1 on the VM is being bridged to eth1 on the hypervisor machine, which isn't plugged in to anything, and that's why DHCP requests go nowhere and eventually give up.  To test that, I installed dhcpcd on the guest, tried to use it to configure eth1, and saw the same timeout behavior.  (I haven't done further forensics to test my hunch; I could, but I figured this was a good time to pause and get a sanity check.)

So questions are pretty obvious:

First, is my plan valid at all, is there some other "right" way to accomplish what I want?

Assuming my bridging hunch is likely, is there some way to force eth1 on the VM to bridge to eth0 on the hypervisor (and is that advisable)?

What's the correct syntax for assigning a static MAC address to eth1 so that my DHCP server will give it a predictable IP address?

More generally, is there some stash of documentation other than the main site, that would have answered these questions for me?

Many thanks,
--Michael

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Several questions about bridging and DHCP

VMTrooper
Hello Michael,

I too am a Newbie, but I hope that my struggles trying to do something similar can help you.

eth0 is set automatically to bridge\NAT because Vagrant uses it to do some post-processing.  From what I've seen, this IP never changes, no matter what I do.

I've tried to set a bridging IP by following Internet posts to configure the VMware Fusion DHCP server to recognize my static MAC and assign the correct IP, but that didn't work (My Vagrantfile lines to set the static MAC are included below in my sample code, but they are commented out).

What I settled on doing is using the eth0 IP as my external address and my eth1 IP as static, host-only IP for my OpenStack testing.  Not the best solution, I'm sure since one day my eth0 IP may change.  so far, however, it is working for me.

I hope it will be easier to be deterministic about setting bridging IPs in the future:

If Mitchell or any of the other Vagrant vets can help us Newbies out, that would be great!  :-)

Sample code:
config.vm.define :controller do |controller|
    controller.vm.box = "precise64"
    controller.vm.hostname = "controller"
    controller.vm.network :private_network, ip: "113.0.0.10" #create eth1
   # controller.vm.network :public_network #from when I was trying to set the static MAC
    controller.vm.provider :vmware_fusion do |v| #editing the VMware Fusion VMX file directly
       v.vmx["vhv.enable"] = "TRUE" #allow nested KVM VMs
#      v.vmx["ethernet1.generatedAddress"] = nil #trying to override DHCP-generated address
 #     v.vmx["ethernet1.connectionType"] = "nat"
  #    v.vmx["ethernet1.present"] = "TRUE"
   #   v.vmx["ethernet1.address"] = "00:0c:29:ca:d4:a0" #trying to set static NAT
    end
  end

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.