vmfest icon indicating copy to clipboard operation
vmfest copied to clipboard

:local (hostonly) networking fails to set itself up

Open mathias opened this issue 11 years ago • 3 comments

Using the debian-6.0.2.1-64bit-v0.3 base image, Virtualbox 4.3.6r91406:

Using the default hostonly networking doesn't seem to work. If I halt the VM, and then run it through the Virtualbox GUI (so that I can have a console), I see the image attempt DHCP for each NIC, fail, and then try some sort of cached lease that also doesn't work.

Logging into the VM, I can't get a route out or ping anything. There's no way to SSH into the box from outside despite sshd running.

It might be my virtualbox config, but what I'm wondering is: Is there some way to be able to specify the networking settings for vmfest? When I use Vagrant, I usually can specify things like IP addresses, hostnames, and forwarded ports in the Vagrantfile -- that'd be nice to have here, so that I could both know what was going to get configured and also, hopefully, the system would check that setting it up worked.

mathias avatar Feb 01 '14 20:02 mathias

Matthias, what version of vmfest is it that you are using? And what host OS? I have seen with OSX mavericks that if you don't have a harcdoded DNS in your OSX network config, setting the DNS via DHCP fails in some networks. If you add the host-only interface by hand, does it work?

You can specify everything about the vbox vm configuration in vmfest, see: https://github.com/tbatchelli/vmfest/blob/develop/test/vmfest/virtualbox/machine_config_test.clj#L214

This is can be used from pallet, for example:

(def default-vm-ram 2048)
(def default-vm-cpu-count 2)

(defn vbox-node-spec
  [{:keys [image-id memory-size cpu-count]}]
  (node-spec :image {:image-id (or image-id *image-id*)}
             :hardware {:hardware-model
                        {:memory-size (to-int (or memory-size default-vm-ram))
                         :cpu-count (to-int (or cpu-count default-vm-cpu-count))
                         :storage [{:name "IDE Controller"
                                    :bus :ide
                                    :devices [nil nil nil nil]}]
                         :boot-mount-point ["IDE Controller" 0]}}))

tbatchelli avatar Feb 02 '14 02:02 tbatchelli

I'm using [com.palletops/pallet-vmfest "0.4.0-alpha.1"] which requires the same version of vmfest, it looks like.

What I meant by network config is that in a Vagrantfile I can specify something along the lines of:

  config.vm.network :private_network, ip: "10.10.10.10"

And then ssh [email protected] will work after the machine is booted and provisioned. (And provided that's the user, etc.)

I'm not familiar enough with Virtualbox internals to know how they're accomplishing that, though.

Edit: Note that the "10.10.10.10" address above shows up as an extra NIC on the Virtualbox:

VBoxManage showvminfo [hostname]
[snip lots]
NIC 1:           MAC: 0800273B7FE4, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
NIC 2:           MAC: 080027916980, Attachment: Host-only Interface 'vboxnet5', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none

I took a look at the machine_config namespace, but I'm not quite sure how to pass in additional network options.

mathias avatar Feb 02 '14 03:02 mathias

It's probably worth noting that the reason I'd like to be able to specify the IP for a host-only network interface is so that I can assign IPs as I build boxes.

Some more details while I've got them all in front of me:

Right now, with a VM created with a spec that includes

  :network [{:attachment-type :host-only
                    :host-only-interface "vboxnet0"}

Boots, but never gets on the network. It's ifconfig -a is vm_ifconfig

(sorry, can't copy/paste out of the Virtualbox console)

And my laptop's vboxnet0 interface looks like

$ ifconfig vboxnet0
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00
    inet 10.0.3.1 netmask 0xffffff00 broadcast 10.0.3.255

The REPL from vmfest shows:

(get-ip my-machine)
"10.0.3.15"

But pinging or SSHing from my laptop to 10.0.3.15 doesn't work; as my laptop cannot see the VM.

Thoughts?

mathias avatar Feb 02 '14 05:02 mathias