VirtualBox

Ticket #10122 (closed defect: invalid)

Opened 2 years ago

Last modified 2 years ago

ModifyVM --natpf does not work as documented in the manual, GUI works fine though

Reported by: wadkar Owned by:
Priority: major Component: network/NAT
Version: VirtualBox 4.1.8 Keywords: VBoxManage, modifyvm, natpf
Cc: wadkar+vbox@… Guest type: Linux
Host type: Linux

Description

I have a simple setup with Ubuntu 11.04 Desktop as host and Ubuntu 11.10 CLI-minmal as guest. There is one eth0 on guest which is configured as NAT forwarded.

If I add port forwarding rules via the GUI, everything seems to be fine and the rules are in place. However, if I try to accomplish the same thing via CLI, I get following error:

$ VBoxManage modifyvm "Clibuntu" --natpf1 "guest7184,tcp,,7184,,7184"
VBoxManage: error: The machine 'Clibuntu' is already locked for a session (or being unlocked)
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Machine, interface IMachine, callee nsISupports
Context: "LockMachine(a->session, LockType_Write)" at line 367 of file VBoxManageModifyVM.cpp

The NAT engine must be working fine as the GUI works, looks like CLI syntax/params are wrong.

Thanks

Change History

comment:1 Changed 2 years ago by wadkar

and ohh, just to confirm that the guest7184 rules does not exist before hand, I tried looping as

for i in {7180..7199}; do
    VBoxManage modifyvm "Clibuntu" --natpf1 "guest$i,tcp,,$i,,$i"
done

I get the error for every $i, and I am too damn lazy to add so many rules via GUI :D

comment:2 Changed 2 years ago by Technologov

VBox: 4.1.8

After speaking with the user, it turned out just unclear documentation.

Manual "6.3.1. Configuring port forwarding with NAT" says this: It works, only for stopped VMs.

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"

But for already-running VM the correct command is:

VBoxManage controlvm "VM name" natpf1 "guestssh,tcp,,2222,,22"

-Technologov

comment:3 Changed 2 years ago by frank

  • Status changed from new to closed
  • Resolution set to invalid

Correct. And the manual says that VBoxManage modifyvm is only intended to work for changing properties of a registered virtual machine which is NOT running.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use