0

I have added “Host Only Network” as the second network interface on VirtualBox 5.0.24 on Mac. the Guest OS is Centos6. Here are the relevant VirtualBox networks as seen via ifconfig on my Mac:

vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00
    inet 192.168.7.1 netmask 0xffffff00 broadcast 192.168.7.255
vboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:01
vboxnet2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:02
    inet 192.168.59.3 netmask 0xffffff00 broadcast 192.168.59.255

But none of those addresses are recognized on the guest itself (can not ping). So:

  • What is the correct IP address of the guest?
  • Is there a different way to set up a guest networking for being able to SSH into it?

Update I neglected to put the ifconfig output from the guest CentOS guest virtual machine: We just have an auto generated 10.x.x.x address for eth0:

enter image description here

0

1 Answer 1

1

The addresses you are showing from the output on ifconfig on your Mac are pretty irrelevant:

vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00
    inet 192.168.7.1 netmask 0xffffff00 broadcast 192.168.7.255
vboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:01
vboxnet2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:02
    inet 192.168.59.3 netmask 0xffffff00 broadcast 192.168.59.255

What you want to get is the IP address the actual guest OS machine has connected to the second adapter. You would do this by logging in to the guest OS itself and somehow checking the network settings there. You didn’t identify your OS anywhere, but this would vary from machine to machine.

  1. Linux: If you are running some Linux variant as a guest OS, login to that OS and type in ifconfig and check the list of addresses there. The address should be under the interface info for eth1. Or you can make your life easier and just type in ifconfig eth1 to just get the interface info specific to that interface. The address should be something in the 192.168.56.x range of addresses.
  2. Windows: If you are on Windows, unsure of the specifics but the general concept is the same: You would need to get the IP address associated with the second network interface port.

But in general you would not see that IP address via ifconfig from the terminal on your Mac OS X machine.


If you are running Linux and your Linux guest VM doesn’t have any IP address, then login to that machine and run this command:

sudo ifconfig eth1 192.168.56.10 netmask 255.255.255.0 up

That will temporarilly set eth1 to use the IP address 192.168.56.10 until that guest VM is rebooted or shut down and restarted. Once that command is run you should be able to SSH into 192.168.56.10 without a problem.

To allow the guest Linux OS to get an IP address each time it starts up, you would need to set similar values in your network interfaces config. On Ubuntu you would do that by opening up /etc/network/interfaces for editing like this; using nano in this example but feel free to use whatever text editor you feel comfortable with:

sudo nano /etc/network/interfaces

And then add this bit of configuration info for eth1 right at the bottom of that config:

# The local hostmachine access interface.
auto eth1
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0

Save the file and now whenever that guest OS starts up again, it will have the 192.168.56.10 address set for eth1.

2
  • I had forgotten to add the guest ip info. They are not much helpful as you can see from the updated OP. Commented Jul 22, 2016 at 7:37
  • Updated the OP: the Guest OS is Centos6. I don't know exactly what to do there: my guess is to copy sysconfig/network-scripts/ifcfg-eth0 to a new file ifcfg-eth1. Then change the name to eth0 and give it a different uuid. Beyond that not sure. Commented Jul 22, 2016 at 17:13

You must log in to answer this question.

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