Tuesday, November 29, 2011

Virtualbox - Mac Host - Ubuntu Guest - Networking

Messing with this half the day... It's so simple I overlooked it and went down strange Google paths.

This is the simple, straightforward answer to setting up networking for the Guest OS.

You set up two of the 4 possible network adapters before booting up the system. You can change the network settings while it's running and then run "sudo ifdown-a" and "sudo ifup-a", but that doesn't let you add a second adapter.

Set "Adapter 1" as "NAT" - this only gives the GUEST OS outside internet access through the HOST.

Set "Adapter 2" as "Host-only Adapter" - this only gives the HOST access to the

Together, we have what we want, we don't need anything fancy or custom, no bridgets, no scripts. But there is one tiny config setting that needs to be set to use the second adapter...

After you boot up the Ubuntu Linux server and log in you have to set up the second adapter in the interfaces config file because, by default, it only has one.

It will look like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

Now add this to the bottom:

# The primary network interface
auto eth1
iface eth1 inet dhcp

Now reboot.

Now when you run "ifconfig" you should see an ip address under "eth1". That is the IP address you can SSH to from the HOST machine.


No comments: