Can't access ssh in my VM Centos

This looks like you're using VirtualBox VM with a NAT network (it seems to give the address 10.0.2.15 by default). If so, you need to set up a port forward to access port 22 on the VM from the host.

  1. Open Settings->Network for the VM
  2. Click the little blue arrow next to the Advanced box
  3. Click the box at the bottom labelled "Port Forwarding"
  4. Click the green "+" to add a rule
  5. Add the rule Host IP="127.0.0.1", Host Port="2222", Guest IP="10.0.2.15", Guest Port="22"
  6. From the host, you should be able to "ssh -p2222 127.0.0.1"

This is a bit stupid compared to the way VMWare does NAT. It creates a separate network interface on the host for NAT, so no forwarding is necessary.