Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 127.0.0.1 inside the VM just fine. Also, if it's relevant, I can ping google.com 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 serverfault.com Jan 14 at 19:52

This question came from our site for professional 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 at 20:02
2  
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 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 at 20:44
    
@LeoB is right. The 10.0.2.15 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 at 18:56

1 Answer 1

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. :)

http://www.dedoimedo.com/computers/virtualbox-network-sharing.html

share|improve this answer

Your Answer

 
discard

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.