Detect other user's networks

Discussions related to using VirtualBox on Linux hosts.
Post Reply
SeanUNB
Posts: 2
Joined: 21. Jun 2021, 14:58

Detect other user's networks

Post by SeanUNB »

Does anyone know of a way to detect if another user is currently running a VM making use of a particular NatNetwork or INTNetwork?

We have lab machine where different students login and run groups of VMs connected via either NatNetwork or INTNetworks.
Everything works fine except when 2 different users run VMs at the same time with the same named NatNetwork or INTNetworks.
The 2nd user gets a "Failed to open/create the internal network 'intnet' (VERR_Permission_DENIED).
This error is to be expected, but I would like to find a way to detect the issue before the error and handle more gracefully.

vboxmanage list -l intnets does not show networks for other users.

Any ideas?

Thanks,
Sean
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Detect other user's networks

Post by mpack »

NAT networks and Internal networks are entirely virtual, and the related background processes run in the user space, so I know of no way for a different user to spy on those virtual networks. Certainly there is no way (that I know of) provided by VirtualBox.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Detect other user's networks

Post by fth0 »

SeanUNB wrote:The 2nd user gets a "Failed to open/create the internal network 'intnet' (VERR_Permission_DENIED).
This error is to be expected
I don't understand (yet) why this error is to be expected. I would have expected that each user had their own VBoxSVC process with VirtualBoxVM, VBoxNetDHCP and VBoxNetNAT processes as child processes, and I would have assumed the internal networks to be separated as well. But I don't know the exact implementation details.

How do you enable your users to use the same VMs?
SeanUNB
Posts: 2
Joined: 21. Jun 2021, 14:58

Re: Detect other user's networks

Post by SeanUNB »

Perhaps "is to be expected" is not the correct phrase.
I did sort of justify the error in my mind since it only happens when multiple users with the same network name run at the same time.
If a user changes the network name there is no issue. (ie. vboxmanage modifyvm <vmname> --intnet1 myownnetwork)

To answer your other question, I have hundreds of students so each student having their own copy of several rather large VDI files was not an option.
The VDI and VBOX files are in a shared location and read-only.
Each user registers the VM on the fly (vboxmanage registervm) and sets the VDI file to immutable and attaches it.
This give each user their own writable overlay/snapshot.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Detect other user's networks

Post by scottgus1 »

Back in Windows Server 2003 days, Terminal Services could allow multiple people to use one physical computer via Remote Desktop and run the same installed program in different user spaces. Could be that Sean's host has something like this running:
SeanUNB wrote:lab machine ... when 2 different users run VMs at the same time
Maybe Virtualbox is not programmed to handle such a usage scenario? Sounds like it if one user's "Intnet" blocks another user's "Intnet".
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Detect other user's networks

Post by mpack »

fth0 wrote: I don't understand (yet) why this error is to be expected.
"Expected" may be a bit strong, "unsurprising" might be better. I have not looked at the implementation either, but this error tells me that named objects are created in kernel space, and name conflicts result in errors.
Post Reply