How do I access an Ubuntu VirtualBox guest at a static IP from an OS X host?
- by David Siegel
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.