Page 1 of 1
[SOLVED] Problem w/ Nat Port Forwarding
Posted: 7. Jan 2011, 21:59
by rootproxi
Hello all,
This is my first time visiting the forums and my first post. I want to start off and thank the development and support teams that have made virtualbox what it is, it has saved my non-profit 1000's of dollars and has really helped make our IT infrastructure more reliable and useful. I am currently have the following setup:
Host: Ubuntu Server 64bit 9.10
VBox Version: 3.0.8_OSE
Guest: Windows XP Pro SP3
I have been following the tutorial under Chapter 6, Virtual networking. I am trying to forward a port on the host to the rpd port 3389 on the XP guest. I had somehow gotten this to work about a year ago but I forgotten how and have also failed to save my reference material. When I enter the following command:
VBoxManage modifyvm TServer --natpf1 "guestssh,tcp,,22222,,3389"
I receive the following error:
Syntax error: Invalid parameter '--natpf1'
I guess I'm probably using incorrect syntax for my version of VBox. Can someone give me some help and point me in the right direction to get this working. Any help is greatly appreciated.
Thanks,
rootproxi
Re: Problem w/ Nat Port Forwarding
Posted: 7. Jan 2011, 22:07
by Perryg
I don't have that version available to me anymore but you can type VBoxManage modifyvm without any commands and see the proper syntax.
I know that somewhere around that time the syntax changed to what you are trying to use now, but I don't remember exactly when.
Edit: I found an old manual
http://dlc.sun.com.edgesuite.net/virtua ... Manual.pdf
Code: Select all
VBoxManage setextradata "Linux Guest"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "Linux Guest"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "Linux Guest"
"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222
Re: Problem w/ Nat Port Forwarding
Posted: 10. Jan 2011, 16:25
by rootproxi
Thanks for the reply. I haven't been in town for the last few days. I will have to look at that manual. Here's the syntax info for modifyvm:
Usage:
VBoxManage modifyvm <uuid|name>
[--name <name>]
[--ostype <ostype>]
[--memory <memorysize in MB>]
[--vram <vramsize in MB>]
[--acpi on|off]
[--ioapic on|off]
[--pae on|off]
[--hwvirtex on|off]
[--nestedpaging on|off]
[--vtxvpid on|off]
[--cpus <number>]
[--monitorcount <number>]
[--accelerate3d <on|off>]
[--bioslogofadein on|off]
[--bioslogofadeout on|off]
[--bioslogodisplaytime <msec>]
[--bioslogoimagepath <imagepath>]
[--biosbootmenu disabled|menuonly|messageandmenu]
[--biossystemtimeoffset <msec>]
[--biospxedebug on|off]
[--boot<1-4> none|floppy|dvd|disk|net>]
[--hd<a|b|d> none|<uuid>|<filename>]
[--idecontroller PIIX3|PIIX4]
[--sata on|off]
[--sataportcount <1-30>]
[--sataport<1-30> none|<uuid>|<filename>]
[--sataideemulation<1-4> <1-30>]
[--scsi on|off]
[--scsiport<1-16> none|<uuid>|<filename>]
[--scsitype LsiLogic|BusLogic]
[--dvd none|<uuid>|<filename>|host:<drive>]
[--dvdpassthrough on|off]
[--floppy disabled|empty|<uuid>|
<filename>|host:<drive>]
[--nic<1-N> none|null|nat|bridged|intnet|hostonly]
[--nictype<1-N> Am79C970A|Am79C973|
82540EM|82543GC|82545EM]
[--cableconnected<1-N> on|off]
[--nictrace<1-N> on|off]
[--nictracefile<1-N> <filename>]
[--nicspeed<1-N> <kbps>]
[--bridgeadapter<1-N> none|<devicename>]
[--hostonlyadapter<1-N> none|<devicename>]
[--intnet<1-N> <network name>]
[--natnet<1-N> <network>|default]
[--macaddress<1-N> auto|<mac>]
[--uart<1-N> off|<I/O base> <IRQ>]
[--uartmode<1-N> disconnected|
server <pipe>|
client <pipe>|
file <file>|
<devicename>]
[--gueststatisticsinterval <seconds>]
[--audio none|null|oss|alsa|pulse]
[--audiocontroller ac97|sb16]
[--clipboard disabled|hosttoguest|guesttohost|
bidirectional]
[--usb on|off]
[--usbehci on|off]
[--snapshotfolder default|<path>]
I'm guessing I need to type something like --nic<1-N> nat "guestssh,tcp,,22222,,3389" but I recieve, Invalid parameter 'guestssh,tcp,,22222,,3389' from the command line so that's not it. I'll take a look at that manual before I do anything else.
Re: Problem w/ Nat Port Forwarding
Posted: 10. Jan 2011, 16:35
by Perryg
If you look at the code I sent you it states that with your version you use setextradata and not modifyvm to setup port forwarding.
Re: Problem w/ Nat Port Forwarding
Posted: 10. Jan 2011, 17:35
by rootproxi
[FIXED]
Thanks, that was exactly what I needed.
Re: [SOLVED] Problem w/ Nat Port Forwarding
Posted: 24. Jan 2011, 22:08
by SuperSalad
But I'm correct in that for 4.0.x release it's either in "Advanced" under the VM LAN properties, or
Code: Select all
VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,10.0.2.19,22"
Which adds a <NAT> section to the .vbox VM definition file?
Because I still can't get it to work. I've tried with Windows guests (RDP - 3389) and an Ubuntu Server 10.04 guest (SSH - 22) with no luck. For the Linux guest I get a long pause then
ssh_exchange_identification: Connection closed by remote host
When the Linux guest VM is off, I immediately get
ssh: connect to host localhost port 2223: Connection refused
So, something is going on, or at least half working.
Re: [SOLVED] Problem w/ Nat Port Forwarding
Posted: 16. Feb 2011, 23:50
by slaw
Hi there,
this is my first post and I'm glad that I can help you.
Your problem with
ssh_exchange_identification: Connection closed by remote host error is not connected with VBox - but rather with your Linux config and can be solved by editing /etc/hosts.allow (and/or /etc/hosts.deny) on guest Linux machine. You have to add here IP/subnet of the client's machine as seen by the guest. Simply check /var/log/auth.log on the guest system for lines containing
sshd and find what IP was denied. And save that IP (or subnet) to hosts.allow in a line that starts with:
ALL: (or
sshd: - for ssh connection only).
I've tested these settings and everything was working flawlessly.