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 can't seem to SSH into my CentOS VirtualBox 4.0 running on Windows 7 64-bit. SSHD is running. I've forwarded port 2222 on localhost to the virtual machine (port 22).

enter image description here

The network adapter is NAT because for some reason bridged refuses to start the virtual machine.

Any ideas?

share|improve this question
    
Why did you forward any ports for this? If your virtual network is set up using NAT, your VM has its own IP address (and its own port 22). –  Oliver Salzburg Jan 27 '12 at 10:55
    
@OliverSalzburg Really? I wasn't aware, how would I find the IP? Sorry, I'm quite new at this. –  user1045696 Jan 27 '12 at 11:03
    
@OliverSalzburg If his VM is setup to use NAT networking, then the only way for inbound connections to make it into the VM is via the Port Forwarding Rules. It's no different than if you have a NAT WiFi router at home. Inbound connections cannot get in. How could they? They would have to be addressed to a non-routable address (e.g., 192.168.3.4). –  Fran May 2 '12 at 18:40
    
@Fran: I was confused when I wrote the comment, but I thought I understood the issue when I wrote my answer. Right now - not so sure anymore. –  Oliver Salzburg May 2 '12 at 18:57
add comment

1 Answer

In your screenshot, the host and the guest have the same IP. That doesn't seem right. If you've set your VM to use NAT, it will receive its own IP address. Port forwarding shouldn't be needed (unless you want to be able to connect to a service inside your VM through your hosts networking interface).

To determine your local IP address, run the following command inside a shell on your VM:

ip a
share|improve this answer
    
Hey, here's what ip a spits out: click I'm not entirely sure what to do with this? –  user1045696 Jan 27 '12 at 11:49
    
@Chintan Seems like the network adapter in your VM doesn't get an IPv4 address assigned at all. So either DHCP is disabled on your client, no DHCP server is available (which would be weird, because I assume VirtualBox acts as the DHCPd in this case). –  Oliver Salzburg Jan 27 '12 at 11:54
    
The DHCP server should be enabled. I did some digging, found this: gyazo.com/df040ab2f3227d1c36704baa492cc9dc . So I'd assume the issue is that DHCP is disabled on my client? Any idea how to enable it? I'll keep looking into it, hopefully I find a solution! –  user1045696 Jan 27 '12 at 12:00
    
Looks like I may have fixed it? gyazo.com/6f2d036e110965acb7b46887a7973a77 I assume 10.0.2.15 is the address I want to be sshing into? –  user1045696 Jan 27 '12 at 12:07
    
If anyone finds this in the future and wants a solution, add BOOTPROTO=dhcp to /etc/sysconfig/network-scripts/ifcfg-eth0 –  user1045696 Jan 27 '12 at 12:41
add comment

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.