This is a fresh install of Ubuntu Server 12.10 running VirtulBox 4.8.2 on a Kubuntu 12.10 host. I have Ubuntu Server running w/ a NAT'ed IP Address (10.0.2.X or something like that). I want to ssh from my Kubuntu laptop to my VBox server so during install I selected OpenSSL Server or whatever the option is. Outside of that selection there is nothing custom done and the system is completely up to date.

So when I try to ssh to that device I get a timeout response and am unable to connect. The service is running on my VM but nothing happens. I also cannot ping the VM either.

Is there something I'm missing? A firewall between my VM and Host? Not quite sure

Thanks for the help in advance,


2 Answers 2


The problem is the NAT. When you are using NAT, VirtualBox basically acts like a router making a subnet, and just like with a normal Router setup you can't access a device on a lower subnet. As I see it you have two options here:

  1. Switch your VM to a "Bridged Adapter" mode(can be done even after an OS is installed) and then Reboot or Renew your Server's IP. Your VM should show up with a normal IP on your Network and then you can easily access it. I usually recommend this for Servers anyway because burying a Server defeats the use of one.

  2. Make a Reverse SSH Tunnel. Basically instead of making a tunnel from your Host to the Guest Server, you do it the other way around. This is a pretty straight forward task and there's a nice HowTo to be found here: http://www.howtoforge.com/reverse-ssh-tunneling, Just use your Host's normal network IP and it should work. A user also posted a nice thing in the comments of the article about SSH Tunnels between 2 PCs with both being behind NATs.

Out of the above I still recommend #1 for obvious advantages to a server setup but if you really want to keep the Server Sandboxed then #2 should work fine.

  • Wow that sounds way complicated in fact almost more work than it should. I keep all of my VMs NAT'd in order to not interfere with anything my clients/customers might be doing or have setup. Is there a reason I can SSH from my Guest Ubuntu Server to my host Kubuntu server without anything changing? I guess I'll have to deal w/ the reverse SSH Tunneling, though was hoping it would be easier
    – jjesse
    Commented Dec 2, 2012 at 2:16
  • In that case I recommend #2. Reverse SSH Tunnels aren't complicated. You just have to make the Port Forwards from the Server in the NAT. It's pretty straight forward, it just means you can't make the SSH connections directly from the host. That's the price of Sandboxing. The whole point to using the NAT is so that Nobody can mess with your VM and your VM can't mess with anybody.
    – japzone
    Commented Dec 2, 2012 at 2:19
  • THanks again, is there a reason I can SSH from guest to host w/o the use a reverse SSH tunnel?
    – jjesse
    Commented Dec 2, 2012 at 14:20
  • Because the Guest is in a Lower Subnet. Just like how you can connect to a website and exchange information, but the site can't connect to you. Basically think of the internet like this; a bunch of doors that are password locked on one side and free to open on the other. You can easily send things out and get replies to those requests but allowing someone to send something in requires you to setup access beforehand. It's pretty much an inherent security feature for the net.
    – japzone
    Commented Dec 2, 2012 at 15:11
  • I'm trying to access my virtual machine while allowing it to have internet access, but if I'm on shared wifi such as at work, school, or a library, I don't want others to be able to ssh into it or see it at all, and I don't want to set up an ssh server on my computer for the same reason. Is there a way to simply allow the host machine to access it while keeping it protected? Additionally, I don't want several machines on the school wifi.
    – jfa
    Commented Nov 4, 2015 at 20:37

You can of course also use port forwarding in virtual box:

  1. Go to the VM settings
  2. Select network
  3. Click Port Forwarding
  4. Fill out a row
    1. Give a useful name like 'SSH'
    2. Leave protocol as TCP
    3. Set Host IP as the host IP (eg:
    4. Set Host Port as something like 10022
    5. Set Guest IP as the IP of the VM
    6. Set Guest port as 22 (or the SSH port)
  5. Connect to the host details (eg:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .