List all interfaces

This is for discussing general topics about how to use VirtualBox.

List all interfaces

Postby HarryMan » 19. Jun 2019, 03:08

I am hoping that vboxmanage or another existing tool offered this. I would like to list *all* interfaces for all networks created by/for the virtualbox system (as opposed to real or virtual interfaces on the host system that were not created by/for virtualbox), indicating status, whether in use and by which VMs, maybe MAC addresses, and other pertinent information. This would be helpful when trying to analyze certain configurations.

Is there a public API for, say, the virtualbox XML files? Would the information in those files be sufficient to gather all the information re all interfaces?
HarryMan
 
Posts: 55
Joined: 15. Jan 2014, 13:54

Re: List all interfaces

Postby socratis » 19. Jun 2019, 10:10

I'm not sure I follow the question... Are you asking about the HostOnly and the NATservice NICs? The NICs of the VM? Can you please explain it a little bit further? Obviously all the info is available (AFAIK), I simply don't know which info for you're looking for...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 24721
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: List all interfaces

Postby HarryMan » 19. Jun 2019, 15:28

So perhaps I might type something like "VBoxManage list interfaces adapters" and it would spit out, line by line, each interface and the VMs they are attached to, maybe so:

vboxnet0 hostonlyif somelinux-vm:adapter1 anotherlinux-vm:adapter1
vboxnet1 hostonlyif ubuntu:adapter1 elementaryos:adapter2 somelinux-vm:adapter2(*) linux-vm3:adapter1 netbsd-vm:adapter1 alpine-linux-vm:adapter1
intnet1 intnet private-vm1:adapter1 private-vm2:adapter1 somelinux-vm:adapter3
nat1 nat alpine-linux-vm:adapter2
br1 bridge netbsd-vm:adapter2

and so forth. Maybe the "*" means the adapter has no wire attached to it atm. Maybe another option would include MAC addresses in the output, and so on. (I doubt including IP addresses would be practical.) And the output as presented here is just one possible manner in which the information might be presented; there may be a better, more normalized means to presenting the information.

This would be handy when trying to figure out where noise is coming from on a particular network, and perhaps other purposes. It occurs to me that this could be useful for helping to generate a wiring diagram for a complex data center.

I would not think this is very hard to accomplish.
HarryMan
 
Posts: 55
Joined: 15. Jan 2014, 13:54

Re: List all interfaces

Postby socratis » 19. Jun 2019, 16:18

I had to "reformat" your example in order to understand it better, I'm having a hard time reading terminal output with serif fonts. ;)
Interdace   Kind          VMs:Adapters
-------------------------------------------------------------------------------
vboxnet0 hostonlyif somelinux-vm:adapter1 anotherlinux-vm:adapter1
vboxnet1 hostonlyif ubuntu:adapter1 elementaryos:adapter2 somelinux-vm:adapter2(*)
intnet1 intnet private-vm1:adapter1 private-vm2:adapter1 somelinux-vm:adapter3
nat1 nat alpine-linux-vm:adapter2
br1 bridge netbsd-vm:adapter2

For every host physical adapter, and the VirtualBox internal ones (like vboxnet0, intnet1, nat1) which do not show in the host, do a lookup through each VM and post the info "which is attached to what".

Did I get it better this time? Is this something like that you had in mind?
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 24721
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: List all interfaces

Postby HarryMan » 20. Jun 2019, 18:10

Yeah, I guess I should have hit the "Code" button for my example output (sorry). I was trying to give a general idea of what the output could look like; I wasn't really trying to create a technical spec. At any rate, yes, your nicely formatted output is one possibility.

Thank you for spending the time to discuss this.
HarryMan
 
Posts: 55
Joined: 15. Jan 2014, 13:54

Re: List all interfaces

Postby socratis » 4. Jul 2019, 23:09

The information is already there, albeit not readily available, you need to do some work...
For each available $VM in "VBoxManage list vms"
    Do a "VBoxManage showvminfo $VM"
      Filter for the keyword "NIC" and not "disabled"
        Grab the output for further parsing

I have a script like that for example that gives me all the MACs for all my VMs, sorted by MAC, just to visually inspect if there's a duplicate in there. I have another script that gives me all the IPs for all the running VMs that use Bridged. Others have other scripts based on their needs. You wouldn't expect VirtualBox to provide such specific outputs, I highly doubt it...
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 24721
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: List all interfaces

Postby scottgus1 » 5. Jul 2019, 19:52

You might find this helpfu, on a Windows host:
Dynamic Windows CMD to run Vboxmanage on all guests
Human government is like that crazy uncle who hides a quarter in his fist behind his back, then asks you to guess which fist the quarter is in...
No matter which side you choose, Left or Right, both Sides are empty.
scottgus1
 
Posts: 4066
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Win7


Return to Using VirtualBox

Who is online

Users browsing this forum: Google [Bot] and 8 guests