VBoxManage: change nictype, etc. while VM running
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
VBoxManage: change nictype, etc. while VM running
If the VM is powered off, one can use "VBoxManage modifyvm" to modify the NICs (e.g., nictype1, bridgeadapter1).
If the VM is powered on, modifyvm doesn't work via VBoxManage, and controlvm doesn't have the options to change those NIC characteristics. Surprisingly, the VirtualBox GUI allows changing those characteristics while the VM is running.
I would like to do that via VBoxManage -- can anyone tell me how, or would this be a new feature for VBoxManage?
Thanks!
If the VM is powered on, modifyvm doesn't work via VBoxManage, and controlvm doesn't have the options to change those NIC characteristics. Surprisingly, the VirtualBox GUI allows changing those characteristics while the VM is running.
I would like to do that via VBoxManage -- can anyone tell me how, or would this be a new feature for VBoxManage?
Thanks!
-
- Volunteer
- Posts: 2561
- Joined: 30. May 2007, 18:05
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: XP, Win7, Win10, Linux, OS/2
Re: VBoxManage: change nictype, etc. while VM running
Which parameters do you want to change? Most can be changed with "VBoxManage controlvm nic<1-N> ...."
The nic adapter type (Intel/AMD/...) can not be changed on a running VM, even the GUI.
The nic adapter type (Intel/AMD/...) can not be changed on a running VM, even the GUI.
-
- Site Moderator
- Posts: 5229
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: VBoxManage: change nictype, etc. while VM running
As pointed out by Martin, you have 2 types of NIC settings :
offline NIC settings, managed by vboxmanage modifyvm - this requires a poweroff VM
online NIC settings, managed by vboxmanage controlvm
The GUI doesn't not allow you to edit offline settings while the VM is powered on, but it does allow you to change online settings.
This is the same here.
offline NIC settings, managed by vboxmanage modifyvm - this requires a poweroff VM
online NIC settings, managed by vboxmanage controlvm
The GUI doesn't not allow you to edit offline settings while the VM is powered on, but it does allow you to change online settings.
This is the same here.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
As indicated, I would like to change things (e.g., nictype1, bridgeadapter1) that are NOT in controlvm's parameter list.Martin wrote:Which parameters do you want to change? Most can be changed with "VBoxManage controlvm nic<1-N> ...."
The nic adapter type (Intel/AMD/...) can not be changed on a running VM, even the GUI.
I beg to differ, you can change the NIC type, bridge adapter, etc. at least under Fedora 17 as a host, while the VM is running and via the GUI. I do it often, and it works fine. I just can't find a way to do it via VBoxManage, and I would like to do this in a way that is scriptable.
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
Yes, I know, I noted that distinction in my original posting. But the GUI does allow changing of NIC settings such as nictype1 and bridgeadapter1 while the VM is running, whereas VBoxManage doesn't appear to.noteirak wrote:As pointed out by Martin, you have 2 types of NIC settings :
offline NIC settings, managed by vboxmanage modifyvm - this requires a poweroff VM
online NIC settings, managed by vboxmanage controlvm
The GUI doesn't not allow you to edit offline settings while the VM is powered on, but it does allow you to change online settings.
This is the same here.
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: VBoxManage: change nictype, etc. while VM running
What version of VirtualBox are you using? Type VBoxManage controlvm and see if it has the same commands as mine does.
Switches my guest to NAT and gets 10.0.2.15
Switches back to Bridged and get 192.168.1.107
Note: you probably will not see this change in the GUI until a complete shutdown, but it does work.
Code: Select all
VBoxManage controlvm <uuid>|<name>
pause|resume|reset|poweroff|savestate|
acpipowerbutton|acpisleepbutton|
keyboardputscancode <hex> [<hex> ...]|
setlinkstate<1-N> on|off |
nic<1-N> null|nat|bridged|intnet|hostonly|generic
[<devicename>] |
nictrace<1-N> on|off
nictracefile<1-N> <filename>
nicproperty<1-N> name=[value]
natpf<1-N> [<rulename>],tcp|udp,[<hostip>],
<hostport>,[<guestip>],<guestport>
natpf<1-N> delete <rulename>
guestmemoryballoon <balloonsize in MB>]
gueststatisticsinterval <seconds>]
usbattach <uuid>|<address> |
usbdetach <uuid>|<address> |
clipboard disabled|hosttoguest|guesttohost|
bidirectional]
draganddrop disabled|hosttoguest]
vrde on|off |
vrdeport <port> |
vrdeproperty <name=[value]> |
vrdevideochannelquality <percent>
setvideomodehint <xres> <yres> <bpp>
[[<display>] [<enabled:yes|no>
[<xorigin> <yorigin>]]] |
screenshotpng <file> [display] |
setcredentials <username>
--passwordfile <file> | <password>
<domain>
[--allowlocallogon <yes|no>] |
teleport --host <name> --port <port>
[--maxdowntime <msec>]
[--passwordfile <file> |
--password <password>]
plugcpu <id>
unplugcpu <id>
cpuexecutioncap <1-100>
Code: Select all
VBoxManage controlvm Mint-14.1-64 nic1 nat
Code: Select all
VBoxManage controlvm Mint-14.1-64 nic1 bridged eth0
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
Sorry, my mistake. I've used modifyvm to change "nictype1", and the GUI doesn't allow that to change... must have gotten it mixed up inmy mind. controlvm allows changes to "nic1". So the only thing that isn't documented that I need in controlvm is "bridgeadapter1", and by looking more closely at controlvm in the online documentation, I see that I can set that as follows:srondeau wrote:As indicated, I would like to change things (e.g., nictype1, bridgeadapter1) that are NOT in controlvm's parameter list.Martin wrote:Which parameters do you want to change? Most can be changed with "VBoxManage controlvm nic<1-N> ...."
The nic adapter type (Intel/AMD/...) can not be changed on a running VM, even the GUI.
I beg to differ, you can change the NIC type, bridge adapter, etc. at least under Fedora 17 as a host, while the VM is running and via the GUI. I do it often, and it works fine. I just can't find a way to do it via VBoxManage, and I would like to do this in a way that is scriptable.
VBoxManage controlvm myvm nic1 bridged em2.305
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
Sorry, my mistake. I see that now. Thanks for the help.Perryg wrote:What version of VirtualBox are you using? Type VBoxManage controlvm and see if it has the same commands as mine does.
Switches my guest to NAT and gets 10.0.2.15Code: Select all
VBoxManage controlvm <uuid>|<name> pause|resume|reset|poweroff|savestate| acpipowerbutton|acpisleepbutton| keyboardputscancode <hex> [<hex> ...]| setlinkstate<1-N> on|off | nic<1-N> null|nat|bridged|intnet|hostonly|generic [<devicename>] | nictrace<1-N> on|off nictracefile<1-N> <filename> nicproperty<1-N> name=[value] natpf<1-N> [<rulename>],tcp|udp,[<hostip>], <hostport>,[<guestip>],<guestport> natpf<1-N> delete <rulename> guestmemoryballoon <balloonsize in MB>] gueststatisticsinterval <seconds>] usbattach <uuid>|<address> | usbdetach <uuid>|<address> | clipboard disabled|hosttoguest|guesttohost| bidirectional] draganddrop disabled|hosttoguest] vrde on|off | vrdeport <port> | vrdeproperty <name=[value]> | vrdevideochannelquality <percent> setvideomodehint <xres> <yres> <bpp> [[<display>] [<enabled:yes|no> [<xorigin> <yorigin>]]] | screenshotpng <file> [display] | setcredentials <username> --passwordfile <file> | <password> <domain> [--allowlocallogon <yes|no>] | teleport --host <name> --port <port> [--maxdowntime <msec>] [--passwordfile <file> | --password <password>] plugcpu <id> unplugcpu <id> cpuexecutioncap <1-100>
Switches back to Bridged and get 192.168.1.107Code: Select all
VBoxManage controlvm Mint-14.1-64 nic1 nat
Note: you probably will not see this change in the GUI until a complete shutdown, but it does work.Code: Select all
VBoxManage controlvm Mint-14.1-64 nic1 bridged eth0
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
4.2.6Perryg wrote:What version of VirtualBox are you using?
I have been successful in setting the bridged interface using controlvm as mentioned above.
I have submitted a ticket (11417) stating that the user manual is out of sync with the VBoxManage controlvm options; the user manual omits the critical "[<devicename>]" option that I needed to know about, plus many more.
Now I have run into not knowing how to set the Advanced/Promiscuous Mode setting for adapter "Intel Pro/1000 MT Desktop" from the command line while the VM is running. I have verified that the GUI allows changing the promiscuity from "Deny" to "Allow VMs", for example, and I believe it works inside the VM as desired.
Using:
VBoxManage controlvm
I can't see the equivalent of the modifyvm's "--nicpromisc1 allow-vms" in the controlvm options. I tried what made sense using nicproperty1 (e.g., promisc=allow-vms), but it did not change them.
Does anyone have any ideas how to do that with VBoxManage controlvm?
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: VBoxManage: change nictype, etc. while VM running
nicproperty<1-N> name=[value]
If you look at the *.box file it shows you the proper name and syntax.
Example:
Keep in mind that the GUI does not always see this right away either.
If you look at the *.box file it shows you the proper name and syntax.
Code: Select all
VBoxManage controlvm <name|uuid> nickproperty<n>
promiscuousModePolicy="Deny"
promiscuousModePolicy="AllowAll"
promiscuousModePolicy="AllowNetwork"
Code: Select all
VBoxManage controlvm <name|uuid> nickproperty1 promiscuousModePolicy="AllowAll"
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
What .box file is that? I see .vbox files for my VM, but with the default policy of Deny, there is no promiscuousModePolicy listed. I do see one in the .vbox-prev file, though, and it coincides with what you wrote. How did you get the list of acceptable values, through manually setting them in the GUI?Perryg wrote:nicproperty<1-N> name=[value]
If you look at the *.box file it shows you the proper name and syntax.
Minor correction: should be "nicproperty1", not "nickproperty".Perryg wrote: Example:Keep in mind that the GUI does not always see this right away either.Code: Select all
VBoxManage controlvm <name|uuid> nickproperty1 promiscuousModePolicy="AllowAll"
But even with the change in option name, a copy and paste of the promiscuousModePolicy string did not work for me using VBoxManage 4.2.6 on a running VM.
Code: Select all
VBoxManage controlvm backtrack nicproperty1 promiscuousModePolicy="AllowAll"
VBoxManage showvminfo backtrack | grep "NIC 1"
-
- Site Moderator
- Posts: 5229
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: VBoxManage: change nictype, etc. while VM running
Perry did indeed mean the .vbox file.srondeau wrote:What .box file is that? I see .vbox files for my VM, but with the default policy of Deny, there is no promiscuousModePolicy listed. I do see one in the .vbox-prev file, though, and it coincides with what you wrote. How did you get the list of acceptable values, through manually setting them in the GUI?
As for getting the list of accepable values, AFAIK vboxmanage doesn't have it, but it is in the source code - or in the vbox file.
Same on my side - it doesn't work, looks like a bug.srondeau wrote:But even with the change in option name, a copy and paste of the promiscuousModePolicy string did not work for me using VBoxManage 4.2.6 on a running VM.
You can report this on the bugtracker, please report back here with the ticket number so other people can track down this issue and its status aswell.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!
-
- Site Moderator
- Posts: 34369
- Joined: 6. Sep 2008, 22:55
- Primary OS: Linux other
- VBox Version: OSE self-compiled
- Guest OSses: *NIX
Re: VBoxManage: change nictype, etc. while VM running
Like I said it does not always update the GUI or even the file. You need to check to see if it actually works like it should. It did for me when I tested the commands to make sure.
Same with Nic type. The guest would change but the vbox file and the gui would not always update.
Sorry about the typo. I was under duress at the time. Too many people tugging on me at once.
Same with Nic type. The guest would change but the vbox file and the gui would not always update.
Sorry about the typo. I was under duress at the time. Too many people tugging on me at once.
-
- Posts: 10
- Joined: 4. Mar 2010, 22:42
- Primary OS: Fedora other
- VBox Version: PUEL
- Guest OSses: Windows
Re: VBoxManage: change nictype, etc. while VM running
Still doesn't work for me. Here is what I did to set up a testing environment, and the results.Perryg wrote:Like I said it does not always update the GUI or even the file. You need to check to see if it actually works like it should. It did for me when I tested the commands to make sure..
1. Set up:
a. Three VMs: VM7 and VM8 on one host, VM9 on another host
VM7: 192.168.2.98
VM8: 192.168.2.88
VM9: 192.168.2.89
b. All VMs on the same subnet, 192.168.2.0/24, and same VLAN (318)
c. All VMs use Intel Pro/1000 MT Desktop adapter
d. No network services such as web/mail, to minimize traffic.
e. VM8 is pinging continuously to VM9:
Code: Select all
ping 192.168.2.89
a. Initial state: all VMs have promiscuity "Deny", set by VirtualBox GUI:
VM7 is running wireshark capture
VM7 sees only DHCP discover and ARP traffic.
b. VM7's promiscuity is changed to "Allow VMs", set by VirtualBox GUI:
VM7's wireshark capture is stopped, then started.
VM7 sees ICMP requests from VM8 to VM9 and responses from VM9 to VM8
VM7 sees ARP requests for VM8's MAC address from VM9
c. VM7's promiscuity is changed to "Deny", set by VirtualBox GUI:
VM7's wireshark capture is stopped, then started.
VM7 sees only DHCP discover traffic.
d. VM7's state was set back to before any promiscuousModePolicy settings were made, either by the GUI or presumably by VBoxManage. Then VM7's promiscuity was changed to "AllowAll", via:
Code: Select all
VBoxManage controlvm VM7 nicproperty1 promiscuousModePolicy="AllowAll"
VM7 sees only DHCP discover traffic.
No promiscuousModePolicy string was found in current VM7.vbox file, even after a shutdown of VM7, and restarting the VirtualBox GUI.
e. VM7's promiscuity is changed to "Allow All", set by VirtualBox GUI:
VM7's wireshark capture is stopped, then started.
VM7 sees ICMP requests from VM8 to VM9 and responses from VM9 to VM8
VM7 sees ARP requests for VM8's MAC address from VM9
The promiscuousModePolicy string was found in the current VM7.vbox file, as follows:
<Adapter slot="0" enabled="true" MACAddress="08002734DF8D" cable="true" speed="0" promiscuousModePolicy="AllowAll" type="82540EM"> <DisabledModes> <NAT> <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/> <Alias logging="false" proxy-only="false" use-same-ports="false"/> <Forwarding name="guestssh" proto="1" hostport="54009" guestport="22"/> </NAT> <GenericInterface driver=""> <Property name="promiscuousModePolicy" value="AllowAll"/> </GenericInterface> </DisabledModes> <BridgedInterface name="em2.318"/> </Adapter>Note that old property "promiscuousModePolicy", set by the previous "VBoxManage controlvm" command, appears in the 'DisabledModes/GenericInterface driver=""' portion.
-
- Site Moderator
- Posts: 5229
- Joined: 13. Jan 2012, 11:14
- Primary OS: Debian other
- VBox Version: OSE Debian
- Guest OSses: Debian, Win 2k8, Win 7
- Contact:
Re: VBoxManage: change nictype, etc. while VM running
Code: Select all
VBoxManage controlvm VM7 nicproperty1 promiscuousModePolicy="AllowAll"
If the setting is changed via the API, the .vbox is edited directly. If you try anything with vboxmanage, it is not, therefore something is not working or not implemented
So go ahead for the bugtracker.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Manage your VirtualBox infrastructure the free way!