Tiernan's Comms Closet

Geek, Programmer, Photographer, network egineer…

Building a Cross Compiler for your Raspberry Pi

My main machine at home, known as “The GodBox” is a Dual Processor, Quad Core Xeon 5520 with 60Gb RAM, 2 300Gb 10,000 RPM Western Digital Velociraptor in RAID 0 for boot, 4X1Tb 7200RPM drives for storage, 2 more 300Gb 10,000 RPM drives for “scratch disk” and a couple high(ish) end graphics cards with 3 monitors plugged in… Hence the name, GodBox!

Anyway, The Raspberry Pi, on the other hand, has a 700Mhz processor, 256Mb RAM and not much else… So, if you need to write code for your Pi, and you don’t want to wait a long time to compile, check out this tutorial on how to build a cross compiler for your raspberry pi which will allow you to build your apps on a different machine… I have a college project which the Raspberry Pi will be used for, and i am thinking this will be how i build code.

MicroTik RouterOS VPN Setup

I have been running a MikroTik RouterBoard in the house for a couple of months now (the RB750G) and I am very much loving the thing. But one thing you may need to do is setup VPN connections… Here are some tips on how to create a VPN Server and Client on your RouterBoard.

##Client Setup

to setup a client, you need to do the following:

What does that all do? the first line creates an l2tp-client interface, pointing at “servername” with the username and password set. encryption, etc is enabled… Line 2 then enables the client. Line 3 sets all traffic comming from networkaddress/24 (for example, 192.168.0.1/24) to be sent though the VPN. any traffic going into networkaddress (same example) is not sent though the VPN. Line 4 creates a gateway, for all addresses (0.0.0.0/0) to use the VPN address. finally, NAT Masquerading is enabled on the VPN interface.

there are more advanced things you can set above… some examples I can think of are as follows:

  • There should be no good reason to limit the amount of VPN connections you have… in theory, you could have multiple…
  • for the mangle rule, set the src-address to a single machine in your network. that way, it gets VPN only connections. Also, you could set the dst-address to a single address or network to send only traffic going to a given server though the VPN… Example would be Netflix US traffic to a US VPN server, BBC iPlayer traffic to a UK VPN, etc.
  • the example above uses L2TP, but PPTP, SSTP and OpenVPN are also available.

Server Setup

As mentioned above, L2TP, PPTP, SSTP and OpenVPN servers are available on RouterOs. Details on setting them up are available on MicroTik’s Wiki at the following locations:

SSH Tunneling made simple

Something I do on a regular basis is use the internet while “out and about”. This could be college, which has a semi open network, or it could be a coffee shop, which also usually has a semi open connection. There is also the possibility of using the a mobile internet connection on my iPhone, which can be slow, but at least its only shared with me… Anyway, over on RevSys.com, there is a post SSH Tunneling made simple which shows you how to open an SSH tunnel to your machine somewhere else (could be at home, as is my case, or a VPS/Dedicated server somewhere, or even on Amazon…) and use that for different things… In the case he shows, its for SMTP access. For my case, i am forwarding my local port 3128 to my Microsoft TMG 2010 Server in house on port 8080. Then my system proxy on my laptop is set to use localhost:3128 for all web and HTTPS requests. Very handy. One other tip: Using the -C flag, so your command may look like:

ssh yourname@remotemachine -L 3128:remoteMachine:8080 -C

will compress data between you and the SSH server, which for basic web browsing (HTML, CSS, JS) will make things faster, but for stuff like images, etc, may not work so well… Your Mileage may Vary…

Also, while on the subject of SSH, Linux Journal has an article on Eleven SSH tricks which mentions compression, Encryption Cyphers, X11 Forwarding, Config files and other interesting bits.

VOIP Stuff

I have been very interested in VOIP stuff for the last while now, and finally started looking at implementing it in the house. Here are some links which may be useful. I will do a full post soon.

The main VOIP hardware I use is:

I also use the 3CX software on both my iPhone and Android.

Raspberry Pi Stuff

A couple of months back, I got my hands on a Raspberry Pi, a tiny development board that can run a full copy of Linux, has an HDMI port, a couple of USB ports, Ethernet and a few other little bits and pieces. The full specs, from the Wikipedia Article, are as follows:

  • Operating system: Linux (Debian GNU/Linux, Fedora, and Arch Linux ARM)
  • Power: 2.5 W (model A), 3.5 W (model B)
  • CPU: ARM1176JZF-S (armv6k) 700 MHz
  • Storage capacity: SD card slot (SD or SDHC card)
  • Memory: 256 MByte
  • Graphics: Broadcom VideoCore IV

There have been a few things i have wanted to play with it for but have not implemented all of them yet… still learning… but some interesting projects have come to my attention… here they are, in no particular order:

In all fairness, the Pi makes a lot of ideas possible. with such a small size, and such a cheap price ($25-35), you are only limited by your imagination… Wonder if could i get Windows 8 installed on one of these…

there are also a few interesting things that may make the Pi work more portable…

  • LiPo Rider Pro: takes input from Batteries and Solar Panels and outputs as USB 5V. should run the Pi off solar and batteries for a while… 🙂

Understanding Storage Spaces in Windows 8 and Windows Server 2012

So, Windows Server 2012 and Windows 8 have both RTMed in the last couple of weeks and will be available to the public in the next month or so (September for Server, October for Client). If you are an MSDN Subscriber, you already have Client, and will (hopefully) get server in the next couple of weeks… Fingers crossed… Anyway, one of the interesting features i am waiting for is Storage Spaces Tim Anderson’s Gadget Writing blog has some information on how Storage Spaces works. handy notes on what to do and what not to do. 

Sublime Text 2 with Powershell

My new Favorite cross platform text editor is Sublime Text 2. It works on Windows, Mac OS and Linux, and i am very happy with it. My only problem is the path to start it is not exactly easy to type… So, with the help of PowerShell, my new favorite command line tool on Windows, i added an alias:

Set-Alias subl 'c:\program files\sublime text 2\sublime_text.exe'

I added this to my Microsoft.PowerShell_profile.ps1 file in Documents\WindowsPowerShell folder. If you don’t have one of these files, check out this Computer Performance.Co.UK post on Creating PowerShell profile files and then edit the file and add the line above… Now, I can edit files in PowerShell with Sublime Text 2 by typing:

subl filename

Happy days!

AutoScaling with Amazon

I have a few Amazon EC2 instances running on a project, and one of these instances was known as the Zombie Instance! Every time i killed it, it came back to life a few min later… I found out that i, at some point, set that instance to be in an AutoScaling group. Any time the instance died, Amazon would check and restart the instance. So, how did I kill this undead instance? Check out “Auto Scaling with Amazon EC2 II” on LLOVIZNA’s blog. They had the same issue i had (trying to kill the Auto Scaling group gives an error) and figured out how to do it. Handy stuff. Now the instance is dead, and hopefully it wont come back any time soon… Mind you, When AutoScaling works correctly, it can be very cool indeed!

My new Git Powered Site

So, this site is brought to you by GIT, Jekyll and Magic… here is how i did it…

  • I have a Linux VM running the site. Its an Ubuntu 12.04 server. On that i installed Jekyll.
  • I also have gitolite installed for personal git repos.
  • In the Git Repo for this site, under the hooks directory, I added a post-receive file which I got from here originally.
  • Apache is set to serve the directory that Jekyll produces… That’s what you are reading here.
  • If you are interested, you can find the code and config for this site on my github repo