4

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?

4
  • 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). Jan 27, 2012 at 10:55
  • @OliverSalzburg Really? I wasn't aware, how would I find the IP? Sorry, I'm quite new at this. Jan 27, 2012 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, 2012 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. May 2, 2012 at 18:57

1 Answer 1

2

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
5
  • Hey, here's what ip a spits out: click I'm not entirely sure what to do with this? Jan 27, 2012 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). Jan 27, 2012 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! Jan 27, 2012 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? Jan 27, 2012 at 12:07
  • If anyone finds this in the future and wants a solution, add BOOTPROTO=dhcp to /etc/sysconfig/network-scripts/ifcfg-eth0 Jan 27, 2012 at 12:41

You must log in to answer this question.

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