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
inet 192.168.7.1 netmask 0xffffff00 broadcast 192.168.7.255
vboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
vboxnet2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
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.
- 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.
- 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.
iface eth1 inet static
Save the file and now whenever that guest OS starts up again, it will have the
192.168.56.10 address set for