5

I have an Ubuntu 9.04 desktop 64-bit guest OS running on an Ubuntu 9.04 desktop 64-bit host OS (yes, the same OS). I'd like to run a web server on the guest and make it accessible through NAT on the host.

I (think I) followed the VirtualBox port forwarding instructions, but the guest/VM won't start after I do the configuration.

Here's the configuration that I ran:

VBoxManage setextradata "<Guest Name>" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP
VBoxManage setextradata "<Guest Name>" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80
VBoxManage setextradata "<Guest Name>" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 8080

Where <Guest Name> is the name of the guest VM image.

The error looks like this:

enter image description here

The same error happens regardless of whether I run the configuration while the VM is running, or not running.

Guest additions are installed.

How do I properly configure the NAT port forwarding? What is causing this error?

3
  • Do you realy need NAT? Bridge is simplier to set, and this what you want will work instantaneously.
    – igustin
    Sep 19, 2009 at 16:55
  • True, but I think NAT comes as default in certain versions. At least, it did when I set up my VBox using latest 8 months ago.
    – J. Polfer
    Oct 1, 2009 at 13:44
  • Are you sure your virtual network adapter is PCNet? When I create a virtual machine and choose ubuntu x64, i get e1000 by default.
    – Bender
    Oct 1, 2009 at 13:57

3 Answers 3

5

get all param you did for this WM with command:

VBoxManage.exe getextradata "Name_of_VM" enumerate

You should see all value transmited to VM.

Key: GUI/SaveMountedAtRuntime, Value: yes
Key: GUI/ShowMiniToolBar, Value: yes
Key: GUI/MiniToolBarAlignment, Value: bottom
Key: GUI/LastCloseAction, Value: save
Key: GUI/LastWindowPostion, Value: 345,133,640,522
Key: GUI/Fullscreen, Value: off
Key: GUI/Seamless, Value: off
Key: GUI/AutoresizeGuest, Value: on
Key: GUI/MiniToolBarAutoHide, Value: on
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort, Value: 22
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort, Value: 22

Remove all ligne begin with VBoXInternal by Copying and paste the line to command like this

VBoxManage.exe setextradata "Name_of_VM" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort"

with no value to the end. At end you should enumerate again and see no more lines of VBoxInternal.

Now you can make again the NAT rules, with different name for rules.

Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort, Value: 2222
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort, Value: 22
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort, Value: 80
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort, Value: 8080

Under linux you should remind that PORTS <1024 should NOT be redirected. use 2222 for guestssh and 8080 for guesthttp (Example) For ease of use I personnaly use <1014 port under WINDOWS.

Hope this should help you.

(Sorry For English! I'm frenchy :P)

Jacques.guensherian

3

I had the same problem--- I think Oracle changed the way NAT is set up. It's much cleaner now. This is copied from the user manual, which is still at: http://www.virtualbox.org/manual/UserManual.html

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

"This forwards all TCP traffic arriving on the localhost interface (127.0.0.1) via port 2222 to port 22 in the guest."in the guest."

1
  • No one marked this answer, but running OS X 10.6.x host and Debian GNU/Linux 6.0.1 (squeeze) guest in 3.2.12 r68302 this did the trick. Thanks for saving me yet another hour of annoyance and frustration.
    – songei2f
    Jun 28, 2011 at 18:57
1

I had the same symptom when I setup up port forwarding in VirtualBox.

When I create new VMs in VirtualBox, the default network adapter is e1000, not pcnet as per the instructions you followed.

If you modify the config settings to:

VBoxManage setextradata "<Guest Name>" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/Protocol" TCP
VBoxManage setextradata "<Guest Name>" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/GuestPort" 80
VBoxManage setextradata "<Guest Name>" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guesthttp/HostPort" 8080

This should solve your problem.


The above configuration option will work for the first e1000 adapter, hence the e1000/0 in the settings. Double check which network adapter is being used by the VM you are trying to port forward to.

On my installation, the network adapters available are two "PcNet" ones and three "Intel Pro 1000".

The adapters are referred to by the following keys:

  • First PCNet: pcnet/0
  • Second PCNet: pcnet/1
  • First Intel PRO/1000: e1000/0
  • Second Intel PRO/1000: e1000/1
  • Third Intel PRO/1000: e1000/2

If your adapter is, for example, the second "PRO/1000" in the list, then you need to modify the above config to e1000/1 (etc).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .