HoloLens – Some analysis

22/1/15 11:00 Updated with specs from [6], [7], [8], [9], a comment on resolution vs FOV, and an update on the HPU location from [12].

HoloLens blows me away with its possibilities. I love my Oculus Rift DK2, and Virtual Reality is perfect for when you want to just concentrate on the computer world, but I’ve always been keen to see a good Augmented Reality solution. HoloLens may be it – check it out at [5].

There had been rumours of MS working on something like this for a while – for example patent applications have been filed. [1][2] But no-one seemed to expect such a mature offering to be announced already, and with a possible early release in July 2015, with wider availability Autumn 2015 when Windows 10 is released. If the HoloLens, with the Windows 10 Holographic UI, deliver as announced then I’ll be buying.

Speaking of which, for all Microsoft’s talk of “Hologram” this and “Hologram” that, as far as I can see no holograms are being used. Instead, “Hologram” here is MS marketing speak for Augmented Reality. Their use of the word is innaccurate and misleading, but frankly is also more understandable to normal consumers, so it’s entirely understandable.

Figure 1: HoloLens

With that out of the way, here’s a bit of analysis of the HoloLens and the Windows Holographic UI. Note that I haven’t seen or touched one of these in person, so take everything with a big pinch of salt….


There are two sets of output supported – a “Holographic” display, and Spatial Audio.



Display type

The most stand-out feature is the “Holographic” display. This appears to be using an optical HMD with some kind of waveguide combiner. That’s what those thick lenses are. This is also touched on in the MS patent filing [2].

Focal length

An important question is what the focal length is set to? Does it vary? To explain the importance of this let’s do a quick experiment. Put your hand out in front of you. Look at it, and you’ll notice the background gets blurry. Look at the background behind your hand – now your hand gets blurry. That’s because the lenses of your eyes are changing to focus on what you’re looking at.

If the focal length on the display is fixed, then the display will be out of focus some of the time. Looking at write-ups, people appear to have used the display at ranges from 50cm up to several metres – and with no comments about blurry visuals. It appears therefore that the optics are somehow either changing the focal length of the display, or are “flattening” the world at large, so that your eyes don’t need to change focal length between short and long ranges.


The waveguide is a way to shine light into your eyes, but if the world outside is too bright then you would have problems seeing the display. Therefore the front screen is tinted. A question is how much it is tinted – too little and you won’t be able to see the display in bright conditions, and too much and you won’t be able to see the outside world in darker conditions. It’s possible they’re photochromic and get darker when exposed to bright light.


I’ve attempted to estimate the dimensions of the display, but these should be taken with a massive pinch of salt. See the Maths section below for where I got the numbers from. My estimate is that the display, per eye, is around 5.6cm wide and 4cm high, and are 1-2.1cm away from the users’ eyes. Given that, that equates to approximately 80-120 degrees vertical Field of View, and 100-140 degrees horizontal field of view. If accurate, then that’s pretty impressive, and is broadly on par with the Oculus Rift.

Since the initial presentation, other write-ups have implied my initial estimate was wildly optimistic. [6] asserts 40×22 degrees, whereas [9] provides two estimates of 23 degrees and 44 degrees diagonal. Descriptions state that the display appears to be quite small – much smaller than that of the Oculus Rift DK2.


I don’t have any information on the resolution of the display. Microsoft have stated “HD” however that can mean many things – for example is that HD per eye, HD split between the two eyes? It should be noted as well that HD is pretty rubbish resolution for a display with a large field of view – put your face right next to your laptop or tablet screen and see how pixellated things suddenly look. There are some tricks that could be done if eye tracker is being used (see the Eye Tracker section) to greatly improve apparent resolution.

The write-ups I’ve seen implied that resolution wasn’t bad at all, so this will be something to keep an eye on. [6] asserts somewhere between 4Mpx (2.5k) and 8Mpx (4k).

It should be noted that the human eye has around a 0.3-0.6 arc-minute pixel spacing, which equates to 100-200 pixels per degree.[10] The “Retina” display initially touted by Apple was around 53 pixels per degree. [11]

Spatial Audio

The audio aspect of gaming and computers in general has been quite poor for a while now. The standard is stereo, maybe with a subwoofer in a laptop or PC. Stereo can give you some hints about location, but full 5.1 surround sound has been a rarity for most PC users. There are some expensive headphones which support it, but these don’t work properly when you turn your head away from the screen – not ideal with a head-mounted display. It’s notable therefore that HoloLens supports spatial audio right out of the box.

With spatial audio DSPs are used to simulate surround sound, and furthermore it will take into account the direction you’re facing. It’s amazing how useful this is for understanding your surroundings – a lesson that Oculus has also learnt with their latest prototypes of the Oculus Rift.

Reports from the HoloLens imply it’s using some kind of speaker(s) rather than headphones. Questions remain about how directional the sound is (i.e. can other people hear what you’re hearing), how loud the audio is, and how good the fidelity is.


The HoloLens appears to be festooned with sensors, which makes sense given that it is supposed to be a largely standalone device.

Outward facing cameras

Either side of the headset are what look like two cameras. Alternately they may be a camera and an LED transmitter, as used by the MS Kinect. Either way, these cameras provide two sets of information to the computer. Firstly they detect the background and must provide a depth map of some kind – likely using similar techniques and APIs to the Kinect. Secondly, they detect hand movement and so are one of the sources of user input.

The background detection is used for ‘pinning’ augmented reality to the real world – when you turn your head you expect items in the virtual world to remain in a fixed location in the real world. That’s really hard to do, and vital to do well. The simplest way to do it is through the use of markers/glyphs – bits of paper with specific patterns that can be easily recognized by the computer. HoloLens is doing this marker-less, which is much harder.Techniques I’ve seen use algorithms such as PTAMM to build a ‘constellation’ of edges and corners, and then lock virtual objects to these.

Reports seem pretty positive about how this works, which is great news. A big question though is how it works in non-ideal lighting – how well does it track when it’s dark/dim or very bright, there’s moving shadows, etc. For example, what if you’re in a dim room with a bright TV running in the background, casting a constantly changing mix of light and dark around the room?

As mentioned, the cameras are also used for hand tracking. The cameras are very wide angle apparently, to be able to watch hands in a wide range of movement, however many questions remain. These include how well the tracking works when hands cross over, become fists, and turn. Some finger tracking must be performed judging by the click movement used in many of the demos – are all fingers tracked? And how is this information made available to developers.

Eye tracker

During some of the demos the demonstrators have said that the HoloLens can tell where you’re “looking” – indeed that is used extensively to interface with the UI. This may be based on just the orientation of the head, or some reports seem to imply that there’s actual eye tracking.

If there is eye tracking, then there’s likely cameras (possibly in that protuberance in the center) tracking where the user’s pupils are. That would be very cool if so, as it provides another valuable interface for user input, but it could also provide even more.

When tracking the pupil, if the display can ‘move’ the display to different parts of the waveguide, then the display could do this to always provide higher resolution display at the location you’re looking at, without having to waste the processing power of having a high resolution over the whole display. Thus you could get an apparently high resolution over a broad field of view, with a display that only actually displays a high resolution over a small field of view.

Also, by analysis of how the pupils have converged, the computer can judge how far away your looking. For example – put your hand out in front of you and focus on one finger. Move the hand towards and away from your face, and you’ll feel your eyes converging as the finger gets closer – watch someone else’s eyes and you’ll see this clearly. If the computer can judge how far away you’re looking then it could change the focal length of the display itself, so that the display still appears in focus. It could also provide this information to any APIs – allowing a program to know for example which object the user is looking at when there’s a stack of semi-transparent objects stacked behind each other.


A microphone is built-in, which can be used both for VoIP such as Skype, and also as a source of user input using Cortana or similar. Questions include quality, and directionality – will the microphone pick up background noise?

Positional sensors

The headset obviously detects when you move your head. This could be detected by the cameras, but the latency would likely be too large – Oculus have found latency of 20ms is a target, and anything over 50ms is absolutely unacceptable. Therefore there are likely gyros and accelerometers to quickly detect movement. Gyros drift over time, and while accelerometers can detect movement they become innaccurate when trying to estimate the net movement after several moves. Therefore it’s likely the external cameras are periodically being used to recalibrate these sensors.

Given that this headset is supposed to be standalone, it’s possible the headset also includes GPS and WiFi for geolocation as well.


I would be amazed if HoloLens doesn’t include Bluetooth support, which would then allow you to use other input devices, most notably a keyboard and mouse. Using a mouse may be more problematic – you need to map a two dimensional movement into a three dimensional world, however mice are vastly more precise for certain things.

Processing unit

One surprise in the launch was that no connection to a PC/laptop was needed. Instead, the HoloLens is supposed to be standalone. That said, all the computing isn’t done in the handset alone. According to [4] there’s also a box you wear around your neck, which contains the processor. Exactly what is done where – in the headset or the box – hasn’t been described, but we can make some educated guesses. And all this is directly related to the new Holographic Processor Unit (HPU).


Latency is king in VR/AR – head movement and other inputs need to be rapidly digested by the computer and updated on the display. If this takes longer than 50ms, you’re going to feel ill. Using a general-purpose CPU, and graphics processor unit (GPU) this is achievable but not easy. If your CPU is also busy trying to understand the work – tracking hand movements, backgrounds, cameras, etc – then that gets harder.

Therefore the HPU seems to be being used to offload some of this processing – the HPU can combine all the different data inputs and provide them to applications and the CPU as a simple, low bandwidth, data stream. For example, rather than the CPU having to parse a frame from a camera, detect where hands are, then identify finger locations, orientation, etc, the HPU can do all this and supply the CPU with a basic set of co-ordinates for each of the joints in the hands.

Using a specialist ASIC (chip) allows this to be done fast, and in a power-efficient manner. The HPU does a small number of things, but does them very very well.

I mentioned bandwidth a moment ago, and this provides a hint of where the HPU is. Multiple (possibly 4-6) cameras at sufficiently high frame rates result in vast amounts of data being used every second. This could be streamed wirelessly to the control box, but that would require very high frequency wireless which would be wasteful for power. If, however, the HPU is in the headset then it could instead stream the post-processed low-bandwidth data to/from the control box instead.
Where to put the GPU is a harder question – a lot of data needs to be sent to the graphics memory for processing, so it’s likely that the GPU is in the control box, which then wirelessly streams the video output to the headset.

Since my writeup, [12] has come out which states that in the demo/dev unit they used the HPU was actually worn around the neck, with the headset tethered to a PC. It’s unknown what this means for the final, release, version, but it sounds like there’s a lot of miniaturisation and optimisation needed at the moment.

Other computers

While the HoloLens has been designed to be standalone (albeit with the control/processor box around your neck), a big question is whether it will support other control/processor boxes – for example will it be possible to interface HoloLens with a laptop or PC. This would allow power users willing to forego some flexibility of movement (depending on wireless ranges) to use the higher processor/GPU power in their non-portable boxes. This may require some kind of dongle to handle the wireless communication – assuming some non-standard wireless protocols are being used, possibly at a non-standard frequency – e.g. the 24GHz ISM band instead of the 2.4GHz used for WiFi and Bluetooth, or the 5.8GHz used for newer WiFi. My hope is that this will be supported.


Windows 10 Holographic UI

Windows 10 will support HoloLens natively – apparently all UIs will support it. This could actually be a lot simpler to implement than you’d imagine. Currently, each window on Windows has a location (X,Y) and a size(width,height). In a 3D display, the location now has to have a new Z co-ordinate (X,Y,Z), and a rotation around each axis (rX, rY, rZ). That provides sufficient information to display windows in a 3D world. Optionally you could also add warps to allow windows to be curved – that’s just a couple of other variables.

Importantly, all of this can be hidden from applications unless they want the information. An application just paints into a window, which Windows warps/transforms into the world. An application detects user input by mouse clicks in a 2D world, which Windows can provide by finding the intersection between the line of your gaze and the plane of the window.

So most applications should just work.

Furthermore, as the HoloLens will be using Windows 10, maybe it’s more likely that other platforms (e.g. laptops) also running Windows 10 will be able to interface with the headset.


That said, many developers will be excited to operate in a 3D world, and that’s where the APIs come in. The Kinect libraries were a bit of a pain to work with, so hopefully MS have learnt some lessons there. The key thing will be to provide a couple of different layers of abstraction for developers, to allow devs the flexibility to do what they want, but have MS libraries do the heavy lifting when possible. MS hasn’t a great history of this – with many APIs not providing easy access to lower level abstractions, so this will be something to watch.

It will also be interesting to see how the APIs and Holographic UI interoperate with other head mounted displays such as the Oculus Rift. Hopefully some standards can be defined to allow people to pick and choose their headset – there are some use cases that VR is better for than AR, and vice versa.


As ever with an announcement like this, there are many questions. However it’s impressive that Microsoft felt the product mature enough to provide journalists with interactive (albeit tightly scripted) demonstrations. Some of the questions, and things to look out for, include:-
– What is the actual resolution, Field of View, and refresh rate?
– Is there really eye tracking?
– How well does the AR tracking work, especially in non-ideal lighting?
– What is the battery life like?
– How well does the Holographic Interface actually work?
– What is the API, and how easy is it code against?
– What is the performance like, playing videos and games for example – given that games are very reliant on powerful GPUs?
– Can the headset be used with other Windows 10 platforms?
– Can other headsets be used with the Windows 10 Holographic UI?
– Patent arsiness: MS has filed several recent patents in this space, are they going to use these against other players in this space, or are they primarily for defensive use?

Some Maths

You may wonder how I came up with the estimate of Field of View. For source material I used several photos, some information on Head Geometry, and a bit of trigonometry.

Figure 2: HoloLens Front Dimensions
Figure 2: Front view – note estimated size in pixels
Figure 3: Worn
Figure 3: Worn view – note alignment with eyes
Figure 4: Side view
Figure 4: Side view – note distance of lenses vs nose

Firstly, by looking at the photos in figures 2, 3, and 4 I estimated the following:-
– The display (per eyes) was around 110×80 pixels
– The display runs horizontally from roughly level with the outside of the eye, and is symmetrical around the pupil when looking dead ahead
– The display is somewhere between halfway between the depression of the nose between the eyes (sellion) and the tip of then nose, and the tip.

