How do I access an Ubuntu VirtualBox guest at a static IP from an OS X host?

Posted by David Siegel on Super User See other posts from Super User or by David Siegel
Published on 2010-12-19T22:34:16Z Indexed on 2012/03/20 23:32 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

How does one configure an Ubuntu guest to use a static IP that's visible to an OS X host, and ensure that the static IP is independent of the host's network configuration? I previously used bridged networking for my guest, but I'm constantly moving my host between networks so the guest IP is always different.

First, I tried setting the guest network configuration to NAT and forwarding host port 1022 to guest port 22, so I could at least ssh to a fixed address (localhost:1022):

$ VBoxManage setextradata "Ubuntu Server" "VBoxInternal/Devices/e1000/0/LUN#0/Config/SSH/Protocol" "TCP"
$ VBoxManage setextradata "Ubuntu Server" "VBoxInternal/Devices/e1000/0/LUN#0/Config/SSH/GuestPort" 22
$ VBoxManage setextradata "Ubuntu Server" "VBoxInternal/Devices/e1000/0/LUN#0/Config/SSH/HostPort" 1022

Then,

$ ssh localhost -p 1022
ssh: connect to host localhost port 1022: Connection refused

But this didn't work (guest has no network access with NAT and OS X refused the connection, as you can see).

I'd love a general solution that would let me communicate with my guest at a fixed IP.

© Super User or respective owner

Related posts about osx

Related posts about networking