Issue adding network interface via command line?

This is for discussing general topics about how to use VirtualBox.
Post Reply
N00bie
Posts: 13
Joined: 8. Jul 2014, 17:00

Issue adding network interface via command line?

Post by N00bie »

I'm adding a NAT network interface with this command:

Code: Select all

VBoxManage modifyvm "testvm" --nic1 nat
When I try starting up the VM, I get the error:

Code: Select all

Nonexistent host networking interface, name '' (VERR_INTERNAL_ERROR).
Here's what's interesting. If I open the VirtualBox GUI and go to the VM Settings->Network->Adapter 1 and then click OK, the GUI saves the settings (none of which I changed) and then the VM will start without an error!

Any idea why this is happening?

Thanks!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Issue adding network interface via command line?

Post by Perryg »

What is the exact name of the guest ( case matters )?
Was the guest shut down or in saved state?
Was nic1 already created and the nictype set, or was this a first time setting?
N00bie
Posts: 13
Joined: 8. Jul 2014, 17:00

Re: Issue adding network interface via command line?

Post by N00bie »

Perryg wrote:What is the exact name of the guest ( case matters )?
Was the guest shut down or in saved state?
Was nic1 already created and the nictype set, or was this a first time setting?
The name of the guest is 'testvm'.

Shut down.

This was the first time setting.

These are the commands I ran to create the virtual machine:

Code: Select all

vboxmanage createvm --name testvm --register

vboxmanage modifyvm "testvm" --memory 8192 --vram 64 --acpi on --boot1 dvd
vboxmanage modifyvm "testvm" --nic1 nat
vboxmanage modifyvm "testvm" --nic2 hostonly
vboxmanage modifyvm testvm --natpf1 "ssh,tcp,,2200,,22"
vboxmanage modifyvm testvm --natpf1 "http,tcp,,8880,,80"
vboxmanage modifyvm testvm --natpf1 "https,tcp,,8881,,443"

vboxmanage modifyvm "testvm" --ostype "Ubuntu_64"

vboxmanage createhd --filename "/Users/nate/VirtualBox VMs/testvm/testvm-disk01.vdi" --size 20480

vboxmanage storagectl testvm --name "IDE Controller" --add ide
vboxmanage modifyvm "testvm" --boot1 dvd --hda "/Users/nate/VirtualBox VMs/testvm/testvm-disk01.vdi" --sata on


vboxmanage storageattach testvm --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/Users/nate/VirtualBox VMs/testvm/testvm-disk01.vdi"  # Attach virtual disk testos.vdi to the 0th port at device 0
vboxmanage storageattach testvm --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium "/Users/nate/VirtualBox VMs/ubuntu-14.04.3-server-amd64.iso" #Attach the ISO at the 1th port at device 0

vboxmanage modifyvm "testvm" --dvd "/Users/nate/VirtualBox VMs/ubuntu-14.04.3-server-amd64.iso"

#shared folders
VBoxManage sharedfolder add "testvm" --name "shopws" --hostpath "/Users/nate/GitHub/shop-wise/"
VBoxManage sharedfolder add "testvm" --name "iew" --hostpath "/Users/nate/GitHub/iew/"
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Issue adding network interface via command line?

Post by Perryg »

Looks like you forgot to set the --nictype on creation. When you open it in the gui I assume that is when the default is set.
Post Reply