Translate

Thursday, January 16, 2014

SSH VitualBox VMs on NAT Adapter

If you want to SSH your VM from HOST Machine then follow the instructions.
I'm expecting that you have already added VM in your VirtualBox.
1) Run your VM machine and open terminal and run command ifconfig .
You will see the output something like this:

eth0      Link encap:Ethernet  HWaddr 08:00:27:b3:78:56 
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feb3:7856/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:79 errors:0 dropped:0 overruns:0 frame:0
          TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:29524 (29.5 KB)  TX bytes:16305 (16.3 KB)


lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:26 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1748 (1.7 KB)  TX bytes:1748 (1.7 KB)

Now copy inet addr  from output:
1=> 10.0.2.15
2=> 127.0.0.1


2) Now Shutdown your VM and open Virtual Box =>Right Click =>Settings =>Network

3) Click on port forwarding:




4) Insert New Rule by clicking on + and put Host IP last inet addr 127.0.0.1 
 and Host Port 2222 (or 2223,2224... and so on for more than one machine) Guest IP First Inet addr that is 10.0.2.15 and Guest Port 22

Click => OK

5)Run your VM, Open Terminal and Run this command sudo apt-get install openssh-server   to install Openssh. 

6) Now open Putty and put the Server name and port number  :





Click Open  and it's Done Enter your Username and Password, your Virtual Machine is Ready to use :)

No comments:

Post a Comment