From this, we can get the following information, using the 50th percentile for women:-
– Eye width: 5.6cm (#5-#2 in [3], assuming symmetry of the eye around the pupil)
– Screen distance: 1cm to 2.1cm (#12-#11 in [3])

Figure 5: Trigonometry
Figure 5: Trigonometry

Given the 110×80 pixel ratio, that gives a height of around 4cm. Using the simple trig formula from figure 5, where tan X = (A/2)/B we can punch in some numbers.

Horizontally: A = 5.6cm, B=1 to 2.1cm, therefore C=70.3 to 53 degrees
Vertically: A=4cm, B=1 to 2.1cm, therefore C=63.4 to 43.6 degrees

Note that the field of view is 2 x C.

[9] provides a different estimate of the size of the display: “A frame appears in front of me, about the size of a 50-inch HDTV at 10 feet, or perhaps an iPad at half arm’s length.” This results in the following estimates:-
– 50-inch (127cm) (A) at 10 feet (305cm) (B) => C = 11.8 degrees diagonal
– iPad (9.7 inch, 24.6cm) (A) at half arm’s length (60cm/2) (B) => C = 22.3 degrees diagonal

[6] estimates 40×22 degrees, 60Hz 4Mpx(2.5k)/8Mpx(4k)

[1] http://en.wikipedia.org/wiki/Optical_head-mounted_display#Microsoft
[2] http://appft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PG01&p=1&u=%2Fnetahtml%2FPTO%2Fsrchnum.html&r=1&f=G&l=50&s1=%2220120293548%22.PGNR.&OS=DN/20120293548&RS=DN/20120293548
[3] Head Dimensions http://upload.wikimedia.org/wikipedia/commons/6/61/HeadAnthropometry.JPG
[4] http://www.theverge.com/2015/1/21/7868251/microsoft-hololens-hologram-hands-on-experience
[5] http://www.microsoft.com/microsoft-hololens/en-us
[6] http://www.reddit.com/r/DigitalConvergence/comments/2t7ywy/what_we_know_about_microsofts_hololens_announced/
[7] https://forums.oculus.com/viewtopic.php?f=26&t=19490#p238700
[8] http://www.reddit.com/r/oculus/comments/2t74sf/microsoft_announces_windows_holographic_ar/cnwsyny
[9] https://www.yahoo.com/tech/i-try-microsofts-crazy-hololens-108777779824.html
[10] http://en.wikipedia.org/wiki/Visual_acuity#Physiology
[11] http://en.wikipedia.org/wiki/Retina_Display#Models
[12] http://www.cnet.com/uk/news/microsofts-hololens-is-no-joke-my-reality-augmented-with-skype-minecraft/

C# on BB10

I recently managed to get a C# application running on a BB10 device, using a port of the mono interpreter – monoberry (https://github.com/roblillack/monoberry). The process was a little painful, mainly due to a lack of documentation, so I thought I’d walk people through the process.

I started from a virgin build of Ubuntu 12.04 – below are the steps I followed…


Prior to installing monoberry, you need to download and install the BB10 NDK. By default, this will install into /opt/bbndk/

A number of packages are required for the install. After a little trial and error, the below is, I think, sufficient.

$ sudo apt-get install autoconf automake libtool git mono-complete gettext openjdk-7-jre g++ libglib2.0-dev libfontconfig1-dev

Building monoberry

Monoberry is stored on github, and can be downloaded and installed as follows. Note that a number of other libraries are downloaded, via .gitmodules, including a fork of mono – I’m not sure how out of date this fork may be.

$ git clone git://github.com/roblillack/monoberry.git
$ cd monoberry
$ make 
$ sudo make install

Configuring monoberry

You need to setup the rc file (~/.monoberryrc) and copy the debug token bar file.

1) RC file
The init file should be created as ~/.monoberryrc. This is made up of two parts, a [core] sections and a list of [device.xxx] sections. These are documented here: http://burningsoda.com/software/monoberry/

For reference, below is my file with a little obfuscation. I have a simulator (sim) and Dev Alpha (dev):-

author_name = ABCDEF
nativesdk = /opt/bbndk/
debug_token = /home/ian/.monoberry/debugtoken.bar

arch = armle-v7
ip =
password = devicepassword
pin = 1234FFFE

arch = x86
ip = 
password = devicepassword
pin = 1234ffff

2) Debug token
In order to do the majority of interactions with devices, using monoberry (wrapping some NDK tools), a debug token needs to be installed. The method I used was as follows – this is not necessarily optimal, but it worked.

Firstly, follow the standard RIM instructions to install the PBDT and RDK files from RIM, and turn them into signing keys, inside the Momentics QNX IDE. Then, within the IDE, go to Window->Preferences->BlackBerry->Signing and click on the debug token you want. If one isn’t present, follow the RIM instructions to create a debug token and deploy it to the devices. Click on “Details” and copy the Author and Author Id fields into the above monoberryrc file.

Next, go to the path given for that debugtoken.bar file, and copy it into the path/location given in the monoberryrc file. If you’ll want to sign files in the future, copy the Author.p12 file (the location can be found in the above Preferences panel) to ~/.rim/author.p12.

Building your first app

The sample apps have .csproj files, rather than makefiles. These can be built using either monodevelop or xbuild. To build:-

$ xbuild paint.csproj /p:Configuration=Release

If you get errors, especially if they’re related to missing references, it’s probably because there’s either a path issue or a missing reference. To fix, I recommend opening the .csproj in monodevelop, and fixing the references. The most likely contender here is a missing libblackberry.dll – right click on References, select Edit References, then browse to the dll and add it.

Deploying the app

To run the app on a target device:-

$ cd APPNAME/bin/Release/
$ monoberry debug APPNAME.exe DEVICE
  [where APPNAME is the name of the built .exe, and DEVICE is the device/sim to run on]

The exe will get packaged into a bar, and uploaded. You should see a “result::success” following by a “Sending Request: Launch” and a couple more steps.

If you see:-

  • result::failure 881: application author does not match debug token author: Most likely the author_name in ~/.monoberryrc doesn’t match that in the debug token (unzip the debug token, and look in the META-INF/MANIFEST.MF file for the line Package-Author: )
  • Other errors involving the debug_token – check that the same debug token is on the device as ~/.monoberry/debugtoken.bar and that the Package-Author in the bar = author_name in the rc, and that Package-Author-Id = author_id.

Additionally/alternately, you can create the .bar file yourself and upload it. This is performed with the following command:-

$ cd APPNAME/bin/Release/
$ monoberry package APPNAME.exe

In addition to packaging the .exe and dependencies into a .bar file, this command will also create a simple app-descriptor.xml file (aka the bar descriptor file – more info here). I think you can edit this file if desired, and it will be used if you reissude the package command.

Extending the (limited) API

Currently, monoberry only supports a tiny subset of the available NDK APIs:- Button, Camera, Dialog, Event, Navigator, Platform Services, and a subset of Screen. However, this doesn’t limit your access to the NDK APIs, just makes them a little harder to access.

The NDK is comprised of header files, and libraries. By reviewing the header files, and the online documentation at http://developer.blackberry.com/native/reference/bb10/library_support_at_a_glance.html you can see what functions etc are available and what their prototypes are. You can then use P/Invoke to call native code in the DLLs. You then have the option to either: a) directly access the NDK APIs, or b) wrap them into a cleaner C# class, and then access via that. I recommend the latter approach. It is cleaner, and you have the option to add the code to the monoberry libblackberry.

For an example of this, please see: https://github.com/roblillack/monoberry/blob/master/libblackberry/dialog/Dialog.cs


In summary, following the above instructions it is relatively trivial to setup a C# build and deployment process for BlackBerry 10 (and, I would imagine, BB PlayBook). Currently there is very limited support for NDK libraries, however there is hope that this will expand as a) the project is still under active development, and b) it’s relatively easy to wrap the libraries with P/Invoke as needed.

There are still a number of questions outstanding though – the key one being ease of debugging. NDK debugging is normally handled via GDB, however this won’t work with an interpreted environment like this. Non-UI and non-BB10-specific components will be able to be run and debugged in native (i.e. Linux/Windows/Mac) environments with IDEs, but when the app is deployed on a device life will get much harder. This is currently an open question, and one to keep an eye on. Options include use of the Console, together with blackberry-connect and ssh, to log text output, but for those of us used to easy debugging using an integrated IDE, development in C# for BB10 will be a shock.

Still, a useful beginning, and I wish the project the best – I know I will be using it for my cross-platform development.

Update 30/1/2013

It turns out, I may have been too pessimistic about debugging. Mono comes with remote debugging support, and using the soft debugger I think I can debug live on the BB10 device. Even better, I can do it from Visual Studio! For info on the mono debugger, see: http://www.mono-project.com/Debugger and for info on debugging from VS there’s http://mono-tools.com/Debug.aspx I’ll update this post when I get a chance to try it out.

IPv6’ing my flat

For a long time now, I’ve been interested in IPv6 – the next generation protocol for the internet. All modern operating systems now support it, as do a large proportion of mainstream services and programs, but no-one actually uses it. During my recent network refurb, I decided to make my entire house IPv6-capable. Because I’m sad like that.

The first step was to look at how I could talk IPv6 to the world at large. Only after that was determined could I architect my internal network so it would a) work, and b) be secure.

Unfortunately very few ISPs in the UK support IPv6 natively. Be Broadband, my ISP, are vague about timescales and scope. So, the only option was to tunnel the IPv6 over IPv4 to an endpoint on the internet, at which point it would break out and be all good.

There are several companies that offer this service, “tunnel brokering” for free – I have had positive experiences with both Hurricane Electric (http://tunnelbroker.net/) and sixxs (http://www.sixxs.net/). This time, I decided to go for HE.

Step 1, register with HE and get a tunnel created

As I have a segmented network internally, I opted for a /48 network allocation. What this means is that I can create 65536 internal networks, each with 2^64 (a very big number) hosts. That should be enough :)

Step 2, create a tunnel endpoint

What we’re going to be doing is routing all IPv6 data on my network through this one host, which will wrap it with IPv4 and send it off to the HE tunnel endpoint. At this point the IPv4 wrapper will be removed, and IPv6 will pop out. Note that this tunnel will completely circumvent any NAT or IPv4 Firewalls! Which we’ll come back to.

So, to create the tunnel endpoint, I created a new VM on my server, and bound that VM to my spare ‘external’ NIC. This then plugs into a PIX, which plugs into the ASA on my network boundary, and then out. Linux was the obvious choice, and more accurately I’m using a Gentoo install with a whole 128MB of RAM and 1GB HDD assigned to it.

When registering for a tunnel with HE, it gives you sample configurations for all sorts of OSs. For me, it was the below (addresses changed to protect the innocent):

modprobe ipv6
ip tunnel add he-ipv6 mode sit remote local 188.220.xx.xx ttl 255
ip link set he-ipv6 up
ip addr add 2001:470:yyyy:yyyy::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr

Then (lets ignore the firewalls for a minute) it was just a case of pinging some IP addresses and I was sorted. Or I should have been. After about 30 mins of troubleshooting I found I could ping me, my tunnel endpoint, the remote tunnel endpoint, but not any farther. I fired off an email to HE asking for support, and within 5 minutes they had got back to me. Apparently there had been an error in a script and it was all fixed. This is customer service I can massively respect, and big kudos to HE for the timely response!

Okay, I now had an IPv6 connection, from my tunnel endpoint.

Step 3, the internet-facing firewalls

There are a PIX and an ASA between my endpoint and the internet, and each of these needed some tweaks to allow the traffic through. Specifically, I wanted only in/outbound IP protocol 41 (i.e. IPv6 over IPv4), and only between my external IP (I actually used a second static IP) and the remote tunnel endpoint.

These looked like:

access-list external_access_out extended permit ip any any
access-list outside_access_in extended permit 41 host host outside_ip3
static (external,outside) outside_ip3 netmask
access-group outside_access_in in interface outside
access-group outside_access_out out interface outside
route external 1

IPv6 is fully blocked from entering/exitting the network other than via this one tunnel.

Step 4, using the endpoint as a router

Firstly, we want to tell the router to forward IPv6 data between interfaces, but not IPv4. On my linux box, this was the following (note these settings aren’t persistent, you’ll need to edit the correct config files):

sysctl -w net.ipv6.conf.all.forwarding=1
sysctl -w net.ipv4.ip_forward=0

Step 5, some additional security

As the tunnel endpoint is essentially sitting unprotected on the internet, it must be deemed at risk. I have done the standard stuff – minimal services, strong passwords, patching etc, but what about the rest of the network. Ideally I could route the IPv6 data through my PIX, onto the network, and use the PIX for firewalling. In theory. Unfortunately Cisco suck, and the PIX cannot support IPv6. So, back to my trusty VMWare server. I create a new virtual network on the server, add an extra interface to the endpoint box, bind it to the new virtual network,  spin up another VM with two nics, and connect one of these to the virtual network and the other bridged onto the internal network via the server’s primary NIC. After enabling IPv6 only routing, installing iptables/ip6tables, I now have a linux-based firewall between the tunnel endpoint and my internal network.

So, how to configure it. Well, see below…

#NOTE: eth4=external (i.e. towards v6 endpoint), eth5=internal
# allow v4 access from the internal net, but not the external
#used for ssh, syslog, etc
iptables -P INPUT ACCEPT
iptables -A INPUT -i eth4 -j DROP

#allow anything from the inside out, but only established/related back
#also need to allow neighbour solicitation/advertisment, and I allow echo request/reply and destination unreachable
ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
ip6tables -P OUTPUT ACCEPT
ip6tables -A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 136 -j ACCEPT
ip6tables -A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 135 -j ACCEPT
ip6tables -A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 1 -j ACCEPT
ip6tables -A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 128 -j ACCEPT
ip6tables -A INPUT -p ipv6-icmp -m icmp6 --icmpv6-type 129 -j ACCEPT
ip6tables -A INPUT -i eth4 -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -A INPUT -i lo -j ACCEPT
ip6tables -A INPUT -i eth5 -j ACCEPT
ip6tables -A INPUT -j LOG --log-prefix "FW IN "
ip6tables -A FORWARD -p ipv6-icmp -m icmp6 --icmpv6-type 1 -j ACCEPT
ip6tables -A FORWARD -p ipv6-icmp -m icmp6 --icmpv6-type 128 -j ACCEPT
ip6tables -A FORWARD -p ipv6-icmp -m icmp6 --icmpv6-type 129 -j ACCEPT
ip6tables -A FORWARD  -i eth4 -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -A FORWARD -i lo -j ACCEPT
ip6tables -A FORWARD -i eth5 -j ACCEPT
ip6tables -A FORWARD -j LOG --log-prefix "FW FWD "

You may be wondering what all the ICMPv6 is about. Unlike IPv4, IPv6 doesn’t use ARP for neighbour discovery. Instead, ICMPv6 is used. Without allowing these packets through, address resolution doesn’t work, and hence your neither does your network. So that’s 135/136. 128/129 are for pinging, and 1 is destination unreachable.

Step 6, internal addressing

Okay, we now have a tunnel endpoint on the network, which routes data happily and securely, and I can route data to it from my internal network. Just one problem, in order to do so, I have to statically configure the IPv6 address. Which sucks. Sooooo, what about autoconfiguration?

In IPv6-world, there are two ways to do autoconfiguration: stateful and stateless. Stateful is basically DHCP. Stateless is something different though, and is much easier to implement and use. Whilst I do use DHCP internally for some hosts, I may want to autoconfigure a different subset of hosts for IPv6. So, stateless it is…

On linux, IPv6 autoconfiguration is done through the radvd program. It’s really easy to set up and use – see the config below… Basically the radvd (router advertisement daemon) will periodically send out “Router Advertisements” (another ICMPv6 type) saying “this is what this network is called”. Hosts then take the top 64 bits, concatenate their MAC address (or a random 64 bits if privacy extensions are in use), and there you have a valid IPv6 address.

interface eth0
    AdvSendAdvert on;
    AdvLinkMTU      1350;
    MaxRtrAdvInterval  300;

    prefix 2001:470:yyyy:xxxx::/64
        AdvOnLink on;
        AdvAutonomous on;
    route 2001:470:yyyy:yyyy::/64 {};
    route ::/0 {};

Step 7, services

The network is now almost there. And in fact, it completely was there I just didn’t realise it. Any host in the network now picks up an IPv6 address, routes it through the linux firewall and the tunnel endpoint, and thence through the magic of IPv6 over IPv4 tunnels onto the internet. Cool eh. Unfortunately we don’t all talk in numbers, and certainly not 128-bit numbers, and so we use DNS.

