Oracle VM VirtualBox: Ticket #10122: ModifyVM --natpf does not work as documented in the manual, GUI works fine thoughhttps://www.virtualbox.org/ticket/10122
<p>
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.
</p>
<p>
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:
</p>
<pre class="wiki">$ 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-&gt;session, LockType_Write)" at line 367 of file VBoxManageModifyVM.cpp
</pre><p>
The NAT engine must be working fine as the GUI works, looks like CLI syntax/params are wrong.
</p>
<p>
Thanks
</p>
en-usOracle VM VirtualBox/graphics/vbox_logo2_gradient.pnghttps://www.virtualbox.org/ticket/10122
Trac 0.12wadkarTue, 03 Jan 2012 02:41:02 GMThttps://www.virtualbox.org/ticket/10122#comment:1
https://www.virtualbox.org/ticket/10122#comment:1
<p>
and ohh, just to confirm that the guest7184 rules does not exist before hand, I tried looping as
</p>
<pre class="wiki">for i in {7180..7199}; do
VBoxManage modifyvm "Clibuntu" --natpf1 "guest$i,tcp,,$i,,$i"
done
</pre><p>
I get the error for every $i, and I am too damn lazy to add so many rules via GUI :D
</p>
TicketTechnologovTue, 03 Jan 2012 02:49:51 GMThttps://www.virtualbox.org/ticket/10122#comment:2
https://www.virtualbox.org/ticket/10122#comment:2
<p>
VBox: 4.1.8
</p>
<p>
After speaking with the user, it turned out just unclear documentation.
</p>
<p>
Manual "6.3.1. Configuring port forwarding with NAT" says this:
It works, only for stopped VMs.
</p>
<pre class="wiki">VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"
</pre><p>
But for already-running VM the correct command is:
</p>
<pre class="wiki">VBoxManage controlvm "VM name" natpf1 "guestssh,tcp,,2222,,22"
</pre><p>
-Technologov
</p>
TicketfrankTue, 03 Jan 2012 07:26:51 GMTstatus changed; resolution sethttps://www.virtualbox.org/ticket/10122#comment:3
https://www.virtualbox.org/ticket/10122#comment:3
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
<p>
Correct. And the manual says that <em>VBoxManage modifyvm</em> is only intended to work for changing properties of a registered virtual machine which is NOT running.
</p>
Ticket