networking - VirtualBox NAT port forwarding on Ubuntu 64?

25
2013-09
  • Greg Mattes

    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?

  • Answers
  • the_curator

    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

  • catchdave

    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).


  • Related Question

    windows xp - Virtualbox and Serial Port permissions
  • Pandincus

    I have a Windows XP Pro SP3 host machine running a Windows XP Pro SP3 guest machine. The host machine has one serial port, COM1, that I need to use in the guest machine.

    When I add the serial port to the guest machine and try to start it, I get the following error:

    Failed to start the virtual machine xxx
    
    Cannot open host device 'COM1' for read/write access.
    Check the permissions of that device (VERR_ACCESS_DENIED).
    
    Unknown error creating VM (VERR_ACCESS_DENIED).
    

    What are some of the things that might be causing this problem? How can I check "permissions" on a serial port?


  • Related Answers
  • ytg

    When you can not access a serial port in most of the cases something is using it already. If that is the case you can try to access the port with hyperteminal. If it can not open the port either, you just have to find what uses it, and shut it down.