Setting up port forwarding for 7000 appliance VM in VirtualBox
By uejio on Apr 05, 2012
I've been using the 7000 appliance VM for a lot of testing lately and relied on others to set up the networking for the VM for me, but finally, I decided to take the dive and do it myself. After some experimenting, I came up with a very brief number of steps to do this all using the VirtualBox CLI instead of the GUI.
First download the VM image and unpack it somewhere. I put it in /var/tmp. Then, set your VBOX_USER_HOME to some place with lots of disk space and import the VM:
VBoxManage import /var/tmp/simulator/vbox-2011.1.0.0.1.1.8/Sun\ ZFS\ Storage\ 7000.ovf
(go get a cup of tea...)
Then, set up port forwarding of the VM appliance BUI and shell:
First set up port as NAT:
VBoxManage modifyvm Sun_ZFS_Storage_7000 --nic1 nat
Then set up rules for port forwarding (pick some unused port numbers):
VBoxManage modifyvm Sun_ZFS_Storage_7000 --natpf1 "guestssh,tcp,,4622,,22"
VBoxManage modifyvm Sun_ZFS_Storage_7000 --natpf1 "guestbui,tcp,,46215,,215"
Verify the settings using:
VBoxManage showvminfo Sun_ZFS_Storage_7000 | grep -i nic
Start the appliance:
$ VBoxHeadless --startvm Sun_ZFS_Storage_7000 &
Connect to it using your favorite RDP client. I use a Sun Ray, so I use the Sun Ray Windows Connector client:
$ /opt/SUNWuttsc/bin/uttsc -g 800x600 -P <portnumber> <your-hostname> &
The portnumber is displayed in the output of the --startvm command.(This did not work after I updated to VirtualBox 4.1.12, so maybe at this point, you need to use the VirtualBox GUI.)
It takes a while to first bring up the VM, so please be patient. The longest time is in loading the smf service descriptions, but fortunately, that only needs to be done the first time the VM boots. There is also a delay in just booting the appliance, so give it some time.
Be sure to set the NIC rule on only one port and not all ports otherwise there will be a conflict in ports and it won't work.
After going through the initial configuration screen, you can connect to it using ssh or your browser:
ssh -p 45022 root@<your-host-name>
BTW, for the initial configuration, I only had to set the hostname and password. The rest of the defaults were set by VirtualBox and seemed to work fine.