LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
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.

Notices


Closed Thread
  Search this Thread
Old 09-19-2011, 12:44 PM   #1
dashesy
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=192.168.136.0/24 -redir tcp:22:192.168.136.222:22 -redir tcp:445:192.168.136.222: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,127.0.0.1,2222,192.168.136.222,22", or equivalently use the dialog, then in Cygwin "ssh -v -p 2222 root@127.0.0.1" connects to the port but here is what I get:

Code:
OpenSSH_5.8p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Connecting to 127.0.0.1 [127.0.0.1] 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, 03:18 PM   #2
dashesy
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:
Code:
VBoxManage.exe modifyvm "my server" --natnet1 "192.168.136.0/24"
After this addition, similar to qemu NAT works flawlessly
 
Old 09-25-2011, 02:23 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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.

http://www.linuxquestions.org/questi...arding-903403/
 
  


Closed Thread

Tags
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 09:22 AM
LXer: Install Guest additions and run fullscreen mode on VirtualBox Guest OS | Linux LXer Syndicated Linux News 0 01-17-2010 06:30 PM
problem installing guest additions in Fedora 11 guest (virtualbox) mia_tech Linux - Desktop 9 07-28-2009 01:15 AM
VirtualBox Raw Access, Windows Host, Linux Guest Guitarist88 Linux - Newbie 2 11-14-2008 05:41 PM
VirtualBox Networking (NAT) not working on XP host with Mandriva guest FreeRadical2600 Linux - Newbie 9 10-29-2008 09:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 01:46 PM.

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