Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a web developer and want to move away from using XAMPP on my machine for developing. I'd like to have my own development server however don't have the hardware so I'm setting one up with VirtualBox. I've gone ahead and installed Ubuntu 12.04.

I've got enough server management knowledge to get by however I'm having trouble wrapping my head around how I can connect to the VM through my host machine. I'd at least like to be able to access it on port 80 (HTTP) and 22 (SSH). I can access it through VirtualBox but eventually I'd want this to be headless and use PuTTY to connect.

From Google'ing, it seems I need two adapters on the VM: a NAT so it can connect to the internet, and a host only adapter so my host machine can connect to the VM. At the moment this is my network configuration in VirtualBox showing my two adapters:

Screenshot #1 Screenshot #2

Of course, I also need to know the IP of the machine so I can connect to it. Running ifconfig brings me this:

Screenshot #3

I've circled in red the IP address which I think I should be using to connect to the VM. When I try to start an SSH session on this IP and port 22 though, the connection times out. I know it's not a SSH problem because I can run ssh inside the VM just fine. Also, if it's relevant, I can ping from inside the VM so NAT is working.

What could I be missing here and what do I need to do to be able to access my VM from my host machine?

Edit: To expand a bit, if I use port forwarding for SSH I can successfully connect, however I'd rather set up the host only networking so I don't have to worry about forwarding ports and the VM appears to be on its own IP.

share|improve this question

migrated from Jan 14 '14 at 19:52

This question came from our site for system and network administrators.

can you also post a screen of your PC's ipconfig in full where we can see the virtual host adapter. – AzkerM Jan 14 '14 at 20:02
Based on ifconfig showing just eth0 and not an eth1 entry, I'd say the second adapter you have in the VM settings hasn't been configured/activated within the guest OS. Run ifconfig -a and see if eth1 appears. – LeoB Jan 14 '14 at 20:06
You can also try using just a single adapter and putting it in 'bridged' mode. In that case it should behave as if it was another PC on your network. – brm Jan 14 '14 at 20:44
@LeoB is right. The interface is the NAT interface, which isn't reachable from your host. The guest should have another interface for the host-only network, which is reachable from the host. You need to figure out why your guest hasn't configured its second interface. – Kenster Jan 16 '14 at 18:56

Make sure your network adapter1 attached to Bridged in network settings so that the corresponding virtual machine will act as separate machine in LAN. After changing it you will be able access the virtual machine from your host machine.

Try learn about networking with virtual environment. :)

share|improve this answer

Change the adapter setting from "NAT" to "Bridged".

The address is the NAT interface; in order to access from local network you need something that starts with 192.168.X.X (after you have activated the bridged mode). 192.168. is your internal network and only accessible from LAN.

Run ifconfig (ifconfig | less if you don't have a scrollable terminal) press Enter per line and press q to exit the output) in the terminal of the guest OS (Ubuntu server) and you should see the new adapter with the internal 192.168.X.X IP address. Now if you enter that into the URL field of your host OS's web browser you should get the "It works!" page.

share|improve this answer
Thanks for the edit. I am new to stackexchange still and this was the first answer I've given and was lazy and in a hurry so i didn't look into formatting it properly, and for that I apologize. Thanks again for making it more clear and i hope it helps someone. – Sal Bruno Apr 28 at 17:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.