Which just worked. Seriously, I was pretty impressed. I had bind 9.4.3 running as a caching resolving DNS server for my internal network, and it automagically just worked for IPv6. For those who care, it was installed on Gentoo with the following use flags: “berkdb ipv6 ldap mysql ssl threads xml -dlz -doc -geoip -gssapi -idn -odbc -postgres -resolvconf (-selinux) -urandom”

And there we are – I now have native IPv6 in a dual-stack in my entire network, and it works. In fact, sometimes when I browse to websites (using Chrome) I apparently use IPv6 without my even knowing. And how cool is that?!!

World IPv6 Day

You may not have heard of it, you may not care about it, but IPv6 could cause you some troubles tomorrow (Wed 8th June).

On that day, the Internet Society have arranged a “World IPv6 Day”. A large number of services, such as Facebook and Google, are going to enable dual-stack IPv4/6 for a 24 hour period, to see what happens. Hopefully most people will not even notice the difference, but if you suddenly find that you’re having problems connecting to certain websites, that may be the reason.

Computers on the internet each have a unique address, similar to a phone number. That is called an IP Address, and currently we’re all using version 4 of the protocol – hence IPv4. Unfortunately there aren’t enough possible addresses – the world has pretty-much run out of them, and so a new version, IPv6, has been created, to try to fix the problem. Unfortunately, moving to IPv6 is a quite a technical thing to do, and is expensive for ISPs etc (the people who provide your internet connection), and so movement from IPv4 to IPv6 has be really slow. One big question is, what will happen when we do move? What will break?

