01 December 2011

FLOSS: Making Crazy Remote Connections Possible

This is certainly not the only way to do this connection, and very likely not the most efficient, but I found it cool so I had to write it up.  Do you have a similar story?

I have a client with a VPN connection that requires Windows to make that VPN connection, from my office IP address.  Because of this VPN requirement and other clients with similar setups, I keep a Windows virtual machine at the ready, as a VirtualBox Virtual Machine (VM) image.  This VM has its graphical bling set as minimally as possible to help speed connections wherever possible.

Tonight I wanted to do some remote work for this client.  I first connected into my office over VPN using KVpnc, and then over SSH to my office desktop with -X for X11 (graphical) forwarding:
home-shell$  ssh lefty@10.10.10.10 -X
work-shell$


From my office desktop, I was then able to list my VMs
work-shell$  vboxmanage list vms
  XPsp3
  TinyKore-kde 

and boot that VirtualBox version of XP from the command line:
work-shell$  vboxheadless -startvm XPsp3 --vnc --vncpass SomePass &
[1] 6079
Oracle VM VirtualBox Headless Interface 4.1.6_Debian(C) 2008-2011 Oracle CorporationAll rights reserved. 

work-shell$


Using the VirtualBox built-in VNC server on default port 5900 (which I started with --vnc in the above command) and the SomePass password that I set above, I was then able to use VNC to remote into my Windows XP machine (note this is all one line):

work-shell$  xtightvncviewer localhost::5900 -quality 0 -bgr233 -compresslevel 9 -encodings CoRRE

When prompted for the Password, I entered the SomePass as I set when initially starting the VirtualBox VM.  I tried using different -encodings flags for that xtightvncviewer connection, such as  -encodings zlib and -encodings CoRRE and -encodings CopyRect; the default encoding (tight) seemed to well but for rapid screen updates (such as scrolling yum messages), -encodings CoRRE really worked best.

Once on the Windows XP virtual machine, I was then able to start my magical VPN connection and fire up PuTTY, and connect to the remote server for maintenance.

To recap:
  • I connected to work with a VPN
  • then to my office desktop with SSH
  • then I booted the XP virtual machine in headless mode with VNC
  • I then connected from that SSH session to the VNC server on the XP VM
  • From XP I started a VPN connection to a remote client's office
  • I then started PuTTY and connected to the client's Linux server

Are there any crazy connections that you go through that wouldn't be possible without Free Software?

0 comments: