Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.


Closed Thread
  Search this Thread
Old 09-19-2011, 11:44 AM   #1
LQ Newbie
Registered: Aug 2011
Posts: 12

Rep: Reputation: Disabled
VirtualBox NAT to access Linux server as guest

I asked this question in networking, but it seems more appropriate in this forum.
I have a Linux server with static IP address, and I want to SSH/SMB to it.
In qemu it is easy with "-net user,net= -redir tcp:22: -redir tcp:445:"

VirtualBox Host-only adapter also works after setting static IP address to it in the same network. Both SSH and SMB work fine in Windows7 host, but then it may conflict with my network, so I prefer using NAT instead and connect to localhost.

In Windows7 host if I do "VBoxManage.exe modifyvm "my server" --natpf1 "guestssh,tcp,,2222,,22", or equivalently use the dialog, then in Cygwin "ssh -v -p 2222 root@" connects to the port but here is what I get:

OpenSSH_5.8p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Connecting to [] port 2222.
debug1: Connection established.
debug1: identity file /home/ehsan/.ssh/id_rsa type -1
debug1: identity file /home/ehsan/.ssh/id_rsa-cert type -1
debug1: identity file /home/ehsan/.ssh/id_dsa type -1
debug1: identity file /home/ehsan/.ssh/id_dsa-cert type -1
debug1: identity file /home/ehsan/.ssh/id_ecdsa type -1
debug1: identity file /home/ehsan/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
Since qemu as well as VirtualBox host-only adapter both work fine, SSH server (and root SSH access) should be working fine.
I tried turning off the firewall/add rules but it has same result.

I appreciate any insight, solution for similar problems, thanks
Old 09-19-2011, 02:18 PM   #2
LQ Newbie
Registered: Aug 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
I found the solution, here is the documentation.
For the static IP address because my static IP is not the default I had to specify the NAT network, it is not something with a dialog option so the only way would be through this:
VBoxManage.exe modifyvm "my server" --natnet1 ""
After this addition, similar to qemu NAT works flawlessly
Old 09-25-2011, 01:23 PM   #3
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Closed Thread

nat, virtual box

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem installing guest additions on virtualbox Centos 5.5 64bit guest eljay313 Linux - Virtualization and Cloud 1 09-03-2010 08:22 AM
LXer: Install Guest additions and run fullscreen mode on VirtualBox Guest OS | Linux LXer Syndicated Linux News 0 01-17-2010 05:30 PM
problem installing guest additions in Fedora 11 guest (virtualbox) mia_tech Linux - Desktop 9 07-28-2009 12:15 AM
VirtualBox Raw Access, Windows Host, Linux Guest Guitarist88 Linux - Newbie 2 11-14-2008 04:41 PM
VirtualBox Networking (NAT) not working on XP host with Mandriva guest FreeRadical2600 Linux - Newbie 9 10-29-2008 08:12 AM > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 07:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration