Skip to content

Instantly share code, notes, and snippets.

@sdoro
Created April 6, 2013 21:46
Show Gist options
  • Save sdoro/5327746 to your computer and use it in GitHub Desktop.
Save sdoro/5327746 to your computer and use it in GitHub Desktop.
Howto add/remove in VirtualBox a fifth NIC (without GUI) in hostonly networking
VBoxManage modifyvm "vm" --hostonlyadapter5 vboxnetX
VBoxManage modifyvm "vm" --nic5 hostonly
VBoxManage modifyvm "vm" --nic5 none
@sdoro
Copy link
Author

sdoro commented May 3, 2013

Don't forget to create a vboxnetX !

You can also rewrite above 2 commands in one:

VBoxManage modifyvm "vm" --nic5 hostonly --hostonlyadapter5 vboxnetX

@marcelser
Copy link

How do I create vboxnetx or list all the vboxnetX without GUI?

@trasherdk
Copy link

@marcelser

Listing your hosts network interfaces is done with:

VBoxManage list intnets|bridgedifs|hostonlyifs|natnets

In my case, I have 2 physical net-cards on my server (host) eth0 and eth1

$ VBoxManage list bridgedifs 
Name:            eth0
GUID:            30687465-0000-4000-8000-109836a72593
DHCP:            Disabled
IPAddress:       1.2.3.4
NetworkMask:     255.255.255.xxx
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: <mac-address>
MediumType:      Ethernet
Wireless:        No
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-eth0

Name:            eth1
GUID:            31687465-0000-4000-8000-109836a72594
DHCP:            Disabled
IPAddress:       0.0.0.0
NetworkMask:     0.0.0.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 10:98:36:a7:25:94
MediumType:      Ethernet
Wireless:        No
Status:          Down
VBoxNetworkName: HostInterfaceNetworking-eth1

Those are the ones I can attach a guest VM network interface to.

So, for example, I want to create a interface on guest vm-name attached to host nic eth0

VBoxManage modifyvm "vm-name" --nic1 bridged --nictype1 82545EM --bridgeadapter1 eth0

Okay, now I want to create a second interface on guest vm-name attached to host nic eth1

VBoxManage modifyvm "vm-name" --nic2 bridged --nictype2 82545EM --bridgeadapter2 eth1

And that's pretty much it 👍

@rmoyano
Copy link

rmoyano commented Sep 7, 2021

How do I create vboxnetx or list all the vboxnetX without GUI?

Create a new host-only if:
$ VBoxManage hostonlyif vboxnetXY

List host-only if's:
$ VBoxManage list hostonlyifs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment