4

I don't particularly need a "solution" to something, I'd just like to understand more of the landscape here.

So on my CentOS box, I installed a CentOS VM specifically for learning Puppet. When the login prompt appears, it prints a banner saying what IP address can be used to reach it through ssh. In this case, it prints an address in the 10.0.2.0/24 range. From my previous experience, I was immediately skeptical I would be able to reach the VM with that address, and likely not at all without some reconfiguration of the VM.

To confirm, after I logged in I used "ip addr" to see the advertised IP addresses, and it did show that IP address.

Unsurprisingly to me (because I've seen this happen before), neither ssh or ping to that VM from the CentOS host succeeded.

At that point, I closed down the VM and edited the VM settings in VirtualBox, and added a "Host-Only Adapter", and then restarted the VM. I then did "ip addr" again, and in addition to the "10.0.2.0/24" address, it showed an additional IP in the "192.168.56.0/24" range. I was able to ping and ssh to that addr from the host.

I knew that adding the "Host-Only Adapter" would do this, but frankly I don't understand what the "Host-Only Adapter" IS. I'd appreciate some illumination on what's happening here.

What other diagnostics could I show on either the guest or the host that would illustrate that I can or cannot reach the guest through a given IP?

I also note that when I run "ip addr" on the host, I see "10.20.17.142/21" and "192.168.56.1/24". The latter is labeled "vboxnet0", which is the default name given for the "Host-Only Adapter" in the vm settings. From what little I understand about subnetting, as both the host and guest appear to be on the same subnet, at least on that interface (not sure what that means exactly), that explains why I can reach it from the host.

I also note that I can ping BOTH of those addresses from the guest. I can understand it should be able to reach the "192.168.56.1/24" IP, but the fact that it reaches the "10.20.17.142/21" host confuses me, as that's not on the same subnet as the guest.

Again, any illumination you can provide would be useful.

  • 1
    If you run ifconfig on the host machine while the VM is running, you will see a new interface (or possibly just a route - check route -n) has been set up on the subnet of your virtual machine. – DopeGhoti Feb 11 '16 at 23:46
  • if this is an internet connected machine and you want to know which address it will be reached from the outside world, use: wget http://ipinfo.io/ip -qO - – MelBurslan Feb 11 '16 at 23:49
  • 1
    That won't help with LAN IP information; only for determining your WAN endpoint. – DopeGhoti Feb 11 '16 at 23:51
0

A host-only adapter in VirtualBox is almost exactly what it sounds like:

the "host" is the box where you run virtualbox at - so most probably the desktop system your display, mouse and keyboard are connected to.

"host-only" refers to the circumstance that (out of the box) only your host and your vm are connected to this network via a network bridge on the host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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