VirtualBox

Opened 10 years ago

Last modified 10 years ago

#13275 new defect

VBoxManage does not set hostonly adapter name

Reported by: Onkelringnes Owned by:
Component: VM control Version: VirtualBox 4.3.14
Keywords: Cc:
Guest type: Linux Host type: Linux

Description

I've got a script that creates VM's for me and one of the lines is this one: VBoxManage modifyvm "$VM" --nic2 hostonly --hostonlyadapter1 'vboxnet0'

I can see the adapter in the network section in the GUI, however the name is blank. To populate the name I need to use the GUI and enter Settings, Network, applicable adapter and press Ok. I.e. I do not need to change anything, just press Ok for the hostonly adapter to have the name set.

Change History (1)

comment:1 by pcarr01, 10 years ago

This is a major issue for me and has caused my transition from VirtualBox to VMware Fusion within my vagrant dev environment. I need to assign nics to be host only, but when I do the Box instantly expires and my project fails.

here is the script with the offending lines commented out

basebox="centos64-x86_64-20140116"
Vagrant.configure("2") do |config|
# puppet master
  config.vm.define "puppet_master" do |mc|
    mc.vm.network "private_network", ip: "172.28.128.100", virtualbox__intnet:  "vboxnet0"
    mc.vm.hostname="puppet.local"
    mc.vm.network "forwarded_port", guest: 80, host: 8080
    mc.vm.network "forwarded_port", guest: 443, host: 8443
    mc.vm.provider :virtualbox do |vb|
#      vb.customize [ "modifyvm", :id, "--nic2", "hostonly", "--nictype2", "virtio", "--intnet2", "vboxnet0" ]
    end
  end
  config.vm.box =  "puppetlabs/centos-6.5-64-puppet-enterprise"
  config.vm.synced_folder "/Users/paddy/xfer/Vagrant", "/VagrantCommon"
  (1..3).each do |mord|
    mname = 'glu' + sprintf("%.2d",mord)
    puts "preparing #{mname}"
    config.vm.define mname do |mc|
      mc.vm.box = basebox
      oct=sprintf("%d",100+mord)
      ip_g = "172.28.128."+oct
      ip_e = "192.168.57."+oct
      mc.vm.network "private_network", ip: ip_g, virtualbox__intnet:  "vboxnet0"
      mc.vm.network "private_network", ip: ip_e, virtualbox__intnet:  "vboxnet1"
      mc.vm.hostname = mname + '.local'
      mc.vm.provision "shell", inline: "echo 172.28.128.100 puppet >> /etc/hosts"
      mc.vm.provider :virtualbox do |vb|
        (1..3).each do |dord|
          dname = mname + '_' + sprintf("disk_%.2d", dord) + ".vdi"
          unless File.exist?(dname)
            puts "creating #{dname}"
            vb.customize ['createhd', '--filename', dname, '--size',  1024]
          end
          vb.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', dord, '--device', 0, '--type', 'hdd', '--medium', dname]
#      vb.customize [ "modifyvm", :id, '--nic2', 'hostonly']
#      vb.customize [ "modifyvm", :id, '--nic3', 'hostonly']
        end
      end
    end
  end        
end
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use