Port Forwarding

Discussions about using Linux guests in VirtualBox.
Post Reply
U2XS
Posts: 25
Joined: 7. Jun 2009, 18:46
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Slax, DSL, Fedora
Location: Brooklyn, NY

Port Forwarding

Post by U2XS »

I've read the documentation on port forwarding & I'm not sure how to make that work in Windows. Right now, the command that I have for my Linux guest is
"C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" --startvm Ubuntu
Would I then run the command again & type something like this?
VBoxManage modifyvm "Ubuntu" --natpf1 "guestssh,tcp,,2222,,22"
Or would I somehow concatenate it into one line?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Port Forwarding

Post by Perryg »

VBoxManage modifyvm "Ubuntu" --natpf1 "guestssh,tcp,,2222,,22"
Is a command to modify the guest and saves the information to the guest.xml or guest.vbox depending on your version and only needs to be run once (per guest).
U2XS
Posts: 25
Joined: 7. Jun 2009, 18:46
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Slax, DSL, Fedora
Location: Brooklyn, NY

Re: Port Forwarding

Post by U2XS »

That's easy enough. Thanks
U2XS
Posts: 25
Joined: 7. Jun 2009, 18:46
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Slax, DSL, Fedora
Location: Brooklyn, NY

Re: Port Forwarding

Post by U2XS »

I ran the following four commands to open up my FTP, SSH, Telnet & SMTP ports. However when I went to test Telnet & SSH with ports 2222 & 2323 it didn't work. Each command did create a command window which speedily processed some infromation & closed itself.

My guest is Ubuntu 11.04 (Alpha) & I did install OpenSSH Server. Did I miss a step?

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" --modifyvm "Ubuntu" --natpf1 "GuestFTP,tcp,,2121,,21"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" --modifyvm "Ubuntu" --natpf1 "GuestSSH,tcp,,2222,,22"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" --modifyvm "Ubuntu" --natpf1 "GuestTelnet,tcp,,22323,,23"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" --modifyvm "Ubuntu" --natpf1 "GuestSMTP,tcp,,2525,,25"
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Port Forwarding

Post by Perryg »

Did you try giving the forwards their own number?
natpf1,natpf2,natpf3,natpf4 instead of all of them trying to use the same name?
U2XS
Posts: 25
Joined: 7. Jun 2009, 18:46
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Slax, DSL, Fedora
Location: Brooklyn, NY

Re: Port Forwarding

Post by U2XS »

Perryg wrote:Did you try giving the forwards their own number?
natpf1,natpf2,natpf3,natpf4 instead of all of them trying to use the same name?
Hmm, so I tried a few things. I did rename them to 1,2,3,4,etc. I also realized that the "--" before modifyvm was incorrect. However even when the command prompt was accepting the command, it still didn't work. Finally, I realized that the version of Virtualbox I have does have a GUI for this! So it was easy enough then & now it works. I do still wonder why it didn't work with the command line though. Thanks for the help!
Post Reply