Saturday, January 14, 2012

Living on a Chromebook: Beam me to the USA!

You probably know that I'm a developer at night, but during the day I'm (besides being a developer too) someone who's spending a lot of time at the computer, browsing the web, reading news, listening to music, watching movies, playing games, ... Unfortunately, most of the really cool stuff, like (legal) streaming of the latest episodes of my favorite TV show isn't possible in most countries (I'm talking about you, Austria!). Fortunately, it is indeed possible... in the U.S. If you look at your globus you might notice that Austria is by no means near to U.S. So, no futuristic content streaming for me, right?

Wrong! There's a technology, called VPN, not really meant for bypassing stupid license restrictions, but it does the trick anyway. How? It tunnels all your connections to websites through another server. In our case, "another server" is a server sitting in the U.S., waiting for us to stream our favorite TV show, purchase music in the Android Market and calling friends using Google Voice. You can read more about this technology at Wikipedia, but the only thing that really matters is, that websites (like Hulu and Google) think you're located in the U.S. when you're using an according VPN. There are some more benefits listed here under "Benefits of using a VPN".

The best thing is, you don't have to travel to the U.S. now and set up a server there in order to get U.S.-only content, which would end up in a lot of time, brainpower and money spent. That's the job of services like HideMyAss. They're maintaining a huge set of servers, located all over the world (they even have a server running in small countries like Austria) and offering you to connect via VPN to whatever website and services you like. Depending on your definition of "expensive", HideMyAss is really worth the money. A one month subscription costs approximately $12, ranging up to a one year subscription costing only $80. I for myself, have started with purchasing one month in order to test the service, but since I'm very satisfied with it I'm going to get a one year subscription soon...

For me, the most important thing is Chromebook compatibility. At first, Chromebooks didn't support VPN at all. Now Google is working on supporting various VPN technologies. I'm not sure if this is already available in all versions of Chrome OS, but running Dev Channel Platform version 1412.64.0 I'm happy to tell you that it is possible to connect to HMA! VPNs directly from your Chromebook. And it isn't even a lot of work! Let's take a look at the configuration steps...
  1. Sign up for HMA! I suggest using this link, as I'm getting a little bonus for everyone who signs up using this link. ;)
  2. Order whatever package (one month, one year, ...) you want and wait a few hours until they send you an e-mail with instructions on how to set up HMA! For me, I got the mail after 12 hours. HMA! said it sometimes takes 24 hours to complete your purchase... Be patient. It's worth the wait.
  3. Go here, sign in using your username and password.
  4. Click "PPTP servers" on the left, or use this link.
  5. You can find your credentials under "Login details". Write down your username and password.
  6. Choose a server from "Server list" (one from "North America - United States of America") and write down the "PPTP IP address" (for example, "184.171.165.2")
  7. Click the Connection icon on the upper left (the one you're using for connecting to a WiFi)
  8. Click "Private networks" - "Add private network..."
  9. A dialog pops up asking you for the VPN configuration. It looks like a lot of work, but it's easy if you follow these instructions:
    1. "Server hostname": fill in the "PPTP IP address" you have written down before. This is the IP address of a server maintained by HMA!
    2. "Service name": is any string, describing the connection for you, for example "HMA! US VPN"
    3. "Provider type": is by default "L2TP/IPsec + Pre-shared key". That's fine.
    4. "Pre-shared key": fill in "HideMyAss"
    5. "Username" and "Password" are your "Login details" you've written down before

You can find a screenshot of a correctly filled in dialog at the left. Yours should look similar after completing these steps. Your Chromebook should start connecting to your shiny VPN after you have clicked "Connect". (Note: you can see it is connecting when a little lock is showing up and disappearing again periodically on the lower left of your Connection icon. It is being displayed constantly when you're successfully connected to your VPN.)

You're now ready to test your VPN. Let's start with something simple: www.google.com. It works? Great! Move on to www.hulu.com and enjoy. If visiting Google doesn't work ("This webpage is not available") try disconnecting from your VPN and connecting again. If that doesn't work either, reboot your Chromebook and connect to your VPN again (using the Connection icon - "Private networks..." - "HMA! US VPN", or whatever you have called it before).

I hope these steps helped you get your VPN up and running and consume some U.S.-only content. If you have any problems setting it up, feel free to ask me in the comments and I'll try to help you.

Again, if you plan to get yourself a VPN from HideMyAss, I would love you using this link for signing up, because it's getting me some money. I'm really happy with their service so far. Their support responds within a day, you are at no risk with their 30 day money back guarantee ("for whatever reason"!) and the VPNs are fast enough for using it every day. You can find a speedtest below, the left one being ran without VPN:
Speedtest without VPN
Speedtest with VPN











That's near native speed! Holy crap. However, keep in mind that 1. your results could vary depending on your connection and selected server and 2. if, for example, I visited a website located in Austria, it would load slower than without a VPN.

As of January 14th, 2012 there is a bug making your VPN experience a bit annoying: every 5 minutes or so, it automatically disconnects from your VPN and you can't reconnect unless you log out and in again, or delete your VPN and configure it again. The Chrome OS developers are aware of this problem and you can keep track of this problem here and here. Star this issue in order to get it fixed earlier...
A workaround for now is opening a terminal (Ctrl+Alt+T) and starting an endless ping using ping google.com. This seems to work fine for me.

Tuesday, January 3, 2012

Developing on a Chromebook - Part 3: X-Forwarding, or "Eclipse on a Chromebook"

As I've mentioned in previous posts on this blog, developing on a Chromebook (read, in the cloud) is possible. It's partially imperfect and unstable, but it's possible. But, (unfortunately?), for some of us, there's more than just JavaScript. If you're an Android developer, there's a good chance you need an IDE like Eclipse.

The good news is: it's possible to use Eclipse "on" a Chromebook. The bad news: you need another device. Fortunately, you don't need another laptop which suits your needs and is able to compete with your Chromebook (weight, size, battery). Instead, you need some kind of server. For me, it's my old (read, 5 years or so) computer. You see, hardware doesn't matter too much. You could use an old laptop too. All it needs is a working network connection and enough power to run Eclipse. To justify the expense of a new device, you could use this server for other things, like streaming media, network storage, printing, etc too.

The method I'm talking about is called X-Forwarding / X11-Forwarding. I'm not going into much detail about what it is and how it works, but to cut it short: it forwards an application's GUI over the network from a server to a client (in this case, your Chromebook). That means you only have to install the application on your server, but you are still able to see and control it on your client.

Let's jump into configuration. I'm running Ubuntu Server 11.10. Assuming a plain install, you need to do the following steps:
  1. configure server
    1. sudo apt-get install xauth
    2. set "X11Forwarding yes" in your /etc/ssh/sshd_config 
    3. restart ssh using sudo service ssh restart
    4. set "ForwardX11 yes" in your /etc/ssh/ssh_config
    5. (some applications (read, most written in Java) need "ForwardX11Trusted yes" set in /etc/ssh/ssh_config too)
  2. initiate SSH session from Chromebook
    1. ssh -Y username@server
    2. (sudo apt-get install eclipse-jdt)
    3. eclipse

Important note: usually you would activate X-Forwarding on the client using ssh -X username@server, but for me, it didn't work that way. I guess it's due to Chrome OS and some restrictions. However, be aware that using the -Y parameter might be more insecure than setting everything up the proper way and using -X instead, as someone pointed out in this discussion.

Obviously, there are some disadvantages too. For example, there's no window manager for X11 available in Chrome OS, so every window is being displayed in fullscreen. Without any controls. I hear your laughter, thinking "Ha, no problem! There's Alt+F4!"... Look at your keyboard and think again. There's no F4 on a Chromebook's keyboard. :) You have to hope for every application to display a close button for you. If it doesn't you're still able to switch back to your SSH session and kill the application the hard way (Ctrl+C or killall applicationName).
Another annoying aspect you might face is performance. If your network connection is slow, you might try starting your SSH session using ssh -YC username@server, which compresses all traffic for you. But keep in mind that this could slow down your Chromebook's slow hardware.

And now that you have a server set up, I recommend you to read this article, called "Tips for Remote Unix Work (SSH, screen, and VNC)". Moreover, shellinabox is worth a look. You wouldn't even need to switch your Chromebook into developer mode in order to access your server via SSH. However, you can't use shellinabox for X-Forwarding or most of the tips shown in the previously mentioned article.

Now, go and look for some old hardware you can set up your server on! ;) And don't forget to ask questions in the comments or on Google+...

Want to read more about this topic? Check out the other posts of this series:
Part 1: Chromebook
Part 2: Cloud
Part 4: Ubuntu