📜 ⬆️ ⬇️

GSM on the table

Web development: HTTP, HTML, CSS, JavaScript, Python ... Oh. Everything is the same. So you want to be distracted by something radically different. I inhabit the Neuron hackspace in Moscow! Why not ask around?

For example, in Neyron sit guys from the company Fairwaves , developing GSM-equipment for low-cost cellular networks. The entire stack - from hardware to software - is available under an open source license. Yes, yes, including iron . Therefore, it is not at all necessary to work in Fairwaves to get acquainted with this technology. And the result of the digging can be put on GitHub or make a contribution to an existing project . At the very least, there will be something to brag about at the interviews.

A couple of days of reading the documentation, scrolling through the code, dozens of obsessive questions and experiments (thanks to Alexander Chemeris and Ivan Klyuchnikov for help). And here is the result - a private GSM network under the control of my MacBook:
')
Habrafon

To test the network, came the hackspace guests:

The robot receives SMS 'Hi, Habra!'

What are they talking about?

Robots talking at the laptop

How it works? Like this:

  + ---------------------------------------- +
  |  MacBook |
  |  |
  |  + ------------------------------- + |
  |  |  VirtualBox Virtualka |  |
  |  |  |  |
  |  |  + ---------------------- + |  |  |
  |  |  |  Docker container |  |  |  \ |  / |
  |  |  |  (Ubuntu 12.04) |  |  |  \ |  / |
  |  |  |  |  |  |  \ |  / |
  |  |  |  + ------------- + |  |  |  + ---- + ---- + + ------- +
  |  |  |  |  OpenBSC |  |  |  |  |  |  |  |
  |  |  |  |  (osmo-nitb) | <------------------------- + basic |  |  GSM |
  |  |  |  |  |  |  |  |  |  station |  |  TV |
  |  |  |  + ------------- + |  |  |  |  |  |  background |
  |  |  |  |  |  |  |  |  |  |
  |  |  + ---------------------- + |  |  + --------- + + ------- +
  |  |  |  |
  |  + ------------------------------- + |
  |  |
  + ---------------------------------------- +

VirtualBox runs on a computer with Ubuntu, which runs a Docker container with Ubuntu 12.04 and an open source base station controller OpenBSC (Base Station Controller, BSC). In my case, OpenBSC works in the network-in-the box mode and includes not only the BSC, but also a simple implementation of all the other components needed for a small GSM network ( MSC, HLR, VLR, AuC and SMSC ).

The base station of Fairwaves UmSITE is connected to the controller via the local network, where OsmoBTS runs - an open source implementation of a GSM base station (Base Transceiver Station, BTS):

UmSITE photo

To start a GSM network, one (!) Command is enough:

  docker run -v $ HOME / db: / var / db -i -t -p 3002: 3002 -p 3003: 3003 -p 30000: 30000 / udp -p 30001: 30001 / udp -p 30002: 30002 / udp -p 30003: 30003 / udp -p 30004: 30004 / udp -p 30005: 30005 / udp -p 30006: 30006 / udp -p 30007: 30007 / udp shamrin / osmonitb start-nitb -i 10.0.0.10 -n HabraFon GSM1800 10 20

(No Docker? Install it. You do not have Ubuntu and Docker is not installed? Then see below.)

10.0.0.10 should be replaced with the Docker network address of the host (ifconfig). A 10 and 20 on used channel numbers, ARFCN . What channels indicate, you ask? It's a difficult question. On GSM frequencies you can not emit anything without a license, regardless of power. A mere mortal license is impossible to obtain. The following options remain:

  1. Test in a Faraday cage . If there is no Faraday cage of suitable size, imitate it in a deaf basement, where the cellular network does not catch and where there is no risk to interfere with cellular operators (and they will not interfere with you). In this case, the entire radio frequency spectrum is at your disposal and you can specify any pair of numbers in the range from 512 to 885 with a difference of no less than 2-3 channels (preferably 10 channels). For example, 600 and 700.
  2. Under the supervision of a qualified specialist, find a couple of unused channels and indicate these channels at launch. For example, using a phone that can scan the air, such as Sagem OT. Once again, under the supervision of a qualified specialist!

For information on other container options and start-nitb see my repository .

And if I do not have Ubuntu?

If you do not have Ubuntu 12.04+, install Vagrant and VirtualBox and launch the Ubuntu + Docker virtual machine using these commands:

  git clone https://github.com/shamrin/osmonitb-docker
 cd osmonitb-docker
 vagrant up
 vagrant ssh

Why docker?

Yes, it is not necessary to use a docker. You can set everything up and adjust with your hands. But, first, I wanted to experiment with Docker. Secondly, with it you can securely wrap, and then repeat the configuration of the whole machine (debian-packages, manually installed programs, configuration files). Thirdly, the list of dozens of commands and manipulations is replaced with one - docker run …

Why not openbts?

In addition to the described projects Osmocom (OpenBSC, OsmoBTS, OsmoTRX ) there is another open source implementation of GSM protocols - OpenBTS . The age of both projects is about the same, but OpenBTS is better known on the Internet due to a bit more friendliness to beginners. If you do not delve into the technical differences, then in real conditions Osmocom works better :
We started using software for real life deployments than OpenBTS. More and more flexible.

Where to get the equipment?

The easiest option for Moscow residents is to use the equipment in the Neuron hackspace :)

If you do not live in Moscow or just want to have the equipment to play with GSM at home, there are two relatively inexpensive alternatives for laboratory use:


In terms of capabilities, they are approximately close, but UmTRX has advantages:


If you want to save a little and are not afraid of problems with the reference generator, you can use the USRP B200. It has only one channel, but for home experiments it doesn’t matter. The reference generator of the USRP B200 does not correspond in accuracy to the GSM standard, but in most cases it is enough for simple work “on the table”. With USRP B200, you may have problems with handover from one base station to another, but you don’t plan to build a valuable network on your knee, right?

But I can be biased, check for yourself.

Thanks to Andrei Bakhmat, Ivan Klyuchnikov, Pavel Trukhanov, Alexander Chemeris and other participants of the Hackspace for comments on the drafts of this text.

Source: https://habr.com/ru/post/213845/


All Articles