The purpose of the World IPv6 Day (http://www.worldipv6day.org/) is to basically do a large-scale test on the internet, and see what happens.

So what can you, as a user, do? Well, better safe than sorry, so I’d suggest you browse to http://test-ipv6.com/  and give your computer a test. This will let you know whether you’ll likely experience any problems tomorrow. Most people still won’t be using IPv6 tomorrow, so don’t worry if the test says it’s not supported. The important thing is that your computer not think it can use it, when actually it can’t. It’s a long story I won’t bore people with.

As an aside, you can also check out your IPv6 connectivity by going to several IPv6-only websites. Again, most people won’t be able to access these, but it may be worth a go…





The Allure of Wild Camping

In his classic “Men are from Mars, Women are from Venus”, John Gray stated that when men feel stressed, they tend to withdraw to a ‘cave’. Men prefer solitude to solicitation, addressing a problem rather than discussing it. Indeed, many tend to revert to their cave-man origins when overextended or uncomfortable. For a small minority of us this reversion isn’t just metaphor; wild camping is a way to escape the clutches, and crutches, of modern life, however temporarily.

I live in a city of some 7.7m souls. The sounds I hear as I go to sleep are as likely to be a drunken couple arguing as wind through leaves and owls hooting. I am woken up not by the dawn chorus, but the sound of bellowing diesel engines as a parade of buses crawl their way up a hill. London is not truly a 24 hour city, but it is close enough that the difference is normally moot. As a Londoner, if I’m not careful, I live as often on perpetual fast-forward; I walk fast, snort in annoyance at the tourists ambling aimlessly in front of me, and heaven help the fools who stand on the left on the escalators! Work hard, party hard. Is it any surprise that sometimes it gets to be too much and the wanderlust strikes?

Wanderlust, a strong or irresistible urge to travel. Its German origin however is more specific, being from wandern (to hike) and lust (to enjoy or desire). Sometimes this urge drives me to travel internationally but over my ever-increasing years I have learnt some things: I don’t like people, air travel sucks, and most other countries/places around the world either suck, or are actually not that different to the UK when you get past the superficial differences in language and cuisine. It’s not uncommon therefore for my wanderlust to be closer to the original meaning of the word. And then some. And that’s when I go wild camping.

What is wild camping?

It may be easiest to describe this by comparing it to ‘normal’ camping.

‘Normal’ camping

Most people have gone camping at some point in their lives. You drive up to the campsite where you join at best a dozen or so other families, and potentially many hundreds. Like you, these families have quite literally brought the kitchen sink. You’re all in tents which weigh 20+kg, and can comfortably sleep 6+ people. Also in the car are footballs, games, a large gas canister, multi-ring gas hob, water carriers, and a plethora of other things to ensure that the outdoors have as many modern conveniences as possible. Some people even bring televisions and generators…

Don’t get me wrong, some camping is better than none, and kids are a nightmare to keep occupied. Camping used to be a cheap way to do a holiday, but campsites now appear to be amazingly expensive for singles, or even couples. Also how close to nature can you really feel when surrounded by screaming kids, and sometimes screaming adults.

Wild camping

The actual definition for wild camping varies greatly. I’m going to use my personal definition, which is a lot more extreme than many. Wild camping is to normal camping, as backpacking is to a package tour. There’s no assigned area for camping, you just set up your tent (or less) wherever you’d like. You’re on your own, not surrounded by others. There’s no potable water, or showers (unless there’s a handy waterfall nearby). The location can vary from bog-average countryside, to the real back of beyond. You may be in a real but lightweight tent, used a base-camp for multiple days, or an uber-lightweight bed roll which you carry as you walk. You’ll be carrying in your supplies, carrying out your trash, and having the minimum possible impact on the wildlife around you.

No matter how you do wild-camping, a common aim is to be as close to being in a natural, wild, environment as possible in today’s over-populated increasingly tamed and urbanised world. Personally I hope to not see a soul the entire time I’m away.

It is difficult to describe how great the feeling is when it appears you’re the only person left in the world; when your only decision is should I go North, or East for the next mile; to see a large hill, wonder what the view would be like at the top, and just walk up it, and then tired after what was a surprising slog, to just set up your camp where you fall, and to be dozing only 10 mins later, snug and warm, with a postcard-worthy view your last sight before you drop off.

Whilst you’d imagine it sucks to wake up cold and shivering in the morning dew, it doesn’t take long for the morning sun to begin to warm you, and the contrast between them is very sweet. It’s an amazing feeling to be surrounded by cloud so thick you can’t see any landmarks, and grasses seemingly untouched by the feet of man. To be alone, and so at peace you could weep.

I can’t imagine feeling any closer to nature than when I’ve been dozing off under the cover of a poncho, wrapped in a bivvi, and startled awake from the sound of light footfalls behind me, to roll over and see deer grazing in the moonlight only a couple of meters behind you.

Of course, it’s not all summer evenings and gently gambolling deer. But even the days when it never stops raining, or the wind is blowing hail sharp as needles into your face, are completely worth it. It makes you feel alive, in a way that’s difficult to describe, as long as you’re willing to let go the shackles of comfort from the modern world.

Wild camping really isn’t for everyone. I strongly recommend you go ‘normal’ camping a couple of times first. Your first wild-camp shouldn’t be too wild or extreme, and do it in the summer months in good weather. Over time you can ramp up the difficulty and extremeness, to a level at which you feel comfortable.

Types of wild camping

It is impossible to fully define wild camping, other than to say that it is camping at places other than organized campsites, ideally in the ‘wild’. It can generally be grouped into four categories though, based more on the equipment used than the type of camping performed (although they tend to be linked).

As the name implies, you use a car or motorhome to both get to where you’re going, and as a place to sleep when you get there. This may be some car park or lay-by in the middle of nowhere, or even a car park in somewhere more urban. It’s cheap, easy, and relatively comfortable, and allows you to cover large amounts of distance. You can carry all sorts of modern conveniences with you. However you lose any real flexibility on where to go or sleep.

Normal tented

For semi-wild camping, where you’re going to have to walk at most a few miles to get where you’re camping, you can take a normal tent. This especially works for groups of 2-4 people, sharing a single tent, as you can split the components between you.

Most people in this category don’t wild camp. Setting up, and taking down, a camp with all the equipment takes too long, and so it will generally be used as a base-camp, in an established camp site, for several days. Where people in this category do wild-camp, it will be to do something different, and not that much distance will be covered.

For one person, in semi-okay weather, carrying a normal tent and full camping gear is excessive (and rather heavy).

Thus lightweight camping has been born. As camping technology has progressed, it has proven possible to do the same but with lighter weight components. Tents, sleeping bags, matts, all have been made lighter over the years.

Lightweight wild camping is about more than just using lightweight equipment though. It’s about paring down the list of kit you take, and removing some of the unnecessary items. Do you really need 3 changes of clothing? Or the spare everything you take just in case?

Most solo travellers will fall into this category. You want to take enough with you to be comfortable, but not so much that it’s a pain to carry.

For some people, even lightweight isn’t sufficient. This is for a combination of reasons: you may want to travel long distances each day, or cover very arduous terrain; you may not be in especially good shape, and want to minimize the weight on your back (well, hips technically); you may want to feel the challenge of surviving comfortably with a minimum of kit.

The Ultra-lightweight campers are all generally wild campers, as if you’re going to be staying at established campsites you may as well not worry as much about weight. Daily distances of 20+ miles are not uncommon in this category.

The ultra-lightweight camper will know, and worry about, the weight of everything. Why have a full length sleeping mat when a ¾ length will do, and will save 100g. By taking pre-cooked hydrated food for 3 days, you increase weight by 400g, but save 500g as you don’t need to take a stove. By using a bivvy-bag instead of a tent, you can save 1kg.

I fall in this category, for several reasons:-

  1. I’m lazy, I want to carry as little as possible,
  2. I like to cover distance – I want to walk reasonably far, which a heavy pack will make harder
  3. I tend to sleep when I drop, and walk when I wake – setting up a tent etc adds time, is harder to hide when in England, and isn’t trivial to do in the dark
  4. I like to rough it – my normal life is very comfortable, and I really like the contrast of the hardships of the ultra-lightweight camper

Ultra-lightweight very much isn’t for everyone. Generally the lighter an item, the more expensive. You have to spend real time weighing options and considering alternatives. You need to have experience camping, to know what is optional and what really is a necessity. But the rewards are, in my opinion, completely worth it.

Law in the UK

All of my wild-camping thus far has been in the UK, where there are a hodge-podge of rules and laws. You need to be aware of these when considering where, when, and how to wild-camp.

England and Wales – All terrain in England and Wales is owned by someone, and you need the permission of the landowner to wild camp. That’s the law. The reality though is that you can normally get away with it, the more rural the better. Snowdonia and the Peak District are generally okay, as long as you follow certain guidelines: pitch late and rise early; don’t stick out, use dark colour equipment; camp out of sight of paths and away from roads and properties; leave no sign of your presence when you leave; only stay one night, and only in very small groups; don’t use open fires (or any fires in many cases – see hints, tips, and rules, below); avoid anywhere with livestock or crops. The one exception on the legality rule is Dartmoor. It is legal to wild-camp there, however you need to be careful to avoid the military live-fire and training scenarios. Also, Dartmoor is very marshy in many places, and the weather can be dangerous at times, so be careful.
Scotland – The right of foot access is established in law, and wild camping is legal with some caveats. You mustn’t camp where crops are being grown, and must be away from any properties etc. Overall, follow the guidelines for England, and you’ll be fine.
International – I have no direct experience outside of the UK, and laws vary wildly. Many countries do allow wild camping however, and in general the more rural the area, the more acceptable. You should always check the local laws before camping. Note also for British wild campers, there are dangerous wild animals outside the UK, which must be taken into account – for example you may need to keep a fire going, cook and store food several hundred metres from your campsite, and take other precautions.

Hints, Tips, and Rules

Below I’ve tried to highlight some of the things I’ve gleaned over my years. Overall though, the key things are to:-

  • Pitch late, leave early
  • Leave it as you found it
  • Be considerate of others

The Rules

So, first of all, some rules:-

  • Carry out all trash. This includes my pet peeve – cigarette butts. Anything which isn’t biodegradable over a month or so, pack out. Anything that is, you may be okay burying. When in doubt, pack it out.
  • Go to the toilet at least 100m from any water (lakes, streams, whatever). When having a crap, dig a hole at least 6 inches deep, and cover it up after. You may be able to also bury used toilet roll, but any sanitary products must be packed out as they don’t biodegrade, and animals will tend to dig them up.
  • Keep groups small and unobtrusive
  • If asked to move off, apologise for causing a hassle and do so with minimal fuss
  • Don’t dig drainage ditches etc if at all possible
  • Don’t have an open fire. Whilst romantic sounding, they’re a blight on the countryside. Furthermore, in the summer they can be dangerous
  • In the summer months, when everything is dry, and especially on peat, don’t have any fire whatsoever. Be careful even with glass in sunny conditions.
  • When you leave off, there should be no sign (other than some depressed grass etc which will bounce back quickly) that you were ever there.

Hints and Tips

And now some hints and tips:

Tent placement: When placing a tent, you need to consider four things.

  1. Ground levelness: The more level the better, try to avoid or slightly flatten any humps, tussocks, etc
  2. Ground slope: Have as little as possible. Sleep with your head above your legs if there is a slope
  3. Drainage: You don’t want to be in a dip which may get flooded if there’s any rain. Remember, water flows downhill, and collects at the lowest points. Don’t dig drainage ditches though, as they damage the environment.
  4. Wind: Most tent manufacturers specify how a tent should be oriented in wind. When in doubt, put the entrance opposite to the expected wind.
    1. Water: There’s no need to buy expensive flasks etc, any plastic bottle will do. I definitely recommend that, in addition, you have a camelback type system, to allow easy hydration when walking. When you can sip whenever you want, it’s remarkable how quickly 1.5L of water disappears! If you’re high up then you won’t need to purify water realistically, but when in doubt you can do so easily with Chlorine or Iodine. Rather than paying for expensive neutralizing tabs, Vitamin C effervescent tablets do the same task. Note that chemical purification will not kill all organisms, so if you’re really worried, then you’ll want a reverse-osmotic filter. But frankly I think that’s all overkill. Just be sure to only take water from actively flowing sources (no lakes or pools), as high up as possible, and not downstream of any active livestock farming. To refill the camelback, you will want a hard container – doing so without in a stream is a real pain in the arse.

      Sleeping mat: It is absolutely necessary to have a sleeping mat. It is remarkable how much heat gets lost to the ground otherwise. There is no need for a full length one however, all you need is something from shoulders to hips or knees. I also recommend air rather than foam – the thermarest ¾ length models are generally excellent.

      Cooking: Avoid solid fuels, use either gas or spirits. You’ll only need 1 pot/pan per person, get something like a mess tine. Evenings are long so there’s no need to rush cooking. Have (rehydrated) soup as your last course, as it warms you up before bed, and partially cleans the pan during cooking. Pick food that is light and dehydrated, as it will be easier to carry – pasta, rice and noodles are all good options. I also take some dried meat and some granola, for trail eating. Alternately, during the summer, don’t take any cooking equipment. There’s plenty of food you can eat which will both keep without refrigeration and you can eat without cooking, and it will save you weight. When cooking, remember that the stove itself will radiate heat outwards, so be carefully about accidentally starting fires. When in doubt, wet down the area around the stove.

      Head torch: Absolute necessity. Don’t bother with any other torch or lamp, but make sure you have spare batteries.

      Plastic bags: Always bring a few with you, for packing out waste (incl. bodily, potentially), and also for ad-hoc waterproofing.

      Trowel: Don’t forget your trowel, but try to find a (strong) plastic one for weight reasons. You will need it if you need a crap, and you may end up having to dig in quite hard soil. Where possible though, make use of public facilities, and hold it in if you don’t need to go. I often do 2-3 day trips with no actual need to go. If you do go to the loo, do so at least 100m from any water.

      Navigational equipment: Always have a paper map with you, and know how to use it. A compass is often very worthwhile as well. I often take a GPS, but that is more for route archiving than more navigation. It can be useful just to double-check your position if you’re not 100% sure (e.g. in very foggy weather).

Arbitrage in Gambling

I don’t generally gamble much. My brain just doesn’t seem to be wired right for gambling – I get no real thrill from winning and feel no real pain when losing. I’m aware it’s not even zero-sum for the gamblers – the book-maker takes a large cut – and so unless I have some form of edge, I know that in any large-enough set of bets I will average losing money, so I don’t bet.

However, a few years back I encountered the concept of arbitrage, as applied against gambling. By arbitrage I can make money with (in theory) minimal risk, although not huge amounts of money. For some reason though, the gaming of the gaming systems really tickles me – the money is almost just a way to keep track. Still, in certain situations I can and have made money with a much better rate of return than would occur if I just put my money in the stock funds or similar, so it’s not too bad…

I thought the concept may be of interest to some of my readers, and so will describe it below.

The Principle

The Concise OED defines arbitrage as: “the simultaneous buying and selling of assets in different markets or in derivative forms, taking advantage of the differing prices.”

In longer term, the idea is that you both buy and sell something, or in gambling bet for and against something, in different places such that no matter what the result, you win. For example, say you’re going on holiday to the US, and a dollar costs £0.80 at one currency exchange (A), but £0.90 at another (B), you’ll obviously buy your dollars from A. However, most places tend to quote two different prices – one for you to buy dollars, and the other for you to sell them dollars. The larger the difference between the prices, the more profit the currency exchange will make on every transaction – this ‘spread’ is one of the ways currency exchanges make their money, and in general if somewhere does a trade with ‘0% commision’ then their larger spead will more than make up the difference. But that’s a whinge for another day…

Let’s say in the example above, A sells dollars to you for £0.80, and buys them back for £0.75. B however sells at £0.90 and buys back at £0.85. It wouldn’t make much sense buying a load of dollars from A, and then selling them back again, as you’ll lose £0.05 for every dollar you trade. But what about buying from A, and selling to B? You can buy a dollar for £0.80, but then sell it back for £0.85 – that’s £0.05 profit for every dollar you trade! Free money!!

There are some risks, and some problems though. Firstly, say you’ve only got £800 to spend. That means you can only buy $1000 at A, to take to B, to then sell. Then you can go back to A and buy another $1000, and either pocket the £50 profit, or use that to buy even more dollars. Unfortunately though the spread in most activities is normally more like 0.5%, so you’d only make £5 for every $1000 dollars you trade, and it would tie up your £800 to do so.

Let’s say you’ve done this a couple of times, and you’re now walking to B with your $1000, ready to sell them. Unfortunately, when you get to B, you get a big shock! B now has lots of dollars, more than they need. So they have reduced their buy/sell prices to the same as A. So you now have $1000 dollars which, if you sell them, you’ll lose £50 instead of make £50. Now in this example it’s fine – you need the money to go on holiday with anyway. But what happens if this is stock, or a bet, which you really don’t want? Well, that’s one of the several risks in arb’ing.

Arbitrage in gambling

The previous example used the currency market (albeit in a high-street context) as an example. Unfortunately, the spread between buy and sell prices for currency on the high street is generally far too large for there to be any prospect of arb’ing there, and the international currency markets, and stock markets, are playing by the big boys, with millions of pounds of computers – there’s no real chance of playing there either.

However, there still exists somewhere you can perform arbitrage. And it’s not even illegal (unless you’re in the US) or immoral (unless your religion bans it). And that place is, gambling.

Traditional Book-makers

The traditional bookies allows you to bet on an event happening, for example to bet on a horse winning. Say there’s a 2 horse race, each given odds of 2.0 (or 1/1 in fractional odds – see http://oddsconverter.co.uk/ for an easy way to convert between). If you put £1 on horse 1, you’ll get £2 back if it wins – that is you’ll win £1, and get your original £1 back. If horse 1 loses, you lose it all. And ditto for betting on horse 2, and horse 2 winning – £2 back.

In reality though, the bookies always make money. How do they do that? By fixing the odds. For example, in the 2-horse race above, they may choose to set the odds at 1.8 (4/5), so if you bet £1 and win you get £1.80 back. If 100 people bet on horse 1, and 100 on horse 2, then all the people who bet on horse 1 get £1.80 – the bookie pays out £180, but £100 of that is just the money that the people bet on horse 1, i.e. their stake. So horse 1 cost the bookie £80. However, all the people who bet on horse 2 get nothing, and so the bookie keeps their £100. So his profit on the race was £20 – and that would happen no matter which horse won. What if lots of people had bet on horse 1, and very few on horse 2, you may ask. Well, in that case the bookie would have changed the odds – shortening the odds on horse 1 (so, for example they only get 20p of winnings instead of 80p), and lengthening them on horse 2 (so they may get £1.20 instead of 80p). This way, again, no matter what, the bookie wins.

Now in this traditional world, you could arbitrage between different book-makers, especially when there are only a small number of contenders. Boxing, for example, only has 2 contenders, and if one bookie is offering good odds on boxer A, and another on boxer B, you could spread your bets between them and guarantee a profit. Each bookie sets their own odds, based on how much is being bet with them for each contender, so you could also take advantage of national or regional boundaries. For example, more people will bet for their local team, so in Barcelona vs Man Utd, it may make sense to bet on Man Utd with a bookie in Barcelona, and Barcelona with a bookie in Manchester. Maybe.

Unfortunately, the bookies do monitor each other, and furthermore many are large international chains, so large variations don’t occur. Also, the spread in odds is so large that, similar to the currency exchange problem, arbitrage opportunities are unlikely to occur.

And this brings me to something I encountered properly for the first time only a few years ago – the betting exchange.

Betting Exchanges

The betting exchanges exist to match up people who want to bet both for, and against, something. The exchange takes a small (often 2.5-5%) cut of any profits a gambler makes, rather than setting the odds themselves. What they instead do is provide a forum by which people can make, and accept, bets.

Say there’s a horse race, with several horses. You’re pretty confident that horse X won’t win, but don’t know which of the others will. Due to the large margins traditional bookies use, there would be no real way to make the bet that you want – the closest equivalent would be to bet on everyone except X, but that wouldn’t be profitable even if X did lose.

With a betting exchange what happens is that you offer to accept someone betting on X with odds A, up to value B. This is called a ‘lay’. If someone else thinks X will win, and they find your odds acceptable, then they’ll place a bet with you for up-to B. This is a ‘back’. You pay into escrow the money that that you would have to pay the backer if X wins, and the backer pays into escrow the money they would have to pay you if it loses. Thus in this case, you are sort-of playing the role of the traditional bookie.

As there is no traditional book-maker at play here, there tends to be very small spreads between back and lay positions. Furthermore, the odds being offered can vary very quickly – individual gamblers will often react more quickly than the traditional bookies.

This opens up several possibilities:-

  1. Bet with a traditional bookie, and ‘lay’ with the betting exchange
  2. Take advantage of positive-sum (for you) conditions in odds, where you can bet on (or against) every option but the odds are such that you win money no matter what
  3. Take advantage of variations in odds over time (technically not arbitrage as their not simultaneous, but good enough)
  4. Take advantage of variations across different betting exchanges

The primary betting exchange I use is Betfair. Over time their terms and conditions have become slightly less advantageous, but they’re still the best I’ve encountered. Even cooler they have open APIs which allow you to monitor the odds etc for different bets, and even make bets if you feel that insane.

Most bookies do not like arbitrage, and will cancel your account or limit the amount you can spend if you do it. Betting exchanges in general, and Betfair specifically, take quite the opposite stance. In fact, they do cute things such as if you make a profitable arbitrage on a given condition (i.e. race + winner) such that part of the money held in escrow will be paid out to you irrespective of the winner, then betfair will return that money to you immediately. This allows you to increase your leverage.


The examples I used below are broadly factual. The odds have been made up, but the events themselves occurred, and I did make a killing off it.

Example 1: Before/after leaders debates for 2010 UK general election (Betfair)
In the lead-up to the 2010 UK general election, I felt the Lib Dems were going to do reasonably well, so I placed a couple of bets. At the time they were on odds like 15 and 16 (i.e. 14/1, 15/1). Then the first leaders debate happened – at which Nick Clegg did very very well.

Suddenly, the Lib Dems were looking like real contenders. Initial feedback was positive, but no-one went straight to their computers. On a hunch, I put a bit more money down on Lib Dem positions in marginal seats where they may have stood a chance, and on the overall result. The next day, the first of the new polls came out, giving the Lib Dems a huge bump. Within a few hours, the odds had massively shortened, from the 15 or so range at which I’d bought in, to phenomenally low levels such as 3 or 4 (2/1, 3/1). It appears that betting exchanges are as liable for over-compensation as stock markets.

So I was facing a bit of a quandry. Option 1, stick to my guns, and make lots of money if the Lib Dems actually did well. However, knowing UK political history, and the vagaries of the First-Past-The-Post system, I was aware that the Lib Dems would need an absolutely immense swing in order to do as well as some people were suggesting. So I used Option 2, arbitrage.

Any position I’d taken where there was a greater than 5% swing, and that had no other fun politics around it (e.g. Bercow’s seat), I cashed in. In many cases the swing was much, much larger. For example, I had backed £10 with odds of 14 (i.e. bet on the Lib Dems winning a seat, at 13/1 odds). I then layed the same seat at odds of ~4, putting £40 down to say that they wouldn’t win. This worked out at around £28 profit. And what’s even better, as I’d done both bets with Betfair, I immediately got all the money I’d bet/lay, plus the profit, back – essentially the bet was transferred so that the person who’d backed my lay was now matched with the person who’d layed my back. I had become a sort of middle-man, just extracting my profit in the interim!

Example 2: After leaders debates for 2010 UK general election (Multiple book-makers
Very quickly I had exhausted my original positions with the Lib Dems, and started looking out for other possibilities. Positions kept popping up over the course of the elections, but gone were the 20-50% profit margins – things settled down to around the 5% mark (I didn’t bother with anything less than that).

Another option opened up, however, that of using the traditional bookies.

Following the successes of Nick Clegg at the leader’s debates, combined with the general levels of dissatisfaction towards both the Tory and Labour parties, the Lib Dems continued to look very popular. The betting exchanges were very much in favour of the Lib Dems, and so the odds were generally quite short for them, for both back and lay positions. What’s more, these odds stabilised within very short time frames of key polls being published, or debates happening.

The traditional book-makers however were a lot slower to change their odds. This led to the situation where the odds at the traditional bookies (essentially a ‘back’ position, as they don’t offer ‘lay’ positions) were much longer than the ‘lay’ positions on the betting exchange. This is a situation which guarantees profit, and the margins were often in the 5-10% range, with some 15%.

The one downside of using the traditional bookie is that you won’t get any winnings until the actual event occurs. Thus you cannot repeatedly leverage the same money in the way that you can in Example 1. By the end of the election period I had some £2000 tied up in arbitrage positions in this way.

All told though, from that £2000 I made a profit of over £200. Not too bad for 30 days of ‘investment’…


So, how to do arbitrage. Well, it’s not just a case of sticking your finger in the air and hoping. The whole process is very methodical and mathematical. What’s more, you need to be very sure of your maths – if you get things wrong you can lose a lot of money very quickly.

The other thing you need to do is get organised. When you have several positions on a given candidate/horse/whatever, made up of several bids and lays, of varying amounts, made over a period of time, life can get very complicated. Personally I’ve a spreadsheet to calculate things, and am in the process of writing some software (the election finished before I completed it, and I lost interest after).

That said, there are some rules of thumb. Firstly you need to Back high, and Lay low. If you do it the other way round, you’re in trouble. Secondly, you’ll generally need to put more money down for the Lay, than for the Back (unless the Lay has gone very short odds indeed).

There are some really useful websites to help you with your calculations. The one at http://www.chromaweb.com/bets/calculator/index.php is excellent, and I have used it extensively. It doesn’t just allow you to calculate the amount you need to Back/Lay to cover a given Lay/Back position, but also allows for an acceptance of liability. For example, rather than take a 50/50 share of the profits irrespective of the result, if you think that the back position is much more likely then you could take a 100/0 share – i.e. only Lay enough to ensure you never lose money, but make lots more money in the event of the Back coming true.

For the algorithms themselves, I leave that as an exercise for the reader. If I find my spreadsheets, I’ll make them available here, but I think they’re lost in the ether. Make sure you test, test, test though when you do come up with your own algorithms. I messed up on my first try (can’t remember why), and ended up barely scraping even on about £1000 of trades!


There are several risks that arise when arb’ing, and especially when doing arbitrage with gambling/book-makers. I’ve highlighted the big ones below, let me know if there are others. The big thing to remember is that due to the small margins when doing arbitrage, and hence the large amounts you will need to leverage in order to make any real money, all it needs is for a negative event to happen once to wipe out the profits from a hundred successful arbitrage trades. Even worse, you may lose all the money you have ‘invested’, not just the profits.

That last point bears repeating. In the worst case, say you’ve bet heavily against some seemingly sure event, tried to arb in the opposite case, and that arb failed, then you could be left with a position where you have a huge bet riding. If the seemingly sure event actually happened, you will lose all the money you bet. So as ever, never bet more than you can afford to lose!!!! Arbitrage may seem like a sure deal, but as ever if it looks too good to be true, it is!

So, what are these risks….?

  1. Price changes: If you back, and then lay, and the lay odds have changed in the interim, you may end up losing money
  2. Bookies don’t like arbitrage: And they may choose not to accept a bet. Furthermore, they may limit the amount they allow you to bet in any event, which could seriously affect the amount you can leverage. To reduce the risk from this, I prefer to place my bets with the most likely event first (so that if I end up with an umatched arb, at least it’s the likely event I have my money on). Also, only bet whole and sensible numbers with the bookies – £10 will raise much fewer red flags than £10.36.
  3. Race/event/whatever cancelled: If an event is cancelled, normally your money will be returned to you. This is fine as long as both back and lay positions are returned, but if you’ve taken a more complex set of positions, this could cause problems.
  4. Evidence of market manipulation: Bookies all reserve the right to cancel bets at any point, if they think there’s been any manipulation, or any technical problem that has led to incorrect odds. So, if you see a sure thing at 50/1, then don’t take an arb out on it – there’s a chance the bookie will cancel the bet. You’ll get your Back money back, but the lay bet will still stand, leaving you in an unenviable position which may lose you lots of money. Rule of thumb, don’t take arb positions on anything with a margin greater than 20%, unless you’ve a very good reason to do so.
  5. Maths cock-up: Everyone makes mistakes with their maths. If you’ve got your maths wrong, you may end up in a situation where you have a guaranteed loss, rather than a guaranteed profit.

Cash machine receipts

Seriously, who uses cash machine/ATM receipts these days?

And what’s more, why are there competitions on the back of them?

The receipts from cash machines can be useful to some fraudsters, giving all sorts of interesting information. Also, most people treat them as trash, putting them in the bin if we’re lucky, or just throwing them on the floor if not. There’s often a little mini-bin to put receipts into near the cash machines, but they’re normally full and overflowing.

It also doesn’t make any sense to me that there are competitions on the back of the receipts. Why? Does anyone ever actually enter? Why do the banks want to reward people who are costing them money and being environmentally unsound by printing out unnecessary documents? Maybe they should be rewarding people for not printing out receipts, by automatically entering users into the draw…? I’m just